Page 1 of 1

Monster animation and movement : Strafe left & right

Posted: Fri Jan 01, 2016 11:38 pm
by Vandalar
Hello fellow modders,

Question : I want to force a monster to strafe left or right when I tell it to (by using a modified onThink hook, calling a fonction in a script entity). How can I accomplish that ?

Context : Me and one of my friend, created a new monster from scratch, modelling and animations. Almost everything works fine : moving forward, turning left and right, different attack animations. It's using the UggardianBrain with some modifications with the onThink hook.

The new monster is almost finished, but there is one thing I didn't manage to make it work : strafing left and right. I checked the others monsters definitions and while they do strafe in game, they only have the two animations definitions for "strafing" and nothing else, beside the MonsterMove component.

I checked the scripting reference (and JKos doc) for the MonsterMoveComponent and found setStrafeRightAnimation (or left) and setStrafeLeft, but I don't know how to use them properly. The first one take a string as an argument, but what string exactly ? The animation name ? The path of the animation ? I tried severals things, but I got an "invalid component" in the editor or "attempt to call a nil value".

Do I need to create two other MonsterMove components in my monster definition with the above method/property ?

The second one takes a boolean. Do I need to put this value at true at runtime when I want to force it to move ?

Code: Select all

animations = {
				idle = "mod_assets/animations/deathSkullIdle.fbx",
				moveForward = "mod_assets/animations/deathSkullMoveForward.fbx",
				strafeLeft = "mod_assets/animations/deathSkullStrafeLeft.fbx",
				strafeRight = "mod_assets/animations/deathSkullStrafeRight.fbx",
[...]
I tried to define another Move component, but as I mentionned, it didn't work out. Maybe I'm missing a property or not using the right one ?

Code: Select all

		{
			class = "MonsterMove",
			name = "strafeLeft",
			sound = "medusa_walk",
			cooldown = 0,
			animationSpeed = 1.6,
			strafeLeft=true,
			strafeLeftAnimation = "strafeLeft",
		},
Since the other MonsterMove component of the base campaign have one component, I'm obviously not on the right track.

Can someone shed some light ?

Thanks in advance,

Vand

Re: Monster animation and movement : Strafe left & right

Posted: Sat Jan 02, 2016 12:23 am
by minmay
You don't need to add extra components for strafing. The monster should do it automatically if you have strafeLeft and strafeRight animations. Perhaps your custom brain never actually strafes? The monster won't strafe if it's already performing another action, or if the square to strafe into is blocked.

Re: Monster animation and movement : Strafe left & right

Posted: Sat Jan 02, 2016 2:42 am
by Vandalar
Thanks for the info. I went back to check my custom brain, and I "face-palmed" myself. I noticed it didn't finish with a "false" (reference to Petri's post viewtopic.php?f=22&t=9919&p=95608&hilit ... ain#p95608), so it didn't go back to the built-in brain.

My monster now strafe left and right like it should, so I don't need to force it to strafe anymore.

Regards,

Vand

Re: Monster animation and movement : Strafe left & right

Posted: Sat Jan 02, 2016 1:04 pm
by kelly1111
Very interrested in seeing your monster in action !