Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
rcmw

DoTarget stops working

Recommended Posts

I'm making a script to populate a firing range with men shooting at targets. They change stance and firing mode and engage 3 targets on a range. It was all working fine until I hit a strange problem, after about 3-4 shots the dotarget command stops working.

The men just sway there weapons back and forwards shooting in random directions. I have tried dotarget on the men after this happens but they don't respond. So its working fine for about 10 seconds/3 repetitions of the script, then stops working... Anyone got any ideas what’s wrong?

trainingGO = true;
while {trainingGO} do {

shooter doTarget objNull;

sleep 2;
sleep (floor(random 2));

randomtarget1 = floor(random 3);

if (randomtarget1 == 0) then{
shooter doTarget target1_1;
};

if (randomtarget1 == 1) then{
shooter doTarget target1_2;
};

if (randomtarget1 == 2) then{
shooter doTarget target1_3;
};


randomnumber1 = floor(random 5);

if (randomnumber1 == 0) then{
shooter setunitpos "up";};

if (randomnumber1 == 1) then{
shooter setunitpos "middle";};

if (randomnumber1 == 2) then{
shooter setunitpos "middle";};

if (randomnumber1 == 3) then{
shooter setunitpos "down";};

if (randomnumber1 == 4) then{
shooter setunitpos "down";};

sleep 2;
sleep (floor(random 6));

random1 = floor(random 2);

if (random1 == 0) then{

range action ["useWeapon", shooter, shooter, 1];
};

if (random1 == 1) then{

range action ["useWeapon", shooter, shooter, 2];
};
};

Edited by RCMW

Share this post


Link to post
Share on other sites

It was the same in A2/OA, you can only use it a few times before they start to stray.

Even if you use dotrarget just once and move the target around after a while they seem to give up on the target and just aim in the general direction.

It's as if after a time they start to sweep the area for the enemy, so it doesn't get stuck firing on an exact position.

I never did find a solution for this.

Share this post


Link to post
Share on other sites

Dam, I have tried to turn of some of the AI but I makes little difference. I'll keep looking and post if I find a solution of any kind.

Share this post


Link to post
Share on other sites


If anyone does have an answer for this please post.

An easy way to see it is this, just have a pop up target and name it targ

and then in the shooters init put this dotarget targ;

run the script after a while (100 secs) the unit will start to scan the area wait further (230 secs) and he starts chasing his tail.

There seems to be no way of resetting his brain.




I have found one thing that seems to help, have him join grpnull and place it before the shooter dotarget objnull

sleep 1;
[shooter] join grpnull;
shooter doTarget objNull;

There are still issues with the script such as shooting into the ground but I suspect it's a timing issue.

He also lowers his weapon when issued the join command, the join command only needs to be run about every 90 seconds or better still it could be done when the magazine is empty.

I don't have time to test further today.

Edited by F2k Sel

Share this post


Link to post
Share on other sites
Sign in to follow this  

×