Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running an action when hallucination disappears
Author Message
ThePaSch Offline
Member

Posts: 103
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
ThePaSch Offline
Member

Posts: 103
Joined: Sep 2010
Reputation: 0
Post: #7
RE: Running an action when hallucination disappears
Nope, doesn't work. Door still stays locked.

10-20-2010 07:40 PM
Find all posts by this user Quote this message in a reply
house Offline
Member

Posts: 195
Joined: Oct 2010
Reputation: 1
Post: #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 all posts by this user Quote this message in a reply
ThePaSch Offline
Member

Posts: 103
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)