#1
|
|||
|
|||
Triggers not working on spawned units
I tried to search the forums but found no light in how to make the triggers work on spawned units. I am trying to create a scoring system for air and ground kills, but it seems that all the vehicles and aircrafts that get script spawned, do not trigger neither passthrough nor destroyed type triggers. They are like "ghosts" in this sense. Another aprroach I tried was to override the OnActorDead method with scoring, but that resulted in funny things like planes freezing mid-air once the pilot was shot dead. Even the fuel leaked downwards on the planes like they were on the ground in this state.
Is there any way to make the triggers react to spawned units or what is the original OnActorDead function doing, which makes the planes behave like they should (fall down) once their pilot is dead. I'm trying to recreate Operation Jubilee (Dieppe Landing) scene with LCAs spawning tanks and vehicles on the beach, but it would be nice to count the ground kills of these spawned units storming the beach. |
#2
|
|||
|
|||
First do you have set
MissionNumberListener = -1; example: Code:
public override void OnBattleStarted() { base.OnBattleStarted(); MissionNumberListener = -1; } Third i don't know how you use OnActorDead, but for me it works without a problem. Code:
public void ActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages) { if (actor is AiAircraft) { // code for aircrafts } else if (actor is AiPerson) { // code for pilot or gunner kills (if needed) } else if (actor is AiGroundActor) { // code for destroyed groundactors } } |
#3
|
|||
|
|||
Quote:
|
#4
|
|||
|
|||
Now I got the scoring working as intended using the OnActorDead, thanks to Kodiak.
Now if only there was a way to get those spawned units to cause triggered events. I still don't understand why the scriptspawned units can't trigger the ArmyRedGround pass through triggers while every non-spawned do. How do implement a pass through trigger using the code? |
#5
|
|||
|
|||
Regarding triggers not working on spawned units, is it possible to add a timout to an airgroup ?
Thinking if somehow you could delay a take off for a group then it would be loaded from mission start and a trigger could be implemented from it. |
|
|