Page 1 of 1

Animations and Timing

Posted: Sat Jan 14, 2006 3:06 pm
by Markman
At the moment i have a problem with Animations and Rotations in conjunction with stuff that need to be executet on a regular time basis.

I have a pawn, that should carry and start an "explosion" (in fact it's rather a light) regularly, like the flashing indicator on a car.

But every time i do a Rotation or a Animation, the effect runs "out of rhythm".

Is there any scripting style, so that you can let the animations finish, without interrupting the rest ?

Posted: Sat Jan 14, 2006 3:10 pm
by AndyCR
i honestly never got too deep into pawn scripting, so ill dodge the actual question, but i have an idea: if you cannot do this, you might simply make a second pawn which has the explosion, with the entityname and bonename fields filled in appropriately to attach it to the first entity, and in the attached entity simply have the flash script.

Posted: Sat Jan 14, 2006 3:50 pm
by Markman
That would be a Solution !

But I still have no clue what is going on in Low Level Orders, i mean the return 0; / return; / Return(); stuff...
I always read that the Orders would continue to loop (when they are not sealed with a return 0;) even if the Interpreter was sent to/ and executes another Order.
But I could not use / get that to work until now...

So i hope that there would be a possibility to let the Animations and Rotation finish, while the Interpreter jumps to another Order and do that in the main Pawn Script.

Posted: Sat Jan 14, 2006 4:27 pm
by AndyCR
i dont know, but as for the return stuff, if it works the same way it does in c++, it returns a variable, for instance, you could have an order named HasWeapon() that returns 1 if the enemy has a weapon and 0 if the enemy does not, then you could say in another function

if(HasWeapon() == 1)
{
NewOrder("Fire");
}

just as an example. there are probably errors, ive never tried to use return in rf scripting. i really need to use rf more...

to my knowledge orders do not continue to loop, thats why theres the restartorder() function, for instance:

Idle[ ()
{
PlayAnimation("Idle", true, "");
RestartOrder();
} ]

would constantly play that pawns idle animation.

sorry im not as knowledgeable about pawns as i should be, i just never got really deep into scripting them...

Posted: Thu Jan 26, 2006 5:52 pm
by Markman
It really looks like I always used a unessecessary ammount of return0;

It seems to be really only for sending back (returning) a value - and NOT make a jump back (returning) to the point where it came from.

Maybe from C64 times I must always think of GOSUB / RETURN...

Posted: Fri Jan 27, 2006 3:07 pm
by AndyCR
ah. forgot to add to the post, again, if it works the same way it does in c++, return can exit an order prematurely.

i've put off getting deeply into simkin for too long...