Home   Help Search Login Register  

Author Topic: A script performed by multiple units  (Read 904 times)

0 Members and 1 Guest are viewing this topic.

A script performed by multiple units
« on: 26 Jun 2006, 13:40:15 »
Hello everyone, I have got this script:

_x dofire player
#update
_x = getpos player
~5
? not alive _x : goto "exit"
~1
goto "update"
exit

Can you suggest me, please, the way of the performing of this script by a lot of single named units?
I have tried this command:

{_x exec "script.sqs"} forEach [unit1, unit2, unit3, unit4 etc.]

but it didn't worked... Any help would be appreciated. Thanks.

Guido
? (this == thinkable) : this = scriptable

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: A script performed by multiple units
« Reply #1 on: 26 Jun 2006, 14:44:48 »
the command itself is fine. the script is not.

call the script for multiple named units as you described, i.e.

Code: [Select]
{_x exec "script.sqs"} forEach [unit1, unit2, unit3, unit4]
the script should begin by determining who the unit is. read general barron's tutorial "all about 'this'", found here.

assuming the script is meant to direct the named units to the player's position:

Code: [Select]
_unit = _this
_unit dofire player

#update
_pos = getpos player
_unit domove _pos
~5

? not (alive _unit) : exit
~1
goto "update"

exit

Re: A script performed by multiple units
« Reply #2 on: 26 Jun 2006, 15:44:05 »
THAAAAAAAAAAAAAAAAANKS IT WOOOOOOOOOOOOOOORK. YOURE MY GOOOOOOOOOOOOOD!  ;D
(It has been a long time that I was looking for the solution)

Guido
? (this == thinkable) : this = scriptable