Jump to content
Sign in to follow this  
_qor

addAction with respawning vehicles

Recommended Posts

Hey,

 

the scenario first: a convoy which has to get stolen by the player which has to unload the convoy's content at base. Convoy gets respawned if dead and therefore two vehicles with actually the same name can exist.

 

 

Problem is, that when a vehicle with the same name as an existing vehicle gets spawned, the first vehicle (the "old" one) gets a new name.

So there is a trigger which fires when a convoy vehicle is inside. But it wont get fired by the old vehicle which has been renamed.

Actually I solved this problem (it just worked good without knowing exactly why), but while "improving" the script it seems to be a problem again.

 

So this how I set up the addAction:

FC2veh setVehicleInit "unloadFC2 = this addAction ['UNLOAD','convoys\Unload\FCunload.sqf','',1,true,true,'','((_target distance _this) <6) && (FC2veh getVariable ''GOODS'' == 1) && [FS_anar,_this] call bis_fnc_inTrigger']";
 
processInitCommands;

What I thought is, the local variables would alway return the correct vehicle. But when the new vehicle is spawned, the action disappears from the old vehicle and only appears back when the new one is inside trigger too. Does this mean that [FS_anar,_this] call bis_fnc_inTrigger always returns FC2veh?

 

Pls help, I got lost in script-glyphs ._.

 

 

EDIT

Got the point! Ofcourse the problem came up with introducing the a getVariable which is connected to the name.

Anyway, it would be great if there is a convenient way to work around this problem with respawn and unitnames!

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  

×