help with insta-death square script and other Qs
Re: Useful scripts repository
You would make the script very close to the example:
function poisontrap()
damageTile(party.level, party.x, party.y, party.facing, 1, "poison", 50)
hudPrint("A noxious gas fills the chamber!")
end
Then just create your pressure plate and connect the pressure plate to the script with activate - poisontrap
it works to do the damage, but there is poison cloud effect or lingering poison, so I'm not exactly sure how to do that part yet
-----------------
The original thread for the insta-kill script was here:
viewtopic.php?f=14&t=3248
function poisontrap()
damageTile(party.level, party.x, party.y, party.facing, 1, "poison", 50)
hudPrint("A noxious gas fills the chamber!")
end
Then just create your pressure plate and connect the pressure plate to the script with activate - poisontrap
it works to do the damage, but there is poison cloud effect or lingering poison, so I'm not exactly sure how to do that part yet
-----------------
The original thread for the insta-kill script was here:
viewtopic.php?f=14&t=3248
Finished Dungeons - complete mods to play
- sevenbirds
- Posts: 10
- Joined: Wed Sep 19, 2012 9:26 am
Re: Lua scripts
Hello everyone. I'm moving my questions to this thread instead of flooding the excellent scripting example one if that is all right.
So I'm trying to create a tile that damage any player or monster that steps on it, then continuously deals damage over a period of time. Here is what I currently have.
This is connected to a timer called poisontimer set with the interval of 2,defaulted to stopped and calls the poisontrap function when activated. stepping on a pressure plate activates this timer, with the idea being that it will do 5 damage every 2 seconds.
I then have a counter named poisoncounter that starts at 15. poisontimer is connected and decrements poisoncounter every time it activates. This is reset when the same pressure plate is activated. My idea is that it will cause a lingering poison that does 5 damage every 2 seconds for 30 seconds, and start all over again if you step on the pressure plate. However, right now all it does is hurt you once. the lingering damage never happens. Does anyone have any idea where I went wrong?
EDIT: I solved the problem. Always make sure to restart the preview, don't just pause. the changes were not taking effect until I stopped the playtest an redid it. this works like a charm now. However, it still doesn't damage enemies as far as I can tell. Is there a way to get this to affect both enemies and the party?
So I'm trying to create a tile that damage any player or monster that steps on it, then continuously deals damage over a period of time. Here is what I currently have.
Code: Select all
function poisontrap()
damageTile(party.level, party.x, party.y, party.facing, 1, "poison", 5)
end
I then have a counter named poisoncounter that starts at 15. poisontimer is connected and decrements poisoncounter every time it activates. This is reset when the same pressure plate is activated. My idea is that it will cause a lingering poison that does 5 damage every 2 seconds for 30 seconds, and start all over again if you step on the pressure plate. However, right now all it does is hurt you once. the lingering damage never happens. Does anyone have any idea where I went wrong?
EDIT: I solved the problem. Always make sure to restart the preview, don't just pause. the changes were not taking effect until I stopped the playtest an redid it. this works like a charm now. However, it still doesn't damage enemies as far as I can tell. Is there a way to get this to affect both enemies and the party?
Re: Lua scripts
Why not just spawn a poison cloud there?
- sevenbirds
- Posts: 10
- Joined: Wed Sep 19, 2012 9:26 am
Re: Lua scripts
It's times like this that make learning fun. Here I was trying to reinvent the wheel and that's all it took. Thank you so much!petri wrote:Why not just spawn a poison cloud there?
Re: Lua scripts
Hah Seven, still its always good to try and look at the complicated methods also, as it opens up avenues. Perhaps you want a slightly stronger poison cloud or one that lasts longer, one that doesn't infect and only causes poison damage and so forth.
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Lua scripts
When you use the code above it will always damage the tile that the player is on (and thus the party), no matter who's stepping on the pressure plate.sevenbirds wrote:[...]Code: Select all
function poisontrap() damageTile(party.level, party.x, party.y, party.facing, 1, "poison", 5) end
However, it still doesn't damage enemies as far as I can tell. Is there a way to get this to affect both enemies and the party?
Edit:
If you want to damage monsters, you have to specify the square that needs to get damaged (probably the one with the pressure plate). See code by Xzalander below.
Last edited by Montis on Thu Sep 20, 2012 1:28 pm, edited 3 times in total.
Re: help with insta-death square script and other Qs
I split off this section of the discussion into a new thread, to try to maintain the script repository thread as mostly just a place for finished scripts 

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: help with insta-death square script and other Qs
Thanks a lot!Komag wrote:I split off this section of the discussion into a new thread, to try to maintain the script repository thread as mostly just a place for finished scripts
I actually took some time to make an index in the first post of that thread.

Re: Lua scripts
Montis I think he means he wants the poison trap to hurt monsters as well.
In which case you simply specify the tile location instead of using party.x etc
So for example
That would cause the poison effect to happen on Floor 1, Grid Reference 14x 14y. 0 is the direction (north).
In which case you simply specify the tile location instead of using party.x etc
So for example
Code: Select all
function poisontrap()
damageTile(1, 14, 14, 0, 1, "poison", 5)
end
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Lua scripts
Uh yes, I just said that he will always damage the party with the code that he used. I edited the post above to make it a bit more clear what I meant.Xzalander wrote:Montis I think he means he wants the poison trap to hurt monsters as well.