Ask a simple question, get a simple answer
- spectre900
- Posts: 124
- Joined: Fri Sep 14, 2012 1:47 am
Re: Ask a simple question, get a simple answer
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.
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.
- Zo Kath Ra
- Posts: 937
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
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.
MonsterComponent.onDie(self)
Re: Ask a simple question, get a simple answer
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.
Example script:
Code: Select all
crowern_1.monster:addConnector("onDie", self.go.id, "gemSpawn")
function gemSpawn(self)
self.go:spawn("power_gem")
end
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
Is there a list of monster conditions available somewhere ? I am trying to get the same effect as the "Wand of Fear" item.
Re: Ask a simple question, get a simple answer
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 },
},
},
}
Re: Ask a simple question, get a simple answer
Guys... I'm not sure if this is a simple question...
Let me say, in object definition I have smth like:
But what if I have more model components (main is without name, rest has defined smth like name = "part_a" etc), how to call animation for specific one? I have some dirty solution, to achieve what I want, but you know me... I wanna an elegant one and this method is probably what I looking for.[/color]
Let me say, in object definition I have smth like:
Code: Select all
onBeginAction = function(self)
self.go.animation:play("activate")
end
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: Ask a simple question, get a simple answer
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
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.
I have to be more specific as I see. Here is the situation:
monster has model component (without name definition - it's, let me say body - includes meshName "smth" - this is defined in monster component later) and model component (name = "weapons")
monster has animation component. if there is not model = "xxxx" defined, when it moves, body is animated, but "weapons" part of model is not. "weapons" will jump to next cell in next frame 0. Adding model = "weapons" into anim comp animetes weapons but body jumps. There is not a way to animate them both with one animation as far I see (I need the name in models to switch of/on different weapons - onActivate script setups gear for the monster etc... so complex behaviour to explain it here)
If you have more animation components, latest one counts, rest is overwritten as far I see.
So I can use onBegin hook to call animation for second model and play them in sychro in some way (if I can call animation for specific part - adding dynamically name into anim component or smth like that), or to use some other solution I have - like spawning weapons as different animated object and controll it from monster script etc...
So any idea how to call animation for specific model in game object, when part of it is already controlled by animation component?
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: Ask a simple question, get a simple answer
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
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.
smth like (it's error, oc):
Code: Select all
onBeginAction = function(self)
self.go.animation("weapons"):play("moveForward")
end
[/color]
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore