*To use: The full monster definition [below] must be placed in a referenced script in the project folder; usually "mod_assets/scripts/monsters.lua" .
(Then use the new variant monster on the map; and it cannot die.)
excerpt:
Code: Select all
onDie = function(self) self.go:spawn(self.go.name) end,
full:
Code: Select all
defineObject{
name = "undead_respawn",
baseObject = "undead",
components = {
{
class = "Monster",
meshName = "undead_mesh",
footstepSound = "skeleton_footstep",
hitSound = "skeleton_hit",
dieSound = "undead_die",
hitEffect = "hit_dust",
capsuleHeight = 0.7,
capsuleRadius = 0.25,
collisionRadius = 0.6,
health = 475,
immunities = { "sleep" },
resistances = { ["poison"] = "immune" },
traits = { "undead" },
evasion = 0,
exp = 200,
onInit = function(self)
self:performAction("rise")
end,
onDie = function(self) self.go:spawn(self.go.name) end,
headRotation = vec(0, 0, 90),
},
},
}
excerpt:
Code: Select all
onDie = function(self) self.go:playSound("zarchton_diving_alert") findEntity(self.go:spawn(self.go.name).id).monster:performAction('riseFromWater') end,
full:
Code: Select all
defineObject{
name = "zarchton_respawn",
baseObject = "zarchton",
components = {
{
class = "Monster",
meshName = "zarchton_mesh",
hitSound = "zarchton_hit",
dieSound = "zarchton_die",
footstepSound = "zarchton_footstep",
hitEffect = "hit_blood",
capsuleHeight = 0.2,
capsuleRadius = 0.7,
health = 90,
evasion = 0,
exp = 75,
--lootDrop = { 100, "zarchton_harpoon"},
resistances = { ["shock"] = "weak" },
onDie = function(self) self.go:playSound("zarchton_diving_alert") findEntity(self.go:spawn(self.go.name).id).monster:performAction('riseFromWater') end,
},
{
class = "MonsterAction",
name = "riseFromWater",
animation = "riseFromWater",
},
},
}