monsters using custom spells

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

monsters using custom spells

Post by LordGarth »

Hello all,

I got a monster that uses magic ranged attack to use a custom spell along with its standard magic attack

onRangedAttack = function(self)
if self.facing == 0 then
spawn("armagedon", self.level, self.x, self.y-1, self.facing)
end
if self.facing == 1 then
spawn("armagedon", self.level, self.x+1, self.y, self.facing)
end
if self.facing == 2 then
spawn("armagedon", self.level, self.x, self.y+1, self.facing)
end
if self.facing == 3 then
spawn("armagedon", self.level, self.x-1, self.y, self.facing)
end

just replace armagedon with the name in the defineObject for your custom spell

This is what the Lord of Chaos in my game will be using by the way muahhahahahahahhaah. ouch
Better have healing pots ready and find all of the tomes of health.

:lol: :evil: :twisted:


LG
Dungeon Master and DOOM will live forever.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: monsters using custom spells

Post by Grimwold »

two things come to mind... the first is, you should check out the function getForward()... it would save you several lines of code.

Your whole function can be re-written in 2 lines:

Code: Select all

local dx,dy = getForward(self.facing)
spawn("Armageddon", self.level, self.x + dx, self.y + dy, self.facing)
Post Reply