CCreatureTrigger can't detect when Anne dies?

Creating new content for Trespasser!

Moderators: TresCom Support Team, TresCom Board Managers, TresCom Developers

Post Reply
User avatar
Nick3069
Albertosaurus
Albertosaurus
Posts: 2361
Joined: Wed May 16, 2007 10:32 pm
Location: Ontario, Canada

CCreatureTrigger can't detect when Anne dies?

Post by Nick3069 »

Some of you may know that I'm working on a custom Trespasser level and it's coming along nicely, but I've run into an unexpected hurdle. I'm trying to make it so when the player dies then the music (if any) turns off and a different song starts playing. This is the code I came up with:

Code: Select all

group Trig_AnneDie-00 = {
    int ext_GeometryType = 2
    string Class = "CCreatureTrigger"
    string A00 = "Anne"
    bool CreatureDie = true
    int FireCount = 1
    group Action00 = {
        int ActionType = 3
        float VolumeFader = -9000.000000
        bool StopAfterFade = true
    }
    group Action01 = {
        int ActionType = 0
        string Sample = "MUSIC - Mission Death"
    }
}
Problem is: it doesn't fire when Anne dies. If I set the target (A00) to a raptor and kill it, then the trigger fires correctly, but not when it is Anne. According to the Tscript reference, CCreatureTrigger should work on the player, but my assumption is that Anne isn't treated as completely dead because you can still move the camera around. How do I set up a trigger to correctly detect when the player dies?
User avatar
Draconisaurus
T-Rex Killer
T-Rex Killer
Posts: 14045
Joined: Mon Dec 06, 2004 5:21 pm
Antispam: No
Location: Isla Sorna
Contact:

Re: CCreatureTrigger can't detect when Anne dies?

Post by Draconisaurus »

Huh, if you go look in my mod "SU~test", there is a trigger which starts the Monolith music when you die. https://www.trescom.org/download/summit-test-v0-5/
User avatar
tatu
-=TresCom Website Manager=-
-=TresCom Website Manager=-
Posts: 5088
Joined: Fri Jun 24, 2005 9:40 pm
Antispam: No
Location: Sweden
Contact:

Re: CCreatureTrigger can't detect when Anne dies?

Post by tatu »

Draco's trigger:

Code: Select all

group Trig_AAARRRRGGHHH = {
    string Class = "CCreatureTrigger"
    string A00 = "Player"
    bool CreatureDie = true
    int ActionType = 2
    string Sample = "Music - IJ Hidden"
}
It seems you need to change "Anne" to "Player" in order for it to work. I would also suggest adding "ProcessStyle" to make sure it fires the 2 actions in the right order. The Script document doesn't mention how it fires if this is left out!
Active project: Trespasser: Isla Sorna
Status:
BE-PH1: Released
PH2-IT: Pre-released
PL-SUM: In production

"...there used to be more benches, but InGen's workers removed them during the evacuation in the name of framerate."
User avatar
TheIdiot
T-Rex
T-Rex
Posts: 4345
Joined: Thu Feb 20, 2014 9:13 pm
Location: Canada, eh?

Re: CCreatureTrigger can't detect when Anne dies?

Post by TheIdiot »

To add to what tatu said, you generally always want to use "Player" instead of "Anne" when scripting triggers. There are a few instances where this doesn't apply, however, so if it doesn't work with one, try the other. :)
I would also suggest adding "ProcessStyle" to make sure it fires the 2 actions in the right order. The Script document doesn't mention how it fires if this is left out!
I think machf mentions that it defaults to 3. Also, Nick, if you want there to be a delay between actions (such as if the new music starts too early), make sure you use ActionType 34 with a blank message rather than ActionType 25. I've never seen AT25 work properly, it always just acts as if there is no delay at all.
User avatar
Nick3069
Albertosaurus
Albertosaurus
Posts: 2361
Joined: Wed May 16, 2007 10:32 pm
Location: Ontario, Canada

Re: CCreatureTrigger can't detect when Anne dies?

Post by Nick3069 »

Alright thanks guys. :D

Changing Anne to Player allows the trigger to fire. It's confusing because the script reference specifically says Anne instead of Player.

I've added ProcessStyle = 3 as per your suggestion, tatu, but as TI said, 3 is the default, so that's why I didn't put it in initially.

Good to know about the delay. I haven't needed delays between actions so far, I've only needed delays at the start to allow Anne to tell the ammo count and for that I've used a float FireDelay.

Testing it out: the trigger fires, but the ActionType 0 doesn't play the music, I assume this is hard coded to stop all voiceovers when the player dies. I used ActionType 0 because it has priority over ActionType 2, but I guess I'll have to use ActionType 2. Then the trigger works when no music is playing initially, but if music is playing when the player dies then the music stops, but the death music doesn't play. So I tried adding a delay between the CFadeMusicAction and the CMusicAction: Success!
Here is the code:

Code: Select all

group Trig_AnneDie-00 = {
    int ext_GeometryType = 2
    string Class = "CCreatureTrigger"
    string A00 = "Player"
    bool CreatureDie = true
    int FireCount = 1
    int ProcessStyle = 3
    group Action00 = {
        int ActionType = 3
        float VolumeFader = -9000
        bool StopAfterFade = true
    }
    group Action01 = {
        int ActionType = 34
        string OverlayText = " "
        float TextDisplayTime = 0.1
    }
    group Action02 = {
        int ActionType = 2
        string Sample = "MUSIC - Mission Death"
    }
}
User avatar
tatu
-=TresCom Website Manager=-
-=TresCom Website Manager=-
Posts: 5088
Joined: Fri Jun 24, 2005 9:40 pm
Antispam: No
Location: Sweden
Contact:

Re: CCreatureTrigger can't detect when Anne dies?

Post by tatu »

I've never seen AT25 work properly, it always just acts as if there is no delay at all.
Yes you have! :pirate:

While setting up the voiceovers in Beach for the Isla Sorna project, I finally figured out how AT25 actual works, at least for voiceover triggers. I'll write about it in the tutorial section :D
Active project: Trespasser: Isla Sorna
Status:
BE-PH1: Released
PH2-IT: Pre-released
PL-SUM: In production

"...there used to be more benches, but InGen's workers removed them during the evacuation in the name of framerate."
User avatar
Draconisaurus
T-Rex Killer
T-Rex Killer
Posts: 14045
Joined: Mon Dec 06, 2004 5:21 pm
Antispam: No
Location: Isla Sorna
Contact:

Re: CCreatureTrigger can't detect when Anne dies?

Post by Draconisaurus »

Glad we figured this one out. Delay DOES work, just not always as you might think it does...
User avatar
spinaxoraptor
Brachiosaurus
Brachiosaurus
Posts: 123
Joined: Tue Dec 06, 2022 7:07 pm

Re: CCreatureTrigger can't detect when Anne dies?

Post by spinaxoraptor »

That's pretty bizarre something I have not occurred although when I wasnt pro at level making I made plenty of errors.
User avatar
Nick3069
Albertosaurus
Albertosaurus
Posts: 2361
Joined: Wed May 16, 2007 10:32 pm
Location: Ontario, Canada

Re: CCreatureTrigger can't detect when Anne dies?

Post by Nick3069 »

"Pro at level making"? You've only been around for 3 months, how are you a pro? Are you trying to antagonize me? :-?
User avatar
spinaxoraptor
Brachiosaurus
Brachiosaurus
Posts: 123
Joined: Tue Dec 06, 2022 7:07 pm

Re: CCreatureTrigger can't detect when Anne dies?

Post by spinaxoraptor »

Nick3069 wrote: Thu Mar 23, 2023 7:18 am "Pro at level making"? You've only been around for 3 months, how are you a pro? Are you trying to antagonize me? :-?
ive been working on trespasser things when i wasnt even in the forums since 2020 and no i am not trying to antagonize you :no: i meant to say i am not great with levels i mean im working on one but its a bit off but its a work and progress :)
Attachments
Screenshot (1878).png
Screenshot (1878).png (1.14 MiB) Viewed 1883 times
Post Reply