Results 1 to 4 of 4

Thread: Passing variables within a script and it's scripted waypoints

  1. #1

    Passing variables within a script and it's scripted waypoints

    48 hours later... no sleep.... still working on this....

    I have a script that does this...

    Code:
    _plane setVariable ["onTarget",false,true];
    
    _wp1 = _newGroup addWaypoint [_planepos,0];
    [_newGroup, 1] setWaypointType "MOVE";
    [_newGroup, 1] setWaypointSpeed "FULL";
    [_newGroup, 1] setWaypointBehaviour "CARELESS";
    
    _wp2 = _newGroup addWaypoint [_targetpos,0];
    [_newGroup, 2] setWaypointType "MOVE";
    [_newGroup, 2] setWaypointSpeed "FULL";
    [_newGroup, 2] setWaypointBehaviour "CARELESS";
    [_newGroup, 2] setWaypointStatements ["true", "(vehicle this) setVariable [""onTarget"",true,true];hint ""Waypoint Reached"""];
    
    _wp3 = _newGroup addWaypoint [_planepos,0];
    [_newGroup, 3] setWaypointType "MOVE";
    [_newGroup, 3] setWaypointSpeed "FULL";
    [_newGroup, 3] setWaypointBehaviour "CARELESS";
    [_newGroup, 3] setWaypointStatements ["true", "{deletevehicle _x} foreach crew (vehicle this);deleteVehicle (vehicle this);deleteVehicle this"];
    
    waitUntil {sleep 1; (_plane getVariable ["onTarget", true])};
    
    _bomb1 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)-100,(getMarkerPos "mk_mandoairsupport" select 1)-100,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 2;
    _bomb2 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)+100,(getMarkerPos "mk_mandoairsupport" select 1)-100,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 1;
    _bomb3 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)-100,(getMarkerPos "mk_mandoairsupport" select 1)+100,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 3;
    _bomb4 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)+100,(getMarkerPos "mk_mandoairsupport" select 1)+100,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 2;
    _bomb5 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0),(getMarkerPos "mk_mandoairsupport" select 1),(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 1;
    _bomb6 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0),(getMarkerPos "mk_mandoairsupport" select 1)+50,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 3;
    _bomb7 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0),(getMarkerPos "mk_mandoairsupport" select 1)-50,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 2;
    _bomb8 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)-100,(getMarkerPos "mk_mandoairsupport" select 1),(getMarkerPos "mk_mandoairsupport" select 2)+5];
    sleep 1;
    _bomb9 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)+100,(getMarkerPos "mk_mandoairsupport" select 1),(getMarkerPos "mk_mandoairsupport" select 2)+5];
    The bombs don't drop, it seems so simple.

    I set the variable "onTarget" to false in the beginning....

    I set the same variable to true in the waypoint...

    Then, I check to see if the variable is true, if it is, then drop bombs.

    Why is ArmA2 not cooperating with me?

    Sorry, I have been up for a long time.

    Please help,

    -AD

    P.S.

    I left out the part of the script where "_plane" is created, please don't be distracted by that, it gets created and flies to it's waypoints, trust me, that is not the problem.

    The bit that I posted is where the problem exists.

  2. #2
    Moderator [FRL]Myke's Avatar
    Join Date
    May 27 2007
    Location
    Yay, Rank 34 of 47119 and catching up.
    Posts
    5,706
    48 hours later... no sleep.... still working on this....


    I highly recommend to get some sleep, this doesn't belong to Addons - Config & Scripts, more likely to mission editing.


    -moving-

  3. #3
    As it works for me I have to think you have the wrong marker name.

  4. #4
    Staff Sergeant
    Join Date
    Sep 29 2008
    Location
    NM, USA
    Posts
    308
    Author of the Thread
    Thanks for your replies guys..

    It seems as though I was looking in the wrong place for the problem here, I was passing variables just fine it seems.

    The problem exists in the positioning for the bomb spawn positions...

    Code:
    _bomb1 = "Bo_Mk82"  createVehicle [(getMarkerPos "mk_mandoairsupport" select 0)-100,(getMarkerPos "mk_mandoairsupport" select 1)-100,(getMarkerPos "mk_mandoairsupport" select 2)+5];
    You see, I was using Mando's CAS console to run this script through, that Marker only exists when the console is open...

    If I call the strike... then exit the console.. the script does not know where that marker is, so no bombs.

    The variable "_targetpos" however is being sent to this script from outside "_this select 1;"

    So, I just had to change to this...

    Code:
    _bomb1 = "Bo_Mk82"  createVehicle [(_targetpos select 0)-100,(_targetpos select 1)-100,(_targetpos select 2)+5];
    By setting it up that way, I can have the console open or closed and the script is still able to find "_targetpos".

    So.. thanks

    -AD

    P.S.

    My reasoning for posting in "configs and scripting" and not "mission editing and scripting" was because most scripts that I write, I execute them from within the config of a unit via an EH.

    This saves me from having to edit thousands of missions in order to have this ability in every mission.

    Gets me into trouble sometimes when posting.

Similar Threads

  1. Passing variables from intro to mission?
    By OMAC in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 2
    Last Post: Apr 1 2012, 21:18
  2. Passing variables through triggers
    By Bunny75 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Sep 22 2009, 16:26
  3. Passing variables to a Script
    By Ruckus in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 3
    Last Post: Dec 31 2006, 04:08
  4. Passing Variables By Reference
    By ColonelSandersLite in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 5
    Last Post: Nov 28 2006, 18:45
  5. Passing variables to debriefing
    By hoz in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 1
    Last Post: Feb 23 2003, 00:03

Posting Permissions

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