Page 2 of 2

Re: Dungeon Editor Crashing 1/2 the time on script

Posted: Thu Nov 29, 2012 5:56 pm
by zadkielmodeler
antti wrote:Is there a specific reason why do you want to use destroy instead of setDoorState for example?

Destroying entities should be, in general, your last resort because it is more prone for all sorts of problems where the game might try to do something with an entity that just (possibly even during the same frame) ceased to exist. Basically when destroying entities you need to make sure that nothing (connectors, scripts or anything else) refers to them anymore.

That's a very good thought. I will go with that.

Re: Dungeon Editor Crashing 1/2 the time on script

Posted: Thu Nov 29, 2012 6:09 pm
by zadkielmodeler
I just set them all to setDoorState and it is still crashing.

The function greed() is called when the party steps on a pressure plate, but here is a whole list of the code for the script entity.

Code: Select all

function greedy()


hudPrint("Mimsy Frowns on the Greedy.")
hudPrint("But you shall have more than you ever imagined.")

playSound("goromorg_shield_hit")
playSound("goromorg_shield_break")

prison_secret_door_38:setDoorState("open")
prison_secret_door_39:setDoorState("open")
prison_secret_door_40:setDoorState("open")
prison_secret_door_41:setDoorState("open")
prison_secret_door_42:setDoorState("open")

prison_secret_door_43:setDoorState("open")
prison_secret_door_44:setDoorState("open")
prison_secret_door_45:setDoorState("open")
prison_secret_door_48:setDoorState("open")
prison_secret_door_49:setDoorState("open")
prison_secret_door_50:setDoorState("open")
prison_secret_door_51:setDoorState("open")
prison_secret_door_52:setDoorState("open")



end


function destroyer()

pressure_plate_hidden_48:destroy()
pressure_plate_hidden_47:destroy()
pressure_plate_hidden_46:destroy()
pressure_plate_hidden_45:destroy()


end




function protectionspell()

party:getChampion(1):setCondition("fire_shield", math.huge)
party:getChampion(2):setCondition("fire_shield", math.huge)
party:getChampion(3):setCondition("fire_shield", math.huge)
party:getChampion(4):setCondition("fire_shield", math.huge)
playSound("heal_party")

end



for your reference, destroyer() is triggered by the pressure plates it destroys.
protectionspell() is triggered by a wall button.

Re: Dungeon Editor Crashing 1/2 the time on script

Posted: Thu Nov 29, 2012 6:55 pm
by Diarmuid
Why are you destroying the pressure plates? To prevent them from activating again? Use Activate Once for all of them, and include a check in the function to prevent the others from triggering:

Code: Select all

greedyActivated = false

function greedy()

if greedyActivated == false then
greedyActivated = true
hudPrint("Mimsy Frowns on the Greedy.")
hudPrint("But you shall have more than you ever imagined.")

playSound("goromorg_shield_hit")
playSound("goromorg_shield_break")

prison_secret_door_38:setDoorState("open")
prison_secret_door_39:setDoorState("open")
prison_secret_door_40:setDoorState("open")
prison_secret_door_41:setDoorState("open")
prison_secret_door_42:setDoorState("open")

prison_secret_door_43:setDoorState("open")
prison_secret_door_44:setDoorState("open")
prison_secret_door_45:setDoorState("open")
prison_secret_door_48:setDoorState("open")
prison_secret_door_49:setDoorState("open")
prison_secret_door_50:setDoorState("open")
prison_secret_door_51:setDoorState("open")
prison_secret_door_52:setDoorState("open")


end
end


function destroyer()

pressure_plate_hidden_48:destroy()
pressure_plate_hidden_47:destroy()
pressure_plate_hidden_46:destroy()
pressure_plate_hidden_45:destroy()


end




function protectionspell()

party:getChampion(1):setCondition("fire_shield", math.huge)
party:getChampion(2):setCondition("fire_shield", math.huge)
party:getChampion(3):setCondition("fire_shield", math.huge)
party:getChampion(4):setCondition("fire_shield", math.huge)
playSound("heal_party")

end




Re: Dungeon Editor Crashing 1/2 the time on script

Posted: Thu Nov 29, 2012 10:27 pm
by Komag
destroying plates as you step on them is the culprit methinks. link to a very short timer (0.01s) which THEN destroys the plates, will work fine then