Lizard casting a spell: how to do correctly.

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Lizard casting a spell: how to do correctly.

Post by crisman »

I wanted a lizard casting a spell when attacking, in my case, the fireburst.
But I noticed when it does a turn attack it will keep casting it in front of it, and not where is actually attacking.
So I've figured out how can this be solved. It's a bit tricky, and not immediate, and someone might find it useful.
The code is:

Code: Select all

onAttack = function(self, attack)
local dx, dy = getForward(self.facing)
if attack == "attack" then
	spawn("fireburst", self.level, self.x+dx, self.y+dy, 0)
elseif attack == "turnAttackLeft" then
	spawn("fireburst", self.level, self.x+dy, self.y-dx, 0)
elseif attack == "turnAttackRight" then
	spawn("fireburst", self.level, self.x-dy, self.y+dx, 0)
end
   end,
I really think this can be applied to all monsters that do a turn attack (ogre, warden), if the name of the attack is the same.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Lizard casting a spell: how to do correctly.

Post by Komag »

oh that could be useful to know, would be good in the script repository :)
Finished Dungeons - complete mods to play
User avatar
LordYig
Posts: 175
Joined: Wed Jul 04, 2012 5:45 pm

Re: Lizard casting a spell: how to do correctly.

Post by LordYig »

This is some "Nice to known" trick.

Add some particle effect and you have a nice dragon like lizard breathing fire ;)
(But i don't know if this last part is doable with the lizard model...)
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Re: Lizard casting a spell: how to do correctly.

Post by crisman »

Ok! I've added to the repository! :D
Post Reply