Forum

> > Stranded II > General > Setting Animations For Units
Forums overviewStranded II overviewGeneral overviewLog in to reply

English Setting Animations For Units

7 replies
To the start Previous 1 Next To the start

old Setting Animations For Units

Smurf
User Off Offline

Quote
I have animated an Orca in it has 30 frames of animation.I need to know how to assign the animations to work in Units script.I see for Shark ani_move=2,3,0.03
ani_die=4,5,0.01
ani_attack=2,3,0.05

Im guessing i need to set the numbers but I am not sure what they mean "ani_move=W,H,A,T"?

old Re: Setting Animations For Units

Psytechnic
User Off Offline

Quote
This information is available here but it's in German. Google translate suffices...

To help you more...

Unit animation is usually a running animation or loop, yet because S2 Units have multiple animations but only one can be saved to the file, you combine all animations in to one animation and use the definitions to specify...

For example:
Your Orca has 30 frames. Let's pretend the moving animation takes 12 frames, attack takes 8 frames and die takes 10 frames, you'd set the animations like this:
<ani_type>=<start frame>, <end frame>, <speed of play>
so in yours, we would put.
ani_move=0, 11, 0.5
ani_attack=12, 19, 1
ani_die=20, 29, 0.5
This is just an example.

A good idea is to make sure all animations start with the unit in the same position. It will look really odd it your unit suddenly jumps four feet forward to die.

If you've made the units yourself, you might have to fiddle with the speed value quite a bit to get the unit to move as you expected. I had an egg walking too slow and in reverse, made it look like it was moonwalking. :p

old Re: Setting Animations For Units

Smurf
User Off Offline

Quote
How do you use these commands from Blitz 3d to animate a model on_use or what ever to play animation here they are.

LoadAnimSeq ( entity,filename$ )
SetAnimKey entity,frame[,pos_key][,rot_key][,scale_key]
AddAnimSeq ( entity,length)
Animate entity,[,mode][,speed#][,sequence][,transition#]
AnimLength ( entity )
AnimTime# ( entity )
Animating ( entity )

The point is im sure with these commands,you can load animations for any model,at any time.I think Bananaman knows how to use them so please post a script of "how to play animation" on_use.

old Re: Setting Animations For Units

DC
Admin Off Offline

Quote
there are two commands for this in stranded II:
s2 cmd loadani
s2 cmd animate

loadani unit-TYPE(id), startframe, endframe
this has to be executed BEFORE you actually create the unit. it's recommended to execute it in the on:preload event.

afterwards use animate to actually play or stop the animation:

animate unit-ID, startframe, endframe, speed, mode

mode can be:
0 - just stop the animation (other parameters do not matter anymore in this case)
1 - loop
2 - play forth and back
3 - just play

old Re: Setting Animations For Units

Smurf
User Off Offline

Quote
Thank you.Please what is wrong with ,this "loadani","animate",on_use script?.It doesn't play animation

### Orca
id=500
name=Orca
group=animal
icon=gfx\shark.bmp
model=gfx\Orca.b3d
scale=7
colxr=50
colyr=20
behaviour=watercraft
health=80
speed=2
turnspeed=1
damage=150
ani_move=1,30,0.50
loot=9,3
loot=94,10
script=start

on:preload {
loadani 500,1,30;}

on:use {
animate 500,1,30,50,1;}

}

script=end

old Re: Setting Animations For Units

DC
Admin Off Offline

Quote
the command "animate" expects the ID of a specific unit on your map - not the unit type. these are two different values.

replacing the 500 in your on:use event with currentid() [or the id of the unit] should do the job.

old Useing Key Commands

Smurf
User Off Offline

Quote
Excellent ,I have animation working now "on_use".Now my problem is
I need animation to play on:hitkey or on:holdkey,The Key I will use is "Z" for this question,as in the key list in "sys/keys.inf" says key 21=Z.

I have

on:keyhit21 {
animate currentid(),2,26,10,1;

I realise there must be more to this please help.

old Re: Setting Animations For Units

DC
Admin Off Offline

Quote
they key system does not work this way. you can't check every random key. you can only check keys which are defined in game.inf with the line

scriptkey=ID,Name

ID is just a random value from 0 to 20 and name a name which will be displayed in the options menu.

you then have to go to the options menu in-game and assign a key to it.

THEN you can trigger the related events with the ID (always 2 digits) specified in game.inf

for example:
if you took id 1 then
on:keyhit01 { ... }

or 20:
on:keyhit20 { ... }
To the start Previous 1 Next To the start
Log in to replyGeneral overviewStranded II overviewForums overview