Home   Help Search Login Register  

Author Topic: Enemy Spawn  (Read 1034 times)

0 Members and 1 Guest are viewing this topic.

Offline Evan Scown

  • Members
  • *
Enemy Spawn
« 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.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Enemy Spawn
« Reply #1 on: 17 Jun 2006, 22:09:51 »
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.

Code: [Select]
#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
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Evan Scown

  • Members
  • *
Re: Enemy Spawn
« Reply #2 on: 18 Jun 2006, 13:26:44 »
Can I replace Me1 with something like a group leader?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Enemy Spawn
« Reply #3 on: 18 Jun 2006, 14:23:03 »
you can get actual group leader the player is in with

Code: [Select]
_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:

Code: [Select]
#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?
« Last Edit: 18 Jun 2006, 14:24:44 by myke13021 »

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Enemy Spawn
« Reply #4 on: 18 Jun 2006, 14:25:32 »
I'm no good with the global stuff m8 you check it.  :(
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Evan Scown

  • Members
  • *
Re: Enemy Spawn
« Reply #5 on: 18 Jun 2006, 14:33:28 »
Sweet as bro,

I'll give it a go mate.