Results 1 to 3 of 3

Thread: Flare Script

Hybrid View

  1. #1
    Ok guys I need help with a mission I am working on. ***At several locations I have triggers set up when Blufor walks into the area a flare will pop up. ***I am VERY new to scripting so I am afraid I need it spelled out for me on how to do it. ***I searched the internet and found a Flare Trap scrip that was used with OFP, but I am unable to get it to work in ArmA. ***I have the flaretrap.sqs in my mission folder and have the correct line inserted into the on activation line of the trigger...but everytime I enter the area nothing happens. ***Any help would be greatly appreciated. ***I am posting below the script I found on the net.

    ; ************************************************** ********************
    ; **** Shoots a flare up when a trigger is activated.
    ; ****
    ; **** 2 parameters needed:
    ; **** 1. Trigger trap is attached to. (Object)
    ; **** 2. Color of flare. ("WHITE", "RED", "GREEN", "YELLOW") (String)
    ; ****
    ; **** Example how to use:
    ; **** TRIGGER:
    ; **** Radius: 50
    ; **** Activation: EAST + PRESENT + REPEATEDLY
    ; **** On Activation: [this, "GREEN"] Exec "FlareTrap.sqs"
    ; ****
    ; **** By
    ; ************************************************** ********************

    ; Get the parameters given
    _trigger = _this Select 0
    _color = _this Select 1

    ; Get the position of the trigger
    _posTrigger = GetPos _trigger

    ; Create the position for the flare to drop (Z + 150 m)
    _x = _posTrigger Select 0
    _y = _posTrigger Select 1
    _z = (_posTrigger Select 2) + 150
    _posFlare = [_x, _y, _z]

    ; Create the flare
    ?(_color == "WHITE"): _color = ""
    _type = "Flare" + _color
    _flare = _type CamCreate _posFlare
    CamDestroy _flare

    Exit
    Wars begin where you will, but they do not end where you please -Machiavelli

    Artificial intelligence is no match for natural stupidity


  2. #2
    Sergeant Major SNKMAN's Avatar
    Join Date
    Aug 29 2006
    Location
    Germany ( Lake Constance )
    Posts
    1,616
    Well i just rewrote some parts of the script and now its working.

    Note: camCreate didn't work in ArmA any longer.

    Put in the Triggers On Activated field:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    x = &#91;thisList,&#34;F_40mm_White&#34;&#93; execVM &#34;Flare_Trap.sqf&#34;
    [/QUOTE]

    Here you also can change the color of the Flare.

    EXAMPLE:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    For White Flares&#58;
    x = &#91;thisList,&#34;F_40mm_White&#34;&#93; execVM &#34;Flare_Trap.sqf&#34;

    For Yellow Flares&#58;
    x = &#91;thisList,&#34;F_40mm_Yellow&#34;&#93; execVM &#34;Flare_Trap.sqf&#34;

    For Red Flares&#58;
    x = &#91;thisList,&#34;F_40mm_Red&#34;&#93; execVM &#34;Flare_Trap.sqf&#34;
    [/QUOTE]

    Flare_Trap.sqf
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    private &#91;&#34;_trigger&#34;,&#34;_flare&#34;,&#34;_pos Trigger&#34;,&#34;_x&#34;,&#34;_y&#34;&#93;;

    // Get the parameters given
    _trigger = _this select 0;
    _flare = _this select 1;

    // /////////// DEBUG ///////////
    // hint format&#91;&#34;DEBUG Trigger Object&#58; %1&#34;,_trigger&#93;;
    // /////////////////////////////

    // Get the position of the trigger
    _posTrigger = getPos &#40;_trigger select 0&#41;;

    // Create the position for the flare to drop &#40;Z + 150 m&#41;
    _x = _posTrigger select 0;
    _y = _posTrigger select 1;
    _z = &#40;_posTrigger select 2&#41; + 150;
    _posFlare = &#91;_x, _y, _z&#93;;

    // Create the flare
    _type = _flare createVehicle _posFlare;
    [/QUOTE]

  3. #3
    @SNKMAN....Thank you so much. Now my mission can move forward. I appreciate you taking the time to help me.

Posting Permissions

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