Giving monsters new abilities
Posted: Thu Apr 02, 2015 3:01 pm
So I want to try to give the uggaurdian the ability to summon in fire elementals like the skeleton commander, for the time being I don't have anything for a new animation so it would just appear after the command is given.
What I want to know is it possible to give it that ability with this
I put that in the .lua file and it showed up in game as an option to click on but when it came down to fighting the monster it didn't summon anything.
What I want to know is it possible to give it that ability with this
Code: Select all
{
class = "MonsterAttack",
name = "summonUndead",
cooldown = 10,
repeatChance = 0,
animation = "summonUndead",
sound = "skeleton_commander_summon_spell",
onAttack = function(self)
for tries=1,20 do
-- choose summon location
local dx,dy = getForward(self.go.facing)
local x = self.go.x + math.random(-1,1)
local y = self.go.y + math.random(-1,1)
-- is valid spawn point?
local map = self.go.map
local elevation = map:getElevation(x, y)
if not map:isBlocked(x, y, elevation) then
spawn("hell_fire_elemental", self.go.level, x, y, self.go.facing, elevation)
return
end
end
end,
},