Page 3 of 3
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Sat Jul 06, 2013 11:13 am
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.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Sat Jul 06, 2013 2:22 pm
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.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Mon Jul 08, 2013 1:12 am
by maneus
Yes I wrote about the animation effect. Thank you for the answer Diarmuid.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Tue Jul 09, 2013 5:28 pm
by maneus
Me again.
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:
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.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Tue Jul 09, 2013 6:05 pm
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
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Tue Jul 09, 2013 6:43 pm
by maneus
Thank you Komag, that was a good idea. It works very well.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Wed Jul 10, 2013 3:14 am
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.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Wed Jul 10, 2013 10:46 pm
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.
Re: [SCRIPT] Goromorg Shield (v1.1 update)
Posted: Thu Jul 11, 2013 12:42 am
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.