Frictional Games Forum (read-only)

Full Version: Running an action when hallucination disappears
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
basically, the title says it all. In my custom story, I spawn a hallucination of a monster and want a door to unlock when it disappears.
Any idea how to do this? Is it the "OnDeath" callback?
I took a quick look at the script functions and I'd try using
Code:
GetEntityExists(string& asName);

I'd probably do
Code:
void MonsterDisappear(string &in asTimer) {
     if(GetEntityExists("Grunt") == false) {
           //do stuff
     }
     else {
           AddTimer("", 0.1f, MonsterDisappear);
     }
}

Put
Code:
//Add this to the part where you make your monster active
AddTimer("", 1.0f, MonsterDisappear);
Something like that. Try it out. Wink
(10-20-2010, 06:16 PM)Pandemoneus Wrote: [ -> ]I took a quick look at the script functions and I'd try using
Code:
GetEntityExists(string& asName);

I'd probably do
Code:
void MonsterDisappear(string &in asTimer) {
     if(GetEntityExists("Grunt") == false) {
           //do stuff
     }
     else {
           AddTimer("", 0.1f, MonsterDisappear);
     }
}

Something like that. Try it out. Wink

Wouldn't that only work if the entity Grunt exists from the beginning?
I have the feeling it would also trigger BEFORE the enemy is spawned..
But you can't spawn items/enemies either, so what would be the use of that method then?
(10-20-2010, 06:38 PM)Pandemoneus Wrote: [ -> ]But you can't spawn items/enemies either, so what would be the use of that method then?

I don't really understand..

Your method is the right one, but you'd have to put in in the same function that spawns the hallucination or it would trigger and unlock the door from the start, or wouldn't it?
Yeah, I had that in mind but forgot to add it to my code, lol.
Edited by code post.
Nope, doesn't work. Door still stays locked.
(10-20-2010, 07:40 PM)ThePaSch Wrote: [ -> ]Nope, doesn't work. Door still stays locked.

What??? I thought we were talking about making something happen when a monster disappears!
(10-22-2010, 03:27 PM)house Wrote: [ -> ]
(10-20-2010, 07:40 PM)ThePaSch Wrote: [ -> ]Nope, doesn't work. Door still stays locked.

What??? I thought we were talking about making something happen when a monster disappears!
Yup.
And that "something" is to unlock a door. Big Grin