Re: Ask a simple question, get a simple answer
Posted: Sun Sep 25, 2016 6:29 pm
FloorTriggerComponent automatically looks for a component called "animation" and if it finds one, it will treat it as an AnimationComponent and try to play its "activate" and "deactivate" animations when the FloorTriggerComponent is activated and deactivated. You're getting the error because you don't have a "deactivate" animation defined in the AnimationComponent.
As it is, the easiest fix is to rename the AnimationComponent, like this:
As it is, the easiest fix is to rename the AnimationComponent, like this:
Code: Select all
defineObject{
name = "floor_spike_trap_auto",
baseObject = "base_floor_decoration",
components = {
{
class = "Model",
model = "assets/models/env/tomb_floor_spiketrap.fbx",
},
{
class = "FloorTrigger",
onActivate = function(self)
self.go.biscuits:play("activate")
self.go.tiledamager:enable()
end,
},
{
class = "Animation",
name = "biscuits",
animations = {
activate = "assets/animations/env/tomb_floor_spiketrap_hit.fbx",
},
},
{
class = "TileDamager",
attackPower = 50,
damageType = "physical", -- TODO: change to "pure"
screenEffect = "damage_screen",
cameraShake = true,
sound = "spike_trap",
floorTrap = true,
enabled = false,
onHitObstacle = function(self, obstacle)
if obstacle.go.name == "beach_thicket_01" then return false end
end,
onHitMonster = function(self, monster)
if monster.go.name == "air_elemental" then return false end
end,
},
{
class = "Controller",
onActivate = function(self)
self.go.biscuits:play("activate")
self.go.tiledamager:enable()
end,
},
},
editorIcon = 284,
}