Jump to content
Sign in to follow this  
D.murphy man

Need help with scipt

Recommended Posts

Right i have this script made by [sWCC]Tychon[CDT] one of my contacts on my buddy list on Game Spy.</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_zombie = _this select 0

removeAllWeapons _zombie

_zombie addWeapon "StrokeFist"

#main

_target = nearestObject [_zombie, "SoldierWCrew"]

? _zombie distance _target <= 1 : _zombie addMagazine "StrokeFist"; goto "attack"

? _zombie distance _target > 1 && _zombie distance _target <= 5 : goto "engage"

? _zombie distance _target > 5 : _zombie doMove getPos _target

~1

goto "main"

#engage

_nX = getPos _target select 0

_nY = getPos _target select 1

_zombie setPos [_nX, _nY]

goto "main"

#attack

_zombie fire "StrokeFist"

_x = random 2

? _x <= 1 : _target setDammage (getDammage _target + 0.1)

~1

_zombie removeMagazines "StrokeFist"

goto "main"<span id='postcolor'>

this all works fine and dandy intill i put more then one soldier crew on the map then my "zombies" seem to get confused.Ill try and explain what happens.

In my mission i have 6 crewmen all over the island in seprate places,and a group of 5 "zombies" next to all of them but all the "zombies" seem to go for one crewmen at a time in order, where i want them all to go for the nearest crewman.Iv tryed lots of differnt thing to try and solve this bye my self and i havent been able to talk to tychon since christmas so can any one shed some light on the solution?

Thnx *D.murphy man*

Share this post


Link to post
Share on other sites

May be there is some problem with several running scripts. Try to use my modification :

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

_zombies = _this select 0

_i=count _zombies

{removeAllWeapons _x;_x addWeapon "StrokeFist"} forEach _zombies

#main

~0.25

_i=_i-1

_zombie=_zombies select _i

_target = nearestObject [_zombie, "SoldierWCrew"]

? _zombie distance _target <= 1 : _zombie addMagazine "StrokeFist"; goto "attack"

? _zombie distance _target > 1 && _zombie distance _target <= 5 : goto "engage"

? _zombie distance _target > 5 : _zombie move getPos _target

#back

?_i==0:_i=count _zombies

goto "main"

#engage

_nX = getPos _target select 0

_nY = getPos _target select 1

_zombie setPos [_nX, _nY]

goto "back"

#attack

_zombie fire "StrokeFist"

_x = random 2

? _x <= 1 : _target setDammage (getDammage _target + 0.1)

~1

_zombie removeMagazines "StrokeFist"

goto "back"

<span id='postcolor'>

execute it only once with parameter [array of zombies]

example :

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

[[zmb1,zmb2,zmb3,zmb4]] execute "zombie.sqs"

<span id='postcolor'>

Share this post


Link to post
Share on other sites

well a tryed it and it dident work confused.gif i put </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[[zmb1,zmb2,zmb3,zmb4]] execute "zombie.sqs"

<span id='postcolor'> in to a init line of a player and it said it was wrong or summing and wouldent let me put it in.So i made a seprate .sqs file with jus that in and called it ex then put [this] exec "ex.sqs" and it said summing about there not being and zombie.sqs even thou there was one.So i put in the init line of the player [this] exec "zombie.sqs" and then it in game it said "0 elements provided,3 expected" and summing a bout _target = nearestObject [_zombie, "SoldierWCrew"] bit.

Share this post


Link to post
Share on other sites

Another (tested) version :

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

_zombies = _this

_i=count _zombies

{removeAllWeapons _x;_x addWeapon "StrokeFist"} forEach _zombies

#main

~0.25

_i=_i-1

_zombie=_zombies select _i

_target = nearestObject [_zombie, "SoldierWCrew"]

? _zombie distance _target <= 1 : _zombie addMagazine "StrokeFist"; goto "attack"

? _zombie distance _target > 1 && _zombie distance _target <= 5 : goto "engage"

? _zombie distance _target > 5 : _zombie move (getPos _target)

#back

?_i==0:_i=count _zombies

goto "main"

#engage

_zombie dotarget _target

_nX = getPos _target select 0

_nY = getPos _target select 1

_zombie setPos [_nX, _nY]

goto "back"

#attack

_zombie fire "StrokeFist"

_x = random 2

? _x <= 1 : _target setDammage (getDammage _target + 0.1)

~1

_zombie removeMagazines "StrokeFist"

goto "back"

<span id='postcolor'>

call it, from init of player with parameter array of zombies

example :

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

[zmb1,zmb2,zmb3,zmb4] execute "zombie.sqs"

<span id='postcolor'>

where zmb1, zmb2 ... are names of zombie units

Share this post


Link to post
Share on other sites

oh for the love of!

i got it to run the mission this time by using

[this] exec "zombie.sqs"

then, [zmb] exec "zombie.sqs"

and i keep getting my guy saying an order saying go to aa00 repeatidly! (from zombie as player)

as for the other guy thats suppose 2 get attacked, if u go him the zombie to be dosent do anything!

Share this post


Link to post
Share on other sites

I tested it again and it works for me.

Go to bartovo.webpark.cz

and download zombie.intro.zip

It's my working example. Zombie script is activated by Alpha-radio code.

Ah, now I can see you managed to run it, but I can not understand your problem.

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  

×