Page 1 of 2
Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 6:19 am
by zadkielmodeler
I am running a script on the dungeon editor. It is set to go off when the party steps on a pressure plate. The problem is when I am testing it, it crashes the editor half the time. I am afraid to publish to the workshop for fear of the same problem.
Code: Select all
function greedy()
hudPrint("Mimsy Frowns on the Greedy.But you shall have more than you ever imagined.")
playSound("goromorg_shield_break")
prison_secret_door_38:destroy()
prison_secret_door_39:destroy()
prison_secret_door_40:destroy()
prison_secret_door_41:destroy()
prison_secret_door_42:destroy()
prison_secret_door_43:destroy()
prison_secret_door_44:destroy()
prison_secret_door_45:destroy()
prison_secret_door_48:destroy()
prison_secret_door_49:destroy()
prison_secret_door_50:destroy()
prison_secret_door_51:destroy()
prison_secret_door_52:destroy()
end
The crazy thing is I have deleted a secret door or two before from a script without causing problems of any kind.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 6:26 am
by zadkielmodeler
I might just try to do it in a bunch of different scripts. break it into pieces activated by timers or something.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 6:48 am
by msyblade
I would need more info to give an educated guess, but the script looks like it should function, so my guess is the crash could be caused by one of the destroy() functions. Maybe just ONE of those tags is wrong. Perhaps one secret door is not prison, or you no longer have door_48, and it's 47. That would definitely cause a crash upon triggering the script. Also, make sure your playSound is a .wav file, as .ogg is for background "Mono" music. There is an issue with mono vs. stereo .wavs also.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 7:02 am
by zadkielmodeler
I know its not the sound because its one of the predefined one in the asset list. And because it played just fine.
You are right though, if even 1 of those doors is wrong the thing would explode.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 7:17 am
by zadkielmodeler
Dang, now I am really confused... I split the lua script into 2 parts the second part activates only after a timer. and the second part is crashing it. But the problem is that all the entities in the script are there and real. I just double checked each one.
On a second try its now crashing on the first one... <sigh>.
On a third try it did not crash at all. It did not give any errors either. I can only assume it is a bug at this point.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 9:42 am
by antti
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.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 11:44 am
by Komag
what crash message are you getting? Any info at all?
you could try doing it like this:
Code: Select all
function greedy()
hudPrint("Mimsy Frowns on the Greedy.But you shall have more than you ever imagined.")
playSound("goromorg_shield_break")
for i=38,52 do
local door = findEntity("prison_secret_door_"..i)
if door then
door:destroy()
end
end
end
the "if" part should help protect against crashes of the door not being named correctly or something, but wouldn't help if the cause is something.
Maybe doors don't like to be destroyed if they are currently being opened or closed? Try setting up just one secret door destroy, connected to a plate or a button, have the door currently opening or closing, then hit the button and see
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 4:10 pm
by Diarmuid
Is there a way to remove connectors? Because in our extended timers thread, JKos and me are destroying timers/counters with connectors still attached. Is this a crash danger?
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 4:37 pm
by Komag
I'm pretty sure connections cannot be removed, I've searched for that functionality in the past.
Re: Dungeon Editor Crashing 1/2 the time on script
Posted: Thu Nov 29, 2012 4:50 pm
by Grimwold
Diarmuid wrote:Is there a way to remove connectors? Because in our extended timers thread, JKos and me are destroying timers/counters with connectors still attached. Is this a crash danger?
I think the danger is destroying timers/counters that are referenced from connectors of other entities... destroying a timer that has connectors should be no problem.
Some of the spells I've written spawn and destroy timers that have connectors and I've had no problems in that respect. I do however tend to deactivate the timers when the spell ends and only destroy them when the spell is cast, in order to spawn a new instance.