Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How to use call compile format?

  1. #1

    How to use call compile format?

    I'm trying to wrap my head around creating dynamic objects using call compile format, more specifically I'm trying to create my ied setup in a small town.
    in triggerStatements i have
    for [{i=0},{i=i<3},{i=i+1}] do {iedPos = [getMarkerPos "TC1",random 250,random 360] call BIS_fnc_relPos;iedBPos = getPos(nearestBuilding iedPos);call compile format ["ied%1 = 'BAF_IED_V1' createVehicle iedBPos"];iedList = nearestObjects [getMarkerPos "TC1",["LAND_IED_V1_PMC"],1000];player sideChat format ["%1",count iedList]};
    the debug returns 0, so how can I create three ied's w/o having to do ied1-ied3 in a trigger?

  2. #2
    The syntax for format seems messed up. Try and put that on separate lines to see it better. Any reason you don't use the same calssname for what you dreate and what youtry to find?

  3. #3
    First Lieutenant galzohar's Avatar
    Join Date
    Jun 3 2009
    Ramat Hasharon, Israel
    Try not to use call compile format as there is almost always a better way to get things done. For example:

    iedList = [];
    for [{_i=0}, {_i < 3}, {_i = _i + 1}] do
    	_iedPos = [getMarkerPos "TC1",250 * (sqrt (random 1)),random 360];
    	// This will give area to have equal chance for IED.
    	// Your randomization makes it so areas around the center are much more likely to have an IED.
    	_iedBPos = getPos (nearestBuilding _iedPos);
    	_ied = createVehicle ["BAF_IED_V1", _iedBPos, [], 0, "NONE"];
    	iedList set [_i, _ied]; // Create array with IEDs we have created
    // Now if you already placed some PMC IEDs and want to make a list of them as well...
    iedListPMC = nearestObjects [getMarkerPos "TC1", ["LAND_IED_V1_PMC"],1000];
    You don't mess with the Zohar!
    YouTube channel:
    ArmA Israel:
    Check out and support upcoming Ground Branch:

  4. #4
    Example syntax:
    PHP Code:
    for "_i" from 1 to 3 do
    call compile format ["ied%1 = 'BAF_IED_V1' createVehicle iedBPos"_i];

  5. #5
    @BlackMamb - As far as I can tell the actual class name is "LAND_IED_V1_PMC" when I use the empty IED's in the editor and use typeOf it returns that.
    @Galv - I like that snippet, but I'm trying not to have to create a seperate script for it, although I might have to anyways because I'm using the createTrigger from CBA to script the explosions
    @Ceeeb - Thats exactly what I was looking for thank you.

  6. #6
    ok so another question.... how then would I create a trigger on each of those ied's in a script?

  7. #7
    First Lieutenant galzohar's Avatar
    Join Date
    Jun 3 2009
    Ramat Hasharon, Israel

    After creating, use the "See Also" section for how to set the trigger's parameters.

    Keep in mind the trigger is only created on the machine that runs the command and its condition is only checked on said machine, unlike triggers placed in the editor. This can actually make certain things easier, though, as for example in the case of an IED only the server needs to decide if/when to detonate it.

  8. #8
    I know how to create a generic trigger in a script the question was more about how to I create a trigger for each of the ied's created in the original for-from loop? i.e. what variable name do I use to represent each ied?

    ---------- Post added at 13:50 ---------- Previous post was at 13:42 ----------

    The concept of this script is multi-layered, and I'm playing around with different idea's, but at the moment I'm trying to figure out how to:
    Create dynamic IED's(I've tried reezo's module and it doesn't function 100% of the time, sometimes it doesn't work it all)
    Create a trigger on those IED's(west present only activation)
    Spawn a group at the nearest building of the ied location and have them ambush.
    More to come... as I add more idea's.

    Only wish I was a well versed scripter

  9. #9
    I've never had to use call compile format to be honest. There are many other solutions.

    PHP Code:
    for "_i" from 0 to 2 do 
    _iedpos = [getMarkerPos "TC1",250 * (sqrt (random 1)),random 360call BIS_fnc_relPos;
    _ied createVehicle ["LAND_IED_V1_PMC",_iedpos, [], 0"NONE"] ;
    _trig = ([getPosATL _ied"AREA:", [550false], "ACT:", ["WEST""PRESENT"true],"STATE:",["this","deleteVehicle (thisTrigger getVariable ['ied',objNull]); createVehicle ['Sh_125_HE',getPosATL thisTrigger, [], 0, 'NONE']",""]] call CBA_fnc_createTriggerselect 0;
    _trig setVariable ["ied",_ied];
    _mrk createMarker[format ["ied_%1",random 1000],_iedpos];
    _mrk setMarkerShape "ICON";
    _mrk setMarkerType "DOT";
    You're going to have to work on the nearestBuilding since it requires an object but that's a start.
    Last edited by cuel; Feb 6 2013 at 14:12.

  10. #10
    thank you so much, going to give it a test and see what happens

Page 1 of 2 12 LastLast

Similar Threads

  1. Trigger with call compile format
    By fencr0c in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 2
    Last Post: Mar 15 2011, 14:18
  2. call compile
    By nikita320106 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Aug 3 2009, 10:28
  3. call compile createmarker
    By code34 in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Jan 15 2009, 05:51
  4. Call compile format syntax error...
    By nullsystems in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Nov 17 2007, 15:43
  5. call compile doesn't work!
    Replies: 31
    Last Post: Jul 18 2007, 22:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts