OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Evan Scown on 17 Jun 2006, 21:27:14
-
Hello again,
How would I get an enemy squad to spawn like 100 meters behind my players squad as I'm running around? Would be in a trigger of course.
-
What you need.
A player called me1.
An enemy group called SpetzGrp1 (I used Spetz Naz)
The leader of the Spetz Naz group should be called Spet1
Obviously that's just so you can test the script. Change it according to your wishs.
#Start
{_x setPos [(GetPos Player Select 0) - 250*Sin(GetDir Player),(GetPos Player Select 1) - 250*Cos(GetDir Player),0]} ForEach Units SpetzGrp1
Goto "Approach"
#Approach
? Not (alive Spet1) : Goto "End"
spet1 setbehaviour "combat"
SpetzGrp1 Move GetPos Me1
? me1 distance Spet1 <=25 : goto "End"
~20
GoTo "Approach"
#End
Exit
-
Can I replace Me1 with something like a group leader?
-
you can get actual group leader the player is in with
_groupleader = leader player
this wont work if you make a MP map since "player" is local on client machines and therefore different on each client.
When i think about it, as long all playable units belong to the same group, this should work.
so just modifiy architects script in this way:
#Start
_grpleader = leader player
{_x setPos [(GetPos _grpleader Select 0) - 250*Sin(GetDir _grpleader),(GetPos _grpleader Select 1) - 250*Cos(GetDir _grpleader),0]} ForEach Units SpetzGrp1
Goto "Approach"
#Approach
? Not (alive Spet1) : Goto "End"
spet1 setbehaviour "combat"
SpetzGrp1 Move GetPos _grpleader
? _grpleader distance Spet1 <=25 : goto "End"
~20
GoTo "Approach"
#End
Exit
@The-Architect
please check if i did it right, will ya?
-
I'm no good with the global stuff m8 you check it. :(
-
Sweet as bro,
I'll give it a go mate.