Jump to content

trigger off spawned units


JimEb58

Recommended Posts

This seems very basic, yet I can't seem to find the solution. I got spawn units running around and I want to trip triggers when they enter a zone. Problem is spawn units have automatically generated names like, Tank#001, Tank#002, etc so you can't do that from the ME. But I can't seem have to figure that out from scripting either. I thought I found the answer with

 

:InitKeepUnitNames(true)

 

The MOOSE documentation sounds like it's supposed to do exactly what I want it to do. Yet I spent hours experimenting with that and I'm not sure what it does or even if it works at this point.

 

Then I thought maybe since when you spawn something you assign it to a name like:

 

Attackers = SPAWN:New("Tanks") that I could just simply later reference that name like Attackers:IsCompletelyInZone(zone)

 

But apparently the MOOSE logic isn't intuitive to me and that doesn't work. So how can spawned units actually participate rather than merely being ambiance?

Link to comment
Share on other sites

This seems very basic, yet I can't seem to find the solution. I got spawn units running around and I want to trip triggers when they enter a zone. Problem is spawn units have automatically generated names like, Tank#001, Tank#002, etc so you can't do that from the ME. But I can't seem have to figure that out from scripting either. I thought I found the answer with

 

:InitKeepUnitNames(true)

 

The MOOSE documentation sounds like it's supposed to do exactly what I want it to do. Yet I spent hours experimenting with that and I'm not sure what it does or even if it works at this point.

 

Then I thought maybe since when you spawn something you assign it to a name like:

 

Attackers = SPAWN:New("Tanks") that I could just simply later reference that name like Attackers:IsCompletelyInZone(zone)

 

But apparently the MOOSE logic isn't intuitive to me and that doesn't work. So how can spawned units actually participate rather than merely being ambiance?

There is a method for objects/units/groups called destroy, that despawns the object.

Not at the PC so no exact code, but something along

'if ATTACKERS:IsCompletelyInZone then

ATTACKERS:destroy

end'

Should do it. Note that destroy is a method on your wrapper "ATTACKERS" which contains the actual spawned group/unit/object.

EDIT sorry total brain fart on my side. For whatever reason I read the request as a way to DEspawn objects. See Delta's post.


Edited by shagrat

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

This seems very basic, yet I can't seem to find the solution. I got spawn units running around and I want to trip triggers when they enter a zone. Problem is spawn units have automatically generated names like, Tank#001, Tank#002, etc so you can't do that from the ME. But I can't seem have to figure that out from scripting either. I thought I found the answer with

 

:InitKeepUnitNames(true)

 

The MOOSE documentation sounds like it's supposed to do exactly what I want it to do. Yet I spent hours experimenting with that and I'm not sure what it does or even if it works at this point.

 

Then I thought maybe since when you spawn something you assign it to a name like:

 

Attackers = SPAWN:New("Tanks") that I could just simply later reference that name like Attackers:IsCompletelyInZone(zone)

 

But apparently the MOOSE logic isn't intuitive to me and that doesn't work. So how can spawned units actually participate rather than merely being ambiance?

 

OnSpawnGroup() is likely your friend here. You'll be able to determine the group that was spawned so you can then do whatever you like with them.

Link to comment
Share on other sites

Sorry messed up in my first post.

To actually verify a spawn group of multiple spawns has entered a zone you may want to familiarize yourself with the SET class. This allows you to track groups or units based on a prefix. E.g. for your TANK #001 and TANK #002 you can filter the prefix "TANK" and include them in a set. Now you can query a lot of things like Zone, alive even count number of units etc. for the SET.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...