Jump to content
Sign in to follow this  
behoram

need help with this unit respawn script

Recommended Posts

hi  !!

i'm trying to use thi old script

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;  AI Respawn Script by angusjm

;  5th March 2004

;

;  Call this script using the following syntax:

;

;  [1,unit to converge around,array of groups,units per group,type of unit,skill of units,radius around unit to converge around,body disapear on or off (1 on, 0 off)]

;

;  The AI will be created of a random one of the type specified and will head towards the unit to converge around

;

;Example [1,player,[east1,east2],12,["SoldierEB","SoldierEMG"],0.1,50,1] exec "ajmrespawn.sqs"

_wtd = _this select 0

_aUnit = _this select 1

? _wtd == 0: goto "missemall"

_agroups = _this select 2

_apg = _this select 3

_askill = _this select 5

_aradius = _this select 6

_thon = _this select 7

_list=_this select 4;

_ntotal=count _list;

_c = 0

#loop

#gloop

_rg = count units (_agroups select _c)

? _rg >= _apg : goto "misscreate"

_rg = _apg - _rg

#iloop

_rnum = random ((360))

_num = _rnum - (_rnum mod 1)

_d1 = getpos _aunit select 0

_d2 = getpos _aunit select 1

_d3 = 0

_random=random(_ntotal);

_result=_random - ((_random) mod (1));

if (_result==_ntotal) then {_result=_result-1};

_utype = (_list select _result);

_d1 = _d1 + _aradius * sin(_rnum)

_d2 = _d2 + _aradius * cos(_rnum)

_utype createunit [[_d1,_d2,_d3],_agroups select _c,"",_askill,"PRIVATE"]

       ? _thon == 1 : {_x addeventhandler [{killed},{[0,_this] exec {AJMRespawn.sqs}}]} foreach units (_agroups select _c)

_agroups select _c move getpos _aunit

leader (_agroups select _c) move getpos _aunit

_rg = _rg - 1

? _rg == 0 : goto "misscreate"

goto "iloop"

#misscreate

_c = _c + 1

? _c == count _agroups : _c = 0; goto "eloop"

goto "gloop"

#eloop

~0.5

goto "loop"

#missemall

~30

deletevehicle (_aunit select 0)

#alll

exit

when i run this script i got this message:

Quote[/b] ]

? _thon == 1 : {_x addeventhandler [{killed},{[0,_this] exec {AJMRespawn.sqs}}]} foreach units (_agroups select _c)

error ; missing

i have tried to add the ; at the line end, but i still got error

any suggestion ??

Thanks

Wallace

p.s.

i also need to know if there is a way to stop the script

p.p.s.

any good ai respawn script to suggest ?

Share this post


Link to post
Share on other sites

TBH: you're using SQS script... I can't speak for everyone, but I believe the majority of the community uses SQF, which is WAY more readable and easier to debug. That may be why you haven't gotten a response yet.

Share this post


Link to post
Share on other sites

ArmA uses a different syntax than OFP to represent certain CODE/STRING types.

In OFP you were able to use braces ( '{' or '}' ) for certain strings, but now you must use single or double quotes. Braces are now generally used to represent code or functions.

Try something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _thon == 1 : {_x addeventhandler ["killed","[0,_this] exec 'AJMRespawn.sqs' "]} foreach units (_agroups select _c)

Share this post


Link to post
Share on other sites

Thank You to all !

Especially to Dr_Eyeball notworthy.gif

now it's working perfectly and very smoothie !! yay.gif

tnx again

Behoram  yay.gif

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  

×