Dungeon Editor Crashing 1/2 the time on script

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
zadkielmodeler
Posts: 43
Joined: Sat Sep 15, 2012 6:34 am

Dungeon Editor Crashing 1/2 the time on script

Post 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.
zadkielmodeler
Posts: 43
Joined: Sat Sep 15, 2012 6:34 am

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

Post by zadkielmodeler »

I might just try to do it in a bunch of different scripts. break it into pieces activated by timers or something.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

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

Post 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.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
zadkielmodeler
Posts: 43
Joined: Sat Sep 15, 2012 6:34 am

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

Post 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.
zadkielmodeler
Posts: 43
Joined: Sat Sep 15, 2012 6:34 am

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

Post 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.
User avatar
antti
Posts: 688
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

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

Post 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.
Steven Seagal of gaming industry
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

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

Post 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
Finished Dungeons - complete mods to play
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

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

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

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

Post by Komag »

I'm pretty sure connections cannot be removed, I've searched for that functionality in the past.
Finished Dungeons - complete mods to play
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

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

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