Frictional Games Forum (read-only)
Running an action when hallucination disappears - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Running an action when hallucination disappears (/thread-5124.html)



Running an action when hallucination disappears - ThePaSch - 10-20-2010

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?


RE: Running an action when hallucination disappears - Pandemoneus - 10-20-2010

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


RE: Running an action when hallucination disappears - Frontcannon - 10-20-2010

(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..


RE: Running an action when hallucination disappears - Pandemoneus - 10-20-2010

But you can't spawn items/enemies either, so what would be the use of that method then?


RE: Running an action when hallucination disappears - Frontcannon - 10-20-2010

(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?


RE: Running an action when hallucination disappears - Pandemoneus - 10-20-2010

Yeah, I had that in mind but forgot to add it to my code, lol.
Edited by code post.


RE: Running an action when hallucination disappears - ThePaSch - 10-20-2010

Nope, doesn't work. Door still stays locked.


RE: Running an action when hallucination disappears - house - 10-22-2010

(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!


RE: Running an action when hallucination disappears - ThePaSch - 10-22-2010

(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