OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Doktor Headshot on 26 Jun 2006, 13:40:15

Title: A script performed by multiple units
Post by: Doktor Headshot 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
Title: Re: A script performed by multiple units
Post by: bedges 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 (http://www.ofpec.com/ed_depot/tutes.htm).

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
Title: Re: A script performed by multiple units
Post by: Doktor Headshot 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