[SCRIPT] Goromorg Shield (v1.1 update)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by maneus »

Shield works great. Thank you for this nice work.

But after destroying the shild it dosn´t shrink. It is destroyed. Is that right so?
The original goromorg shild shrinks after destroying. Have I done something wrong by scripting? I´ve found no mistakes in my scripts.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by Diarmuid »

Hi maneus,

What do you mean, it doesn't shrink? Are talking about an animation effect? If so yes, it won't do it because it's a simulation of the effect to recreate it, it's not the real shield.
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by maneus »

Yes I wrote about the animation effect. Thank you for the answer Diarmuid.
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by maneus »

Me again. :D

I get another problem with the shield.

I wish to spawn a monster with that shield by activating a pressure plate. The monster spawned but when I hit the monster in the editor I get the following message:
SpoilerShow
Image
Is that a bug?

When I place a monster with shield somewhere in my dungeon the shield works perfectly. But spawning a monster with shield, it dosn´t work.
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by Komag »

without looking into a proper solution, perhaps you could just park the monster in a closed off room far in the corner of the map or something, then just teleport it in instead of spawning in
Finished Dungeons - complete mods to play
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by maneus »

Thank you Komag, that was a good idea. It works very well.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by Diarmuid »

I know what the bug is.

Well it seems the fxId is incorrect, which is based on the monster id (monster.id..".shield"). So if your monster is named snail_1, the shield particle will be named snail_1.shield.

When you spawn a monster without specifiying an id, for example spawn("snail", level, x, y, facing), it generates a random numerical id, like 24536. Then it tries to make a shield called 24536.shield. However, only the game itself can spawn things with numerical ids, if you try to you get an error.

So you need to specify a specific id, for example ("snail", level, x, y, facing, "myNewSnail").

If you need to spawn a lot of different snails like that, you can put a counter, and add it to the id: ("snail", level, x, y, facing, "myNewSnail_"..myCounter) and increment the counter at each snail you make.

:)
User avatar
slackmg
Posts: 20
Joined: Fri Nov 09, 2012 12:21 am
Location: Here I am.

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by slackmg »

You could change the script local also, which may be easier (and will fix the script). Change the declaration of fxId to: local fxId = "f_" .. monster.id .. ".shield"
You'll also need to update the declaration of the timerId to: local timerId = "t_" .. monster.id .. ".moveTimer"
I've done this on several other scripts so I don't need to worry about if the monster/item is spawned or placed to get a good id generated.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [SCRIPT] Goromorg Shield (v1.1 update)

Post by Diarmuid »

Ah right, thanks for the tip!

When I did this shield script I was still novice at scripting, it sure can be rewritten to be a bit more optimized or robust.
Post Reply