Thank you for that Alois, that fixed the 'returns nil' error I was getting. Which brings up a question in the script that Issac gave; I'm not seeing where 't' was defined either unless it was defined in the
deathtrap(t) portion of the script?
I did manage to also resolve another issue where the trap wasn't triggering when crossing an open pit. It appears that the trigger
pit:isOpen() is an auto check itself and doesn't need a quantifying check to ensure it is true or false. I.E. the statement
pit:isOpen == "true" is redundant as the isOpen already just returns a true or false. Meaning the check somehow was wiping the statements check and interestingly enough while not producing any errors was causing anything in the following statement to simply be skipped until it reached an
else or
end. As an example:
Code: Select all
local deathpit = findEntity(deathpits[i])
if deathpit:isOpen() ~= "true" then
return false
else
damageTile(deathpit.level, deathpit.x, deathpit.y, 0, 6, "poison", 9001)
Would kill anything that passed over the tile regardless of what the state actually was. The solution of course is to simply remove the
x="true/false" bit of code and you end up with the following as the final code for this:
Code: Select all
local deathpit = findEntity(deathpits[i])
if deathpit:isOpen() then
damageTile(deathpit.level, deathpit.x, deathpit.y, 0, 6, "poison", 9001)
Now I can move onto the next iteration of this trap. I don't actually want to outright kill the party at any point of the adventure. This was just to get the traps and damage to work properly at this level. What I now need to do is figure out how to significantly damage and then teleport the player back to the tile that they were on previously; while killing monsters that pass over it. I believe something like this will work:
Code: Select all
if class.monster then
damageTile(deathpit.level, deathpit.x, deathpit.y, 0, 6, "poison", 9001)
else
damageTile(deathpit.level, deathpit.x, deathpit.y, 0, 6, "poison", 20)
Teleport:setTeleportTarget(x, y, facing, [level])
I've yet to look up the actual syntax and write the code. The biggest problem I see here is going to be figuring out how to tell the program that I need it to teleport the party to the previous tile they were on instead of a fixed coordinate. A solution being when they step on a pressure plate the script records that position and the position is rewritten every time a pressure plate is activated then the teleporters simply call the X,Y, Facing of that script. If anyone has any ideas on how to accomplish that I'd be really appreciative.