Re: [ASSET] - Surprise by Leki
Posted: Thu Jan 23, 2014 2:54 pm
Do you have the same result if onDie refers to an ingame script with object as parameter ?
Official Legend of Grimrock Forums
http://mail.grimrock.net/forum/
Code: Select all
defineObject{
name = "dm_bigmushrooms",
class = "Blockage",
model = "mod_assets/dmcsb_pack/models/env/dm_floordeco_bigmushrooms.fbx",
brokenModel = "mod_assets/dmcsb_pack/models/env/dm_bigmushrooms_broken.fbx",
placement = "floor",
health = 15,
evasion = -1000,
hitSound = "dm_chop",
hitEffect = "hit_goo",
editorIcon = 56,
onDie = function(self)
playSound("dm_bumper")
slices = math.random(1,3)
for i = 1,slices do
spawn("dm_mushroom_slice", self.level, self.x, self.y, i%4)
end
end,
}lexdr wrote:Do you have the same result if onDie refers to an ingame script with object as parameter ?
"dm_mushroom_slice" is an item I guess, so it works, but I need to spawn a monster - which shows warrning that monster is in invalid location. The strange thing is that with print(findEntity(....)) in onDie function you cannot see spawned monster in the cell, but the monster is there and works without problem.Dr.Disaster wrote:This is germanny's big mushroom definition.
When the big mushroom is destroyed by the party it leaves it with some mushroom slices.Maybe just replacing your "coffin" with "self" does the trick.Code: Select all
defineObject{ name = "dm_bigmushrooms", class = "Blockage", model = "mod_assets/dmcsb_pack/models/env/dm_floordeco_bigmushrooms.fbx", brokenModel = "mod_assets/dmcsb_pack/models/env/dm_bigmushrooms_broken.fbx", placement = "floor", health = 15, evasion = -1000, hitSound = "dm_chop", hitEffect = "hit_goo", editorIcon = 56, onDie = function(self) playSound("dm_bumper") slices = math.random(1,3) for i = 1,slices do spawn("dm_mushroom_slice", self.level, self.x, self.y, i%4) end end, }
Diarmuid wrote:Probably destroy and spawn might need to be on two different frames?Dr.Disaster wrote:Seems right to me. Maybe something wrong in the coffin definition so the game thinks it's not a blockage?
Yeah, an object cannot be destroyed from it's own hook - same if you try to destroy for example a pressure plate from it's activate call.Leki wrote:Diarmuid wrote:Probably destroy and spawn might need to be on two different frames?Dr.Disaster wrote:Seems right to me. Maybe something wrong in the coffin definition so the game thinks it's not a blockage?
Maybe - can you show me? Because I got crash calling func outside onDie frame...
Code: Select all
defineObject{
name = "dm_coffin_recess",
class = "Blockage",
model = "mod_assets/dmcsb_pack/models/env/dm_coffin_recess.fbx",
brokenModel = "mod_assets/dmcsb_pack/models/env/dm_coffin_recess_broken.fbx",
placement = "floor",
health = 20,
evasion = -1000,
hitSound = "dm_chop",
hitEffect = "hit_wood",
editorIcon = 56,
onDie = function(self)
party:shakeCamera(0.05,0.05)
playSound("dm_woodbreak")
spawn("snail",self.level,self.x,self.y,self.facing)
end,
}