Jump to content
Sign in to follow this  
Vixente

reusing BIS_fnc_UnitPlay problem

Recommended Posts

I've been playing with BIS_fnc_UnitCapture and BIS_fnc_UnitPlay. All was working fine, until i wanted to reuse/replay the path again without restarting the mission. In the second run the vehicles start flickering like if they where following two paths simultaneously. At least that is what i think based upong what i see, because you can see the same helicopter being teleported back and forth.

Take a look at this video:

FPOJ85VMrmQ

Is there a way to stop UnitPlay from doing its job ?

I tried to restart everything, even destroying the variables that contain the path, but it didn't work. It kept 'accumulating'.

What i've tried:

path1=nil;
path2=nil;
path3=nil;

heli1 setPos [1849.212,5.5,5740.4668];
heli1 setVelocity [0,0,0];
heli1 setDir 90;
sleep 0.1;
heli2 setPos [1821.5199,5.5,5742.1831];
heli2 setVelocity [0,0,0];
heli2 setDir 90;
sleep 0.1;
heli3 setPos [1794.5629,5.5,5740.7124];
heli3 setVelocity [0,0,0];
heli3 setDir 90;
sleep 1;

---------- Post added at 10:43 AM ---------- Previous post was at 09:42 AM ----------

EDIT:

Well, i managed to fix it myself. :bounce3:

I just gave variables to the script spawns...

script1 = [heli1,path1] spawn BIS_fnc_UnitPlay;
sleep 0.5;
script2 = [heli2,path2] spawn BIS_fnc_UnitPlay;
sleep 0.5;
script3 = [heli3,path3] spawn BIS_fnc_UnitPlay;
sleep 0.5;

... so i could terminate them before spawning them again:

heli1 setPos [1849.212,5.5,5740.4668];
heli1 setVelocity [0,0,0];
heli1 setDir 90;

heli2 setPos [1821.5199,5.5,5742.1831];
heli2 setVelocity [0,0,0];
heli2 setDir 90;

heli3 setPos [1794.5629,5.5,5740.7124];
heli3 setVelocity [0,0,0];
heli3 setDir 90;

terminate script1;
terminate script2;
terminate script3;

And everything is working fine and dandy. :)

spawn calls the script in parallel while call seems to do it sequentially (i think). But to avoid the problem i was having i just had to terminate the BIS_fnc_UnitPlay script spawn just before doing it again. ;)

46R_nQsa5XU

+1000 XP points gained.

Edited by Vixente

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  

×