OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: macguba on 08 Jul 2004, 18:13:27

Title: animation demo problems and solutions
Post by: macguba on 08 Jul 2004, 18:13:27
What's wrong with this script?    I suspect the problem is the line in bold but for the life of me I can't see what's wrong.    The animations don't play and the titletext comes up with "_anim" every time, rather than the name of the animation concerned.    The loons do animate when I put an animation in by hand.

Many thanks


; this script plays animations

_animArray = ["EffectStandSalute", "Crouch", "CrouchB", "CrouchDying",  "CrouchToCombat"]
_unitList = [loon1, loon2]
_i=0

#loop

_anim=_animArray select _i

titletext [format ["%1", {_anim}],"plain down",1]

"_x switchMove {_anim}" forEach _unitList
"_x playMove {_anim}" forEach _unitList

~4

"_x playMove {null}" forEach _unitList
"_x switchMove {null}" forEach _unitList

_i=_i+1

? _i >= (count _animArray) + 1: goto "end"

goto "loop"

#end
hint "That's all folks"
~3
exit
Title: Re:can't see wood for trees
Post by: Artak on 08 Jul 2004, 18:51:24
Hey mac,

Try
titletext [format ["%1", _anim],"plain down",1]
instead of
titletext [format ["%1", {_anim}],"plain down",1]

and

Try
"_x switchMove _anim" forEach _unitList
instead of
"_x switchMove {_anim}" forEach _unitList
and
"_x playMove _anim" forEach _unitList
instead of
"_x playMove {_anim}" forEach _unitList
Title: Re:can't see wood for trees
Post by: Blanco on 08 Jul 2004, 19:15:54
I tried something similar (but I did it with randomly choosen  anims from the _animlist) and I've noticed that you have to run such a script in a waypoint. Maybe that's the problem.

Title: Re:can't see wood for trees
Post by: macguba on 08 Jul 2004, 19:32:57
Ah, of course, thanks Artak.  I had of course tried that earlier, but that was when there were no quotes in the original array ..... duh.

Blanco, I'm running if from a trigger and it seems to be working .... not quite finished yet though.
Title: Re:can't see wood for trees
Post by: macguba on 08 Jul 2004, 21:47:34
Would I be right in thinking that there is a maximum number of elements allowed in an array?   If so, what is it?

This wretched script works sometimes, and sometimes it doesn't.    I can't find the error and I suspect it may just be because the array is too big.   Thoughts?

I can't see the error message because it refers to the array, which has a whole bunch more animations than in the example above and is consequently far too long.    Is there an error log or something somewhere where you can see a long error message?
Title: Re:can't see wood for trees
Post by: macguba on 08 Jul 2004, 22:47:50
Well I've split it into two arrays and made it work.     Finished version on the beta forum:   yes folks this is what you've all been waiting for, a wee demo mission (http://www.ofpec.com/yabbse/index.php?board=23;action=display;threadid=18370) that shows all official animations.    (Except vehicle crew ones.)
Title: Re:animation demo problems and solutions
Post by: Dubieman on 09 Jul 2004, 00:30:57
So is this a script now or a mission or just a mission showcasing all the animations?

Like my topic below this one, I wanted to make my guards more interesting by having them look like they are talking and looking around.

And if it is a script, can I change it to fit a certain slew of animations? Like I don't want my guard to be doing some dismay moves which look pretty odd. :P

Sorry for 20 Q's but your script if it is one makes mine obsolete and possibly make my mission better.  :)
Title: Re:animation demo problems and solutions
Post by: macguba on 09 Jul 2004, 01:20:32
It's a demo mission just showcasing the anims - follow the link in my last post to the beta testing board.    The mission obviously uses the script, if you'd like to unpbo the final version and adapt it for your own mission that's fine with me as long as you mention where you got it from.
Title: Re:animation demo problems and solutions
Post by: Dubieman on 09 Jul 2004, 01:42:49
Okay. I dunno if I can use it though. You already replied to my post, but you know I can't have the guards doing animation while the player is sneaking around. I'm using your animation list and I'll use your mission to get a good hold of what the animations look like. And you'll get creditted. ;)