Playing different animations

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
vieuxchat
Posts: 48
Joined: Wed Mar 02, 2016 3:14 pm

Playing different animations

Post by vieuxchat »

I'd like that my elemental snake to do a full spin on itself before throwing its trap (a bomb-like object that transofrms itsel fin a trap when it hits something).
But I have absolutely no animation skill.
So, the idea is to play "turn left" animation 4 times before throwing the trap. (it would let the player a bit of time to know that he/she must dodge the incoming attack).

My question is : is there a way to put several animations on a queue when using the MonsterAttackComponent (it seem there's an "animations" field but I don't know the syntax to use it and I'm not sure it would do what I want)
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Playing different animations

Post by zimberzimber »

You could add delayed calls to force the turn action to an external script entity, and have the snake call it once the attack starts, and have the last delayed call force the snake to attack. But the animation cycle here won't be as smooth, or may get cut in the middle, because the snake will not perform an action if it didn't finish its previous one.

Or you could add a local counter to the brain, and have the onThink function execute an action based on that counter.
Crude example:

Code: Select all

local c = 0

if c == 1 then
  do 'x'
  c = c + 1
elseif c == 2 then
  do 'y'
  c = c + 1
else
  do 'z'
  c = 0
end
My asset pack [v1.10]
Features a bit of everything! :D
Post Reply