i have a character that needs to be continously animating (she has snakes for hair). now when i make an idle animation it only plays for a lil while..then goes back to static frame. then repeats like 20 sec later. i made the animation long..its 56 frames right now..and thats not working to make it continous. any clues?
as soon as she stops walking she should have her hair writhing around.
Not sure if this it as I'm new at this ..
AnimateCharacter
AnimateCharacter (CHARID, int loop, int delay, int repeat)
Starts the character named CHARID animating, using loop number LOOP of his current view. The overall speed of the animation is set with DELAY, where 0 is the fastest, and increasing numbers mean slower. The delay for each frame is worked out as DELAY + FRAME SPD, so the individual frame speeds are relative to this overall speed.
The REPEAT parameter sets whether the animation will continuously repeat the cycling through the frames. If REPEAT is zero, the animation will start from the first frame of LOOP, and go through each frame in turn until the last frame, where it will stop. If REPEAT is 1, when the last frame is reached, it will go back to the first frame and start over again with the animation.
If the character is moving it will be stopped.
Example:
AnimateCharacter(EGO,3,0,0);
will animate the character using loop number 3 of his current view only once.
found it under the help file with "AnimateCharacter"
SetCharacterIdle
I'm in Iraq and I dont remember the exact number of perameters... but the time should be set to 0, then the chracter will immedately go into its idle view when stopped...
thankyou to both of you! i used SetCharacterIdle, worked perfectly.
Great thing to add to the Beginners' FAQ, thanks guys.
Is there a way of having the idle animation continuously loop, and still have a delay of inactivity before the animation begins?
I think you'd have to script it manually, something like:
//At top of global script:
int idlewait = 1;
// Then, in repeatedly_execute:
if (cEgo.View == cEgo.IdleView && idlewait == 1) {
cEgo.SetIdleView(2, 0); // or whatever view
idlewait = 0;
}
else if (cEgo.View != cEgo.IdleView && idlewait == 0) {
cEgo.SetIdleView(2, 10); // or whatever view/delay
idlewait = 1;
}
To have it for other characters - I guess you could to make idlewait an array, and have a set of if .. else if conditions for each character. (Or maybe use a while loop, to check against all Character.IDs.)
This doesn't seem to work. Now after 20 seconds the character changes to the coffee cup for 4 seconds then it goes back. The idle view is correct, so I can't figure out why this happens.
Sorry, I figured out why I get the coffee cup. But still, I only get the idle view for one loop and then it stops.
EDIT: I got it now. Thanks.
What was the problem (and solution, obviously)? For anyone else who might want to dig up this thread in another year-and-a-half.
I accidentally put this code:
// Then, in repeatedly_execute:
if (cEgo.View == cEgo.IdleView && idlewait == 1) {
cEgo.SetIdleView(2, 0); // or whatever view
idlewait = 0;
}
else if (cEgo.View != cEgo.IdleView && idlewait == 0) {
cEgo.SetIdleView(2, 10); // or whatever view/delay
idlewait = 1;
}
in the wrong place. When I realized it and put it in the repeatedly execute part of the Global script it worked.
Now another question. When the idle animation starts, it will end when the character walks. But when the character does any other interaction (like walk somwhere when you interact with an object) it continues immediately after.
How can you make the idle view start again after a delay after an interaction?
OK, so apparently it doesn't update during those interactions ... I'd guess they involve a blocking action (e.g. a blocking walk, or a Character.Say or Display command)? Meaning rep_ex doesn't run. Sorry, didn't think about that.
You could either move the code to repeatedly_execute_always which will run during blocking commands (you'll have to create it yourself, if you haven't already), or perhaps copy the cEgo.SetIdleView(2, 10); idlewait = 1; part into on_mouse_click - which'll reset it everytime you click a mouse button, where ever it is on screen (you could limit it to just the left button though, obviously). Personally, I'd recommend rep_ex_always.
Perfect! I used your repeatedly_execute_always idea and it works like a charm.
Thanks!