character animation question (solved)

Started by myname, Thu 30/11/2006 19:31:28

Previous topic - Next topic

myname

I have read that the default idle delay for a character is 20 seconds so I assume that is why my characters do not start their animation view loops until they are present on screen for 20 seconds but they repeat the 20 second delay every time the loop starts over.Ã,  I know there is a way to change this so the animation is smooth and fluid as soon as the player enters the room but I have not been able to find any info on this and tinkering with the animation speeds and delays do nothing to help.Ã,  If my problem is confusing this is basically what happens when the player enters a room with character "Jasper"-Jasper looks to the left for 20 sec then moves down for 1 sec then looks back to left for 20 sec etc....Ã,  The character is supposed to look left for 1 sec then down for 1 sec then left for 1 sec etc...Ã,  Any help would be greatly appreciated.Ã,  Thankyou


myname

Thanks for your reply and help but I still am having the same problem.  This is what I have for the character's properties-
character[JASPER].SetIdleView(2, 1); Boolean default 1
Along with-
No thinking, speech, or blinking view
animation speed 4

Sorry for my ignorance on this subject, I'm sure the answer is right in front of me I just am not seeing it.

Ashen

So, what's wrong with it at the moment? The code KhrisMUC gave will set the Idle view to run once a second.
However, it sounds like you maybe don't want the Idle view at all. If I understand the question, you want Jasper to turn every second, not animate as such. You could try using a Timer to achieve the delay here, something like:
Code: ags

// In the 'Player enters room' interaction
SetTimer(1, 40);
// 40 is the default number of game loops per second. 'GetGameSpeed()' might be more accurate.


And:
Code: ags

// In the Room repeatedly_execute function
if (IsTimerExpired(1)) {
  if (cJasper.Loop == 0) cJasper.Loop = 1;
  else if (cJasper.Loop == 1) cJasper.Loop = 0;
    // If Jasper is facing down, make him face left.
    // If he's facing left, make him face down
  SetTimer(1, 40);
    // Reset the timer for the next second
}


This won't interfere with the idle animation, if you ARE using that - Jasper will still animate at the set delay, while (hopefully) facing the right direction.
I know what you're thinking ... Don't think that.

myname

I'm sorry I dont think I stated my problem that clearly.  As the player enters the room there is a NPC mopping the floor (Jasper).  This NPC is to be constantly mopping or having his veiw looped between 2 sprites that create him to make a forward and back motion with the mop.  The problem is the delay that occurs with the initial sprite in the loop.  After the 20 sec delay it moves to sprite 2 and then quickly back to sprite 1 for another 20 sec and so on.  I just want a constant loop with no delay or a 1 sec delay at the most.  If it is too much to explain dont worry about it, I am very new at the program and programming in general and I am surprised I have been able to figure a lot of things out formy self with trail and error but this problem is notone of them.  So I hope this helps you understand my problem Ashen and thankyou for posting.

Ashen

So, you don't want a delay AT ALL if it can be helped?

Did you read the manual entry Khris linked (or have you read the BFAQ)? Setting the idle delay to 0 will make Jasper animate constantly.
Or, you could alter the code I gave you to use the Character.Animate command, instead of just changing the loop. (Pay particular attention to the RepeateStyle parameter, since you want a continuous loop).
I know what you're thinking ... Don't think that.

myname

#6
I dont know man I have done all the scripting suggested along with different variations of them and still nothing changes.   I put this into the character properties, is there something srong with what I wrote?

character[JASPER].LockView(2);character[JASPER].Animate(0, 0, eREPEAT);

And thankyou for helping Ashen.

Ashen

Please don't double post, use the 'Modify' button to edit your post.

What's the problem with the code you've got - what's it doing wrong?
There exactly is that code? It'll probably need to be in the 'Player enters room' interaction for the room Jasper is in and also - if you're using my example - in the 'repeatedly executed' interaction.

Aside from that, there's a capitalisation problem - AGS is case-sensitive, so it needs to be eRepeat, not eREPEAT (unless that's just how you typed it here, and it's OK in-game). And, you'll probably need to do somethign to change the Loop occasioanlly - that will only repeat loop 0 (down) of the current view.

And you're welcome.
I know what you're thinking ... Don't think that.

myname

OK I placed the code into room interactions script for when the player enters the room but now, ha, the player can not do anything while the NPC is looping and since its on eRepeat it stays that way.  Is there a way I can have the NPC animation looping while having the player be able to move and act freely like before?

Ashen

Re-Read the manual:
Quote
For blocking you can pass either eBlock (in which case the function will wait for the animation to finish before returning), or eNoBlock (in which case the animation will start to play, but your script will continue). The default is eBlock.

Because you haven't said otherwise, it's running it as a blocking animation - nothing else can be done until it's over and as you said, because it's on repeat it's NEVER over. Adding the eNoBlock parameter will change that:
Code: ags

cJasper.Animate(cJasper.Loop, 0, eRepeat, eNoBlock);
// Or however you're setting the Loop to use
I know what you're thinking ... Don't think that.

myname

Wow thanks Ashen.  It works great and I will read the manual more carefully in the future.  Thanks again.

SMF spam blocked by CleanTalk