Anti Turret Control Script

Is thier a script i can put in a map that prevents the use of a specfic base turret(that uses any barrel) from being controlled by people?

Comments

  • Probably.
    There might even by a variable you can change.

    If there isn't, you should hit up some of the guys in #tribes and convince them to write one for you.
  • function serverCmdControlObject(%client, %targetId)
    {
    // match started:
    if(!$MatchStarted)
    {
    commandToClient(%client, 'ControlObjectResponse', false, "mission has not started.");
    return;
    }

    // object:
    %obj = getTargetObject(%targetId);
    if(%obj == -1)
    {
    commandToClient(%client, 'ControlObjectResponse', false, "failed to find target object.");
    return;
    }

    // shapebase:
    if(!(%obj.getType() & $TypeMasks::ShapeBaseObjectType))
    {
    commandToClient(%client, 'ControlObjectResponse', false, "object cannot be controlled.");
    return;
    }

    // can control:
    if(!%obj.getDataBlock().canControl || %obj.getMountedImage(0).getName() $= "MissileBarrelLarge") // z0dd - ZOD 4/18/02. Prevent missile barrels from being controlled
    {
    commandToClient(%client, 'ControlObjectResponse', false, "object cannot be controlled.");
    return;
    }

    // check damage:
    if(%obj.getDamageState() !$= "Enabled")
    {
    commandToClient(%client, 'ControlObjectResponse', false, "object is " @ %obj.getDamageState());
    return;
    }

    // powered:
    if(!%obj.isPowered())
    {
    commandToClient(%client, 'ControlObjectResponse', false, "object is not powered.");
    return;
    }

    // controlled already:
    %control = %obj.getControllingClient();
    if(%control)
    {
    if(%control == %client)
    commandToClient(%client, 'ControlObjectResponse', false, "you are already controlling that object.");
    else
    commandToClient(%client, 'ControlObjectResponse', false, "someone is already controlling that object.");
    return;
    }

    // same team?
    if(getTargetSensorGroup(%targetId) != %client.getSensorGroup())
    {
    commandToClient(%client, 'ControlObjectResonse', false, "cannot control enemy objects.");
    return;
    }

    // dead?
    if(%client.player == 0)
    {
    commandToClient(%client, 'ControlObjectResponse', false, "dead people cannot control objects.");
    return;
    }

    //mounted in a vehicle?
    if (%client.player.isMounted())
    {
    commandToClient(%client, 'ControlObjectResponse', false, "can't control objects while mounted in a vehicle.");
    return;
    }

    %client.setControlObject(%obj);
    commandToClient(%client, 'ControlObjectResponse', true, getControlObjectType(%obj));

    This is from the Classic scripts, which has the anti control missile that was added. Does ne one see someway that i can just add a simple variable to the turret, or does a script have to be made
  • If your goal is to just shut down turret control entirely, it should be way easier than all that, unless I'm forgetting something very important...
    function serverCmdControlObject(%client, %targetId)
    {
          commandToClient(%client, 'ControlObjectResponse', false, "object cannot be controlled.");
    }
    

    Also, use code tags to post code, not quote tags.
  • There is a lovely flag the game provides called the canControl flag.
  • There is a lovely flag the game provides called the canControl flag.

    is that

    canCantrol "false"; ?
    or canCantrol "0"; ?
  • edited June 2009
    Phantom, that flag looks to be datablock specific, not a per-object flag.
    And, I think he's looking for a catch-all
  • Well my problem was that the map has turrets on opposite teams that are in range to kill each other. GasMask has this same problem, 2 AA turrets within range of eachother, and people at the begining control the turret and fire down the other one.

    That is the problem, so the Code Red Shifter gave me works fine, I really dont have a problem having all the turrets non controlable, no one should be anyways.

    But for future use, is thier way to put in a simple line, for a specfic turret? or no luck.
Sign In or Register to comment.