Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running an action when hallucination disappears
ThePaSch Offline
Member

Posts: 108
Threads: 11
Joined: Sep 2010
Reputation: 0
#1
Running an action when hallucination disappears

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?
10-20-2010, 05:45 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: Running an action when hallucination disappears

I took a quick look at the script functions and I'd try using
GetEntityExists(string& asName);

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

Put
//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
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#3
RE: Running an action when hallucination disappears

(10-20-2010, 06:16 PM)Pandemoneus Wrote: I took a quick look at the script functions and I'd try using
GetEntityExists(string& asName);

I'd probably do
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..


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
10-20-2010, 06:37 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#4
RE: Running an action when hallucination disappears

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

10-20-2010, 06:38 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#5
RE: Running an action when hallucination disappears

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


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
10-20-2010, 06:49 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#6
RE: Running an action when hallucination disappears

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

10-20-2010, 06:52 PM
Find
ThePaSch Offline
Member

Posts: 108
Threads: 11
Joined: Sep 2010
Reputation: 0
#7
RE: Running an action when hallucination disappears

Nope, doesn't work. Door still stays locked.
10-20-2010, 07:40 PM
Find
house Offline
Member

Posts: 195
Threads: 11
Joined: Oct 2010
Reputation: 1
#8
RE: Running an action when hallucination disappears

(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
Find
ThePaSch Offline
Member

Posts: 108
Threads: 11
Joined: Sep 2010
Reputation: 0
#9
RE: Running an action when hallucination 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
10-22-2010, 04:15 PM
Find




Users browsing this thread: 1 Guest(s)