You can usespectre900 wrote:Maybe I'm a bit dumb but I don't understand how spawn scrips work. Say I want to spawn a power gem when an enemy ogre called "burt" is killed on say... "level 0,1,3" on the same tile burt died, how do I do that?
I can just add a power_gem_item to drop on death, but that's hardy as good looking as having a grab-able power_gem object do its swirly animation as it spawns.
There are two power gem objects; use the other one via onDie.spectre900 wrote:Maybe I'm a bit dumb but I don't understand how spawn scrips work. Say I want to spawn a power gem when an enemy ogre called "burt" is killed on say... "level 0,1,3" on the same tile burt died, how do I do that?
I can just add a power_gem_item to drop on death, but that's hardy as good looking as having a grab-able power_gem object do its swirly animation as it spawns.
Code: Select all
crowern_1.monster:addConnector("onDie", self.go.id, "gemSpawn")
function gemSpawn(self)
self.go:spawn("power_gem")
end
Code: Select all
defineObject{
name = "wand_fear",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/staff_of_fear.fbx",
},
{
class = "Item",
uiName = "Wand of Fear",
description = "This wand will strike fear to the hearts of your enemies.",
gfxIndex = 225,
gfxIndexPowerAttack = 443,
impactSound = "impact_blunt",
weight = 3.5,
secondaryAction = "causeFear",
},
{
class = "MeleeAttack",
attackPower = 7,
accuracy = 0,
cooldown = 3,
swipe = "vertical",
},
{
class = "CastSpell",
name = "causeFear",
uiName = "Cloud of Nightmares",
spell = "cause_fear",
energyCost = 30,
cooldown = 5,
requirements = { "concentration", 2 },
},
},
}
Code: Select all
onBeginAction = function(self)
self.go.animation:play("activate")
end
m8, please...minmay wrote:It's like the simplest question that's been posted so far. AnimationComponent has a "model" field that specifies the name of the ModelComponent to animate.
Sure, I described it in short way - the problem is that "Monster" logic uses only one animation component, not both (or better to say all of them, if you have more models and "animations" for them) of them as far I see. So I'm looking for solution to "call them directly / or by name".minmay wrote:Use two AnimationComponents with different names, one AnimationComponent for each model you need to animate. If you try to add two components with the same name then the second one will overwrite the first.
Code: Select all
onBeginAction = function(self)
self.go.animation("weapons"):play("moveForward")
end