how to "action" when monster dies.

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
roachburn
Posts: 17
Joined: Wed Sep 19, 2012 11:22 am

how to "action" when monster dies.

Post by roachburn »

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()
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: how to "action" when monster dies.

Post by petri »

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.
roachburn
Posts: 17
Joined: Wed Sep 19, 2012 11:22 am

Re: how to "action" when monster dies.

Post by roachburn »

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.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: how to "action" when monster dies.

Post by petri »

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.
User avatar
Komag
Posts: 3654
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: how to "action" when monster dies.

Post by Komag »

ah, the classic Zelda fight - kill the baddies to open the doors
Finished Dungeons - complete mods to play
User avatar
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.

Post by Montis »

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.
  • 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.
What you also should do is put blockers in the tunnels leading to the room so that no wandering monster accidentally traps itself and blocks your path if you want to backtrack.

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.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
pulpum
Posts: 155
Joined: Wed Apr 18, 2012 1:23 am
Location: bordeaux, france

Re: how to "action" when monster dies.

Post by pulpum »

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.
I was thinking the same thing as you. hidden pressure plates are very powerful tool !
ad&d / ff / d&d
roachburn
Posts: 17
Joined: Wed Sep 19, 2012 11:22 am

Re: how to "action" when monster dies.

Post by roachburn »

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 :D . 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.
Daovala
Posts: 1
Joined: Mon Sep 24, 2012 1:02 am

Re: how to "action" when monster dies.

Post by Daovala »

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
User avatar
Komag
Posts: 3654
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: how to "action" when monster dies.

Post by Komag »

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
Post Reply