how to "action" when monster dies.
how to "action" when monster dies.
I am looking for a way to do something such as open a door after a monster dies. How would I go about doing this? something along the lines of
if skeleton_patrol:isDead() then
trapdoor1:activate()
if skeleton_patrol:isDead() then
trapdoor1:activate()
Re: how to "action" when monster dies.
You can implement a custom onDie hook or just check if the id is non-existant, for example, in a script connected to a pressure plate. For example, if not findEntity("skeleton_patrol_1") then print("skeleton_patrol_1 not found in the dungeon") end. Of course with the latter the check is only executed when the pressure plate is activated.
Re: how to "action" when monster dies.
Interesting, I don't think that will work in my case though. What I have is a room that closes the door behind when a pressure plate is stepped on. A skeleton patrol is teleported to the room as well. I want the door behind and a door leading further ahead to open when the patrol is killed.
Re: how to "action" when monster dies.
How about setting up a timer with frequency, say, 1 second. Then when the timer activates check for the id and if it does not exist, open the door (you could also disable the timer at this point because it's not needed anymore and just wasted CPU cycles)?
Or you could make a custom monster with onDie.
Or you could make a custom monster with onDie.
Re: how to "action" when monster dies.
ah, the classic Zelda fight - kill the baddies to open the doors
Finished Dungeons - complete mods to play
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: how to "action" when monster dies.
When the player is trapped like you described, the following scriptless approach should also work (might need testing):
Also, In theory a much simpler approach might even work to just connect each plate to the doors on the "any" event to "toggle", but it will probably just play the door open and door close sound a lot of times when the monsters move through the room.
- Place hidden pressure plates all over the room that are only triggered by monsters.
- Connect all pressure plates twice to a counter that has an initial value of 0. Set the events to activate -> increment, deactivate -> decrement.
- Connect the counter to all doors with deactivate -> close.
- Place a timer with an interval set to 1 with an a connection to all the doors activate -> open.
- Connect the timer also to itself with activate -> deactivate (so the timer stops and doesn't try to open the doors constantly).
- Connect the counter with the timer: any -> toggle.
Also, In theory a much simpler approach might even work to just connect each plate to the doors on the "any" event to "toggle", but it will probably just play the door open and door close sound a lot of times when the monsters move through the room.
Re: how to "action" when monster dies.
I was thinking the same thing as you. hidden pressure plates are very powerful tool !Montis wrote:When the player is trapped like you described, the following scriptless approach should also work (might need testing):
- Place hidden pressure plates all over the room that are only triggered by monsters.
ad&d / ff / d&d
Re: how to "action" when monster dies.
Interesting. I used your idea with the hidden pressure plates, and it works great! Thanks a bunch guys! I think I am going to try the other ideas also just for learning purposes. I could'nt figure out how to do an ondie trigger, but I am sure I can figure it out eventually. I just really don't know much about programming. The only programming I have ever done was with My Arduino microcontroller, which in most cases I would just copy someone else's code for the project I was working on hehe. I sure am learning though and its tons of fun . The one thing I think is really cool about programming is that there are so many different ways to do the same thing, and some can be very efficient and others not so much but get the job done.
Re: how to "action" when monster dies.
not sure if this is much help, but maybe someone will find this useful. I needed a system to spawn a monster to replace one that died in a room for my dungeon so that there will always be one monster to work with heres the basics of it:
exit are filled with blockers to stop monster from leaving,
the whole room is filled with pressure plates (hidden and only activate by monsters) set to
-on deactivate start spawntimer
-on activate start resettimer
resettimer is set to 1 second and deactivates itself and the spawn timer
spawntimer is set to 3 seconds or more and tiggers the spawner and turns itself off
(and if desired connect it too a counter to count spawns/kills) the counter could be hooked up to any number of things to be useful (stop spawns, open doors etc...)
by default all timers need to be off and require an external kickstart on the spawntimer so far
exit are filled with blockers to stop monster from leaving,
the whole room is filled with pressure plates (hidden and only activate by monsters) set to
-on deactivate start spawntimer
-on activate start resettimer
resettimer is set to 1 second and deactivates itself and the spawn timer
spawntimer is set to 3 seconds or more and tiggers the spawner and turns itself off
(and if desired connect it too a counter to count spawns/kills) the counter could be hooked up to any number of things to be useful (stop spawns, open doors etc...)
by default all timers need to be off and require an external kickstart on the spawntimer so far
Re: how to "action" when monster dies.
I want to use the onDie hook, but I don't know what to do, how to use it, how to set things up or make any connection.
Finished Dungeons - complete mods to play