Help with spawned entities

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Help with spawned entities

Post by WaspUK1966 »

I`ve written a code that spawns a monster in front of the party, prints a message and plays some screen/sound effects etc.

Code: Select all

playSound("karim")
party:shakeCamera(0.3, 4)
spawn("karim_ghost", party.level, party.x+3, party.y, 0)
hudPrint("Lord Karim: 'I'm watching you..'")

I've then linked it to a timer which runs a script to make the monster disappear after a few seconds. But I can't figure out what I need to code to make the spawned entity disappear. Just keep getting error messages:

Code: Select all

function removeghost
karim_ghost:destroy()
end
I've tried all sorts of combinations. Any advice?

George
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: Help with spawned entities

Post by maneus »

You have to give your "karim_ghost" a unique id.
Try this:

playSound("karim")
party:shakeCamera(0.3, 4)
spawn("karim_ghost", party.level, party.x+3, party.y, 0, "karim_ghost_1")
hudPrint("Lord Karim: 'I'm watching you..'")

Then change your function to:

function removeghost()
karim_ghost_1:destroy()
end
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Re: Help with spawned entities

Post by WaspUK1966 »

Thanks for your reply. As it happens, I`d just figured it out and got it working by giving the monster an ID, and was about to delete the post when I saw your reply! Appreciate your response, though. Thanks again.
George
Post Reply