Destroying props

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Hoodlum
Posts: 2
Joined: Fri Nov 23, 2012 11:34 pm

Destroying props

Post by Hoodlum »

I created a neat "now you see it, now you don't" effect where I press a button, and a secret wall covers the statue, seconds later the statue is mysteriously gone.

It works like a charm, but about 5 seconds after the secret door reveals that it is gone, the program crashes and I'm returned to the editor with this error: "attempt to index global "dragonstatue" (a nil value) X"

I only get the error after I've tested the event.

The destroy script is:

Code: Select all

--
function destroydragon()

	dragonstatue:destroy()
	end

Anyone else having either the same trouble or any solution?
Last edited by Hoodlum on Sat Nov 24, 2012 1:29 am, edited 1 time in total.
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

Re: Destroying props

Post by Phitt »

I assume you have a timer running to destroy the statue. You have to deactivate the timer or else the function will activate again, which causes a crash since the 'dragonstatue' entity doesn't exist anymore (you just destroyed it after all).
Hoodlum
Posts: 2
Joined: Fri Nov 23, 2012 11:34 pm

Re: Destroying props

Post by Hoodlum »

Ah! I assumed it had something to do with the function repeating itself...
Wouldn't guess it was actually the timer being the culprit. :ugeek:

The magical act is now performing as it should. Buy tickets. Special price for you.

Thanks for the quick reply!
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Destroying props

Post by Komag »

it's a good habit to pretty much always set your timers to deactivate
Finished Dungeons - complete mods to play
Post Reply