Jump to content
Sign in to follow this  
_qor

Make script indepentend from caller

Recommended Posts

Hey,

I have a script which calls another one at the end.

This new called script should work for each unit/group which calls it in another, defined way.

I know this has to do with arrays, select an index and some variables but need some help because this is the first time I really use it to make a script independent.

For the overview (see script at the end):

There are 3 groups which should get in heli or move to a GUARD waypoint according to the the variable "attackSB".

For each group there is one heli and one GUARD waypoint.

For the first time it would help if you can tell me how I can refer to the caller of the script.

Perhaps this will do it at all.

addAction scripts have this to refer:

_talker = _this select 0;
_bother = _this select 1;
_action = _this select 2;

Does this even work for scripts which has not been called by addAction?

Or do I have to create one script for each execution?

talker = caller (object/unit)

bother = player, the one who initialized the call

action = addAction action

if (!attackSB) then

{

wp3a = NBgrp1 addWaypoint [getPos NBch1, 3];

wp3a setWaypointType "GETIN";

wp3a waypointAttachVehicle NBch1;

}

else

{

wp3a = NBgrp1 addWaypoint [getMarkerPos "supdef1a", 10];

wp3a setWaypointType "GUARD";

wp3a setWaypointBehaviour "YELLOW";

wp3a setWaypointBehaviour "AWARE";

wp3a setWaypointFormation "VEE";

waitUntil {!attackSB};

wp4a = NBgrp1 addWaypoint [getPos NBch1, 3];

wp4a setWaypointType "GETIN";

wp4a waypointAttachVehicle NBch1;

};

Edited by _qoR

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  

×