Jump to content
JohnKalo

Super Simple Script Malfunctioning

Recommended Posts

So as part of a mission I am working on I need a guy to:

 

1.] Target a specific location with his static weapon,

2.] wait 5 seconds,

3.] target another specific location,

4.] wait 5 seconds,

5.] repeat the process.

 

So by using a script that cannot be more simple as far as I am aware I wrote:

while {alive spot0} do

{

spot0 doTarget target0;
sleep 5;
spot0 doTarget target1;
sleep 5;

};

 

So the first time the script runs spot0 unit does indeed wait but from then on he constantly moves the turret left and right targeting the target0 and target1 objects without waiting!

Why please?

 

And if the above issue is solved I would like, if possible, unit spot0 to target a random selection of targets at his first move and a random selection of other targets at his second move.

I know that it can be randomized further but Arma issues have forced me to designate specific target locations.

Oh and if I could make him move his turret at a slower pace that would also be awesome. 

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Try spot0 doWatch objNull before issuing each new target

 

18 minutes ago, JohnKalo said:

 


while {alive spot0} do

{
spot0 doWatch objNull;
spot0 doTarget target0;
sleep 5;
spot0 doWatch objNull;
spot0 doTarget target1;
sleep 5;

};

 

 

https://community.bistudio.com/wiki/doTarget

 

To select randomly from an array of targets:

https://community.bistudio.com/wiki/selectRandom

  • Like 4

Share this post


Link to post
Share on other sites
Quote

Try spot0 doWatch objNull before issuing each new target

 

Thanks but it did not work. I found however something that did. The below code works:

while {alive spot0} do 

{ 
spot0 doWatch target0; 
spot0 doTarget target0; 
waitUntil {runner0 distance mark0 <5};
spot0 doWatch target1; 
spot0 doTarget target1; 
waitUntil {runner0 distance mark1 <5};
};

 

Yeah runner0 is indeed a civilian running constantly from the mark0 object to the other mark1 object!

For some reason sleep does not work when in a loop in our case.

 

About making the selection random the wiki has sadly not got detailed examples so I will try finding and seeing how other scripts work.

  • Like 1

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

×