1C Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official 1C Company forum > 1C Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2012, 11:30 AM
TEL79 TEL79 is offline
Junior Member
 
Join Date: Sep 2009
Posts: 14
Default 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.
Reply With Quote
  #2  
Old 11-13-2012, 04:45 AM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

First do you have set
MissionNumberListener = -1;
example:
Code:
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;
    }
Second if you create an actor and you want a trigger like TGroupDestroyed attached to the actor you must create the trigger after the spawn of the actor.

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
                }
            }
Reply With Quote
  #3  
Old 11-13-2012, 07:32 AM
TEL79 TEL79 is offline
Junior Member
 
Join Date: Sep 2009
Posts: 14
Default

Quote:
Originally Posted by FG28_Kodiak View Post
First do you have set
MissionNumberListener = -1;
example:
Code:
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;
    }
Second if you create an actor and you want a trigger like TGroupDestroyed attached to the actor you must create the trigger after the spawn of the actor.

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
                }
            }
Thanks, I'll try the ActorDead approach later today. I don't know how to create a trigger in a script after the spawn, as I have so far created them using the GUI.
Reply With Quote
  #4  
Old 11-16-2012, 06:52 AM
TEL79 TEL79 is offline
Junior Member
 
Join Date: Sep 2009
Posts: 14
Default

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?
Reply With Quote
  #5  
Old 01-29-2013, 02:27 PM
Punch_145 Punch_145 is offline
Junior Member
 
Join Date: May 2012
Posts: 24
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:59 PM.

Based on a design by: Miner Skinz.com

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.