Page 72 of 400

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 06, 2015 4:05 pm
by spectre900
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.

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 06, 2015 4:20 pm
by Zo Kath Ra
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.
You can use
MonsterComponent.onDie(self)

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 06, 2015 5:55 pm
by Isaac
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.
There are two power gem objects; use the other one via onDie.

Example script:

Code: Select all

crowern_1.monster:addConnector("onDie", self.go.id, "gemSpawn")

function gemSpawn(self)
	self.go:spawn("power_gem")
end

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 06, 2015 7:01 pm
by AndakRainor
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

Posted: Sat Jun 06, 2015 9:16 pm
by Isaac

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 },
		},
	},
}
It's the spell "causeFear".

Re: Ask a simple question, get a simple answer

Posted: Wed Jun 10, 2015 1:06 pm
by Leki
Guys... I'm not sure if this is a simple question...
Let me say, in object definition I have smth like:

Code: Select all

onBeginAction = function(self)
   self.go.animation:play("activate")
end
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]

Re: Ask a simple question, get a simple answer

Posted: Wed Jun 10, 2015 6:03 pm
by minmay
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.

Re: Ask a simple question, get a simple answer

Posted: Wed Jun 10, 2015 6:49 pm
by Leki
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.
m8, please...
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?

Re: Ask a simple question, get a simple answer

Posted: Wed Jun 10, 2015 7:41 pm
by minmay
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.

Re: Ask a simple question, get a simple answer

Posted: Wed Jun 10, 2015 7:50 pm
by Leki
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.
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".
smth like (it's error, oc):

Code: Select all

onBeginAction = function(self)
   self.go.animation("weapons"):play("moveForward")
end
:?:
[/color]