I have this object :
Code: Select all
defineObject{
name = "invisible_blocker_break",
class = "Blockage",
model = "mod_assets/models/env/null.fbx",
brokenModel = "mod_assets/models/env/null.fbx",
placement = "floor",
health = 999999,
evasion = -1000,
hitSound = "barrel_hit",
hitEffect = "hit_wood",
editorIcon = 56,
onDamage = function (self,damage,damageType)
return damage
end,
}Code: Select all
health = 20
if blockage_door_1:onDamage() then
DamageDoor()
end
function DamageDoor()
health = health - blockage_door_1:onDamage()
if health <= 0 then
print("door is break")
end
endIf I run this, I have the error :
Code: Select all
if blockage_door_1:onDamage() then attempt to call method 'onDamage' (a nil value)