No announcement yet.

Common Scripting Tasks

  • Filter
  • Time
  • Show
Clear All
new posts

  • [GUIDE] Common Scripting Tasks

    Some common scripting tasks that get used a lot.

    Naming a Group – In the group leader’s init field put the following. You can then refer to the group as groupName in other places like scripts and triggers.
    groupName = group this;

    Starting in a vehicle – To start in a vehicle you can set each member of a group which includes a vehicle to In Cargo under the Special box in the editor, or place the following code in the Group Leader’s init field.
    {_x moveInCargo vehicleName} forEach units group this;

    Deleting a vehicle – To properly delete a vehicle, you need to remove the crew first, like this.
    {deleteVehicle _x} forEach crew vehicleName + [vehicleName];

    Stopping the “Hi” option – To stop players from being able to click on each other and say “Hi” constantly, use this code in your init.sqf to stop core conversations.
    player setVariable ["BIS_noCoreConversations", true];

    Static Airborne Jump at Start - Uses the in built code.
    [this] exec "ca\air2\halo\data\Scripts\HALO.sqs";

    Manual Airborne jump at start - You don't trust the game do ya?
    [this] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";

    To attach stuff to something - what it says.
    this attachTo (name of vehicle, [x, x, x] <--Z component)

    To make things invisible - Any thing is possible.
    deleteCollection this

    To place objects, AIs on certain heights - X denotes the height both - and +.
    this setPos [ getPos this select 0, getPos this select 1, (getPos this select 2) +X];

    OMG! Company full of Medics/Corpman! - To make any players be a Medic
    this setVariable ["ace_w_ismedic", true];

    Global hint message (Requires CBA)
    [-1, {hint "Insert message here"}] call CBA_fnc_globalExecute;

    Kill Trigger method # 1 - the yellow number is what matters, make him punch the atmosphere skys not the limit.
    {_x setVelocity [0,0,200]; hint format['Opps, %1 went out of bounds',name _x];} forEach thislist;
    To clear contents of ammo boxes - also used with vehicles.
    clearMagazineCargo this; clearWeaponCargo this;

    To force trucks lights off - (place it into the init section of truck)
    this setHit ["L svetlo", 1]; this setHit ["P svetlo", 1];

    Take out tail rotor of helicopter - You know you want to try it once.
    NameOfHelicopter setHit ["mala vrtule", 1];

    Turn the lights off in the towns/cities - Save electricity.
    Place a GameLogic in the middle of the lucky city, add this to the init:
    {_x switchLight "OFF"} forEach ((getPos this) nearObjects ["StreetLamp",200]);
    Yellow number denotes radius of the black out.

    Place stuff into ACE backpack - you know you are a closet pack mule.
    ilikestuff = [this, "30RND_556X45_STANAG", 10] call ACE_fnc_PackMagazine;

    You want AIs with unlimited Strela missiles? - YES! a challenge! ...nuts
    Place it into the AIs Init box.
    this addeventhandler ["Fired",{if (_this select 1=="Strela") then {_this select 0 addMagazine (_this select 5)}}]

    Spawn what you want - Energise!
    _vec_array = [markerPos "some_marker", random 360, "A10", west] call BIS_fnc_spawnVehicle;

    TGU Instructor · Irregulars · TG Pathfinder

    Former TGU Dean · Former ARMA Admin · Former Irregulars Officer
    "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold



TeamSpeak 3 Server




Twitter Feed