Jump to content
Sign in to follow this  
ADuke

Passing variables within a script and it's scripted waypoints

Recommended Posts

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

I have a script that does this...

_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.

Share this post


Link to post
Share on other sites
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-

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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...

_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...

_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.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×