Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Looping animation

Author
Message
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 15th May 2006 14:09
I have a character that I want to play an idle animation - then when the player gets withing range to change to another animation set and play an animation once only before returning to the idle animation. All while the player is basically in the close proximity.

The character could return back to the idle animation after the player has moved away but I dont want the secondary animation to continue looping while the player is still close to and looking directly at the character - currently I am having difficulty in stopping that sceondary or middle sequence animation from stopping at its last frame before the character returns to idle. I cant get both to happen one following another - only one or the other and have to move out of close proximity before switching back to idle to get it to work.

While in close proximity say set at 75 when the character switches from idle to the offending animation it continues to play.

What I need when the player is within 75 is a sequence of : play specified animation frames then stop and return to idle animation all within that plr distance range.

Anyone with experience of this have any suggestion how best to achieve this. Seems to be a simple operation but obviously not quite so.

I guess what I am looking at is something like that which happens when an enemy shoots at the player then has to switch to a reload animation before shooting at the player again? all within the same range?

If no one knows whats needed to be done I will try and see if I can work around that idea.

Thanks for any help.

xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 15th May 2006 18:07
What you need is a nested loop. I'm not that good with the .fpi scripting language, but I understand it is similar to VB.

Once the 2nd animation plays, send the execution path outside the main loop, which if I understand correctly in .fpi would be as simple as changing the "state=" to a higher number.

The new path would just have to be a repeat of the first animation with higher state numbers.

I hope I made sense.

Crazy Grandpa
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 15th May 2006 18:30 Edited at: 15th May 2006 18:30
I understand that and tried it - of course - it does not work correctly as a timer function or some other is also needed. Whats happening is the character is moving on to the third state or second idle state before enough time has passed for him to complete the middle sequence, so that he moves on to idle again before I want him to.

What I need I guess is a command which will allow him to play that sequence until I need him to stop that animation before moving on back to idle. Its not happening and I am getting either one or the other taking control of both.

I will continue to try various timer functions also - but it seems the proximity setting is overiding with me currently and is dominating which sequence plays - not allowing either/and/or to play whilst the player is within the same proximity.

xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 15th May 2006 18:45 Edited at: 15th May 2006 18:46
Again, forgive my ignorance of the scripting language.

Perhaps the "ANIMATIONOVER" condition can be used in the loop to keep it from jumping forward before it has played through completely.

Crazy Grandpa
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 15th May 2006 19:17 Edited at: 15th May 2006 19:18
xplosys,

Your input is most valued.

Though I manage myself to get around most problems - I am no expert myself and this particular problem should not be one as I see it.

Actually I am also trying to get a sound to play during the animation I want to hold on between the idle stages so I need some kind of timer function I guess as I just need my animation to play while the sound does - and then the animation move on to idle and the timer function usually does it between states - not sure what I am doing wrong this time.

I must have it set up wrong though I seem to be doing what I usually do when it works and I have tried many variations again this time thus far with no luck.

I will probably crack it in the end if it can be done when I have enough time - but sometimes a user with an answer can hit the nail on the head when I cant see the tree for the woods and save a massive amount of headaches.

There problem I see is often found in scripting of characters in that one cant get a character to easily do two things under the same set of crietria. One state has to end before another can be called - but I just cant seem to stop the one at the end of the sound playing and get the other to follow on correctly.

Basically whats happening is if I stop the needed animation - Its stopped altogether - or not - cant seem to get it to play and stop when needed. Well you understand that of course.

Anyway thanks for your help - I will keep trying.

The only script situations I have not been able beat yet are concerned with engine restrictions related to physics and gravity, but thats another story and one which cant be overcome. I am sure this can and I am just not thinking to well.

uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 15th May 2006 21:03 Edited at: 15th May 2006 21:48
Heres the code with some stuff which is not working stripped out so you can see what I am talking about :

Code :

;Artificial Intelligence Script

;Header

desc = West1 Tropper1


;Triggers

:state=0,random=20:rotateheadrandom=65
:state=0,shotdamage=10:settarget,rotatetotarget,resethead,rotatetoplr
:state=0,noiseheard=50:settarget,rotatetotarget,resethead,rotatetoplr
:state=0,plrcanbeseen=200:settarget,rotatetotarget,resethead,rotatetoplr,state=1

:state=1,random=20:rotateheadrandom=65
:state=1,shotdamage=10:settarget,rotatetotarget,resethead,rotatetoplr
:state=1,noiseheard=50:settarget,rotatetotarget,resethead,rotatetoplr
:state=1,plrcanbeseen=200:settarget,rotatetotarget,
:state=1,plrdistwithin=200:rotatetoplr
:state=1,plrdistwithin=75:settarget,animate=3,rotatetoplr,sound=audiobank\user\people\goin.ogg,state=2

:state=2,plrdistfurther=1100:settartget,destroy
:state=2,random=20:rotateheadrandom=65
:state=2,shotdamage=10:settarget,rotatetotarget,resethead,rotatetoplr
:state=2,noiseheard=50:settarget,rotatetotarget,resethead,rotatetoplr
:state=2,plrcanbeseen=200:settarget,rotatetotarget
:state=2,plrdistwithin=200:rotatetoplr

;End of Script

*************

Character animations are not default as he has my own animation sets.

State 0 is OK character at idle - animate=1.

State 1 Character should animate and play sound (talk to player) - animate=3 and sound all is OK

Now characeter goes to State 2 and as the script is - he continues to play animate=3 (no sound of course) which is not what I want.

If I insert an animate=1 (idle) command in State 2 then the prevoius State 1 animation becomes animate=1 too ignoring the animate=3 command playing the sound but going straight to the next State 2 and showing the animate=1 animation set.

What I need do is get state 1 to play animate=3 whilst the sound plays once the sound has finished it should move to state 2 immediately end animate=3 command and play animate=1. Which I have not yet been able to achieve and still have state 1 behave correctly.

I have tried now stipped out timer function in state 1 and commands such as setframe=(myendframe) and various other conmmands before moving to state 2 with no success

Hope someone can make sense perhaps of what I am trying to achieve and provide some help.

Thanks

xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 15th May 2006 21:38
Quote: "he continues to play animate=3 (no sound of course) which is not what I want."



:state=1,plrdistwithin=75:settarget,animate=3,rotatetoplr,sound=audiobankuserpeople goin.ogg,state=2

I'm not sure if this is where it goes wrong, but your sound file does not appear to be correct. If so, it is ignoring the remainder of the line.

Crazy Grandpa
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 15th May 2006 21:58
xplosys,

Sorry that was just my mistake in copying across the code from script from one computer to another - saving it as an .rtf and then cutting and pasting here. The code had wrapped and I must have messed it up in transfer. Slap my wrists - Eh!

I should have checked it more carefully after pasting here or perhaps attached a copy of the script file.

I do applogise - I have corrected it on page here as is in script and the sound file is indeed correctly referenced as you will see. I dont get a prob playing the sound file or any of the animations - only when they actually play. Everything works fine except at the wrong time.

Thanks for spotting that though.

xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 15th May 2006 22:05
I think you need someone like Conjured on this one. Good luck.

Crazy Grandpa
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 15th May 2006 22:10
Thanks

I'll probably need it.

Login to post a reply

Server time is: 2024-11-22 09:03:55
Your offset time is: 2024-11-22 09:03:55