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 / Play one animation after another

Author
Message
007
13
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 26th Aug 2011 13:04 Edited at: 26th Aug 2011 16:40
Hello folks,

I am new to scripting and i am studying FPI Script through the official community guide. I really don`t like to be annoying asking all the time, i always prefer to search and try by myself, however, only when i stuck in something, it`s time to ask help.

I am having difficult to play an animation after another. I have an animated helicopter in 3dsmax, it has 100 frames of animation.

From frame 0 to frame 90 is the animation where the helicopter flies from the ground to a certain height, and from 90 to 100 is the "idle" animation (the blades are rotating) that i want to loop.

I exported it from 3dsmax to a X file, i opened the x file in fragmotion to check, and it`s perfect.

I am making it an animated dynamic object (not character) and this is the animation info from it`s fpe file:

;Animationinfo
animmax = 3
anim0 = 0,0
anim1 = 0,90
anim2 = 90,100

I tried several ways to make it animate the way i want, i tried, in example:

:state=0:animate=1,animate=2

It only played the first animation

Then i tried:

:state=0:animate=1,state=1
:state=1:animate=2

It only played the second animation

Then i tried:

:state=0:state=1,setframe=1
:state=1:incframe=1
:state=1,frameatend=1:animate=2

This almost worked, it played the first animation, an then played the second animation, however it did not looped the second animation, witch is what i want.

But there is another way i tried, also almost worked:

:state=0:etimerstart,animate=1,state=1
:state=1,etimergreater=9000:animate=2

This almost worked the way i want, however i could not find the correct "etimergreater", because i thought that 100 units of time in fpsc is equal a 1 frame of an animation, so as the way that my first animation has 90 frames (90 x 100 = 9000).

But also i tried another values from 100 until 9000, but did not work.

Please can someone help me?

Obs: If this may help i am attaching to this email the helicopter and the fpe and fpi files,

Thanks

Goldenye 007 N64

Attachments

Login to view attachments
Pirate Myke
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, Ca
Posted: 26th Aug 2011 22:38 Edited at: 26th Aug 2011 22:57
Give these ones a try and see if they help.
Download in download button.

I am no where close to a test machine. I will look at the X-file when I get home and test it also.


Attachments

Login to view attachments
007
13
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 26th Aug 2011 23:23
Thank you Pirate Myke, i will try and post the results

Goldenye 007 N64
007
13
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 27th Aug 2011 03:45
Thanks for your attention in help me, however, it did not work, now the helicopter stays freezed in the first frame of the second animation.

By the way, could you explain me, please, about the state variable (i always confuse in using this variable) that you used in the script:


;Triggers

:state=0:State=1
;Go up
:state=1:setframe=1,State=2
:state=2:incframe=1,state=3
:state=3,frameatend=1:state=10

WHY YOU JUMPED FROM STATE 3 TO STATE 10? Is that because the first animation (animate=1) has 10 frames, so you are considering that after 10 frames, it has run 10 states?

;Hoover
:state=10:animate=2,state=11
:state=10,etimergreater=20000:state=30

WHY YOU JUMPED FROM STATE 10 TO STATE 30, IS THAT BECAUSE YOU`RE CONSIDERING one second as one state, so after 20 seconds - etimergreater=20000- it goes 20 states?

;Send to destroy script after 20 secs (20000)
:state=30:runfpidefault=3,state=31


;end of script

By the way, really, the Oficial Community Guide is Very good, however, it only covers simple examples of fpi script, i mean, i could not find more complex examples in the guide. It would be very usefull to the community if those folks that are more experienced in fpi script could compile a more extensive guide teaching us on how to use fpi script and also provide some more complex examples and tutorials.

Thanks

Goldenye 007 N64
Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 27th Aug 2011 07:42
Does this work?



Tell me if it helps,
Akanto

| Windows 7 Home Premium 64 - Bit | AMD Athlon II X4 @ 2.8GHz | Nvidia GeForce GTX 460 1GB | 6GB DDR3 RAM | 1TB HDD |
007
13
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 27th Aug 2011 13:09
Akanto: Thanks for trying to help me, but unfortunately, it did not work, now the helicopter stays freezed, don`t play any animation.

I like a lot fpsc, it's a very good game engine, but those bugs frustrate me sometimes, i never thought that would be this hard to just make a model play one animation after another.

If anyone could put some shine in this, i would be very gratefull

Thanks

Goldenye 007 N64
007
13
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 27th Aug 2011 13:59
Dear folks,

I am almost done!

I found this thread:

http://forum.thegamecreators.com/?m=forum_view&t=181175&b=23

The same problem of mine,

So i tried this code:

:state=0:state=1

:state=1:animate=1,etimerstart,state=2

:state=2,etimergreater=2000:state=51

:state=51:setframe=2,incframe=2,state=52
:state=52,frameatend=2:animate=2,etimerstart,state=53

The helicopter does what i want, he plays the first animation, then he loops the second.

BUT THE PROBLEM IS THAT IT DOES NOT PLAY ALL FRAMES OF THE FIRST ANIMATION

I tried to put an greater value on "etimergreater" (2500, 2600, 3000), but none seem to work.

When i increase this value, the copter loops the first animation 4 or 5 times, then stops on the first frame of the second animation.

Any ideas?

Thanks!

Goldenye 007 N64
Pirate Myke
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, Ca
Posted: 27th Aug 2011 21:12 Edited at: 27th Aug 2011 21:19
Collision. Opened it in my test machine.

May I suggest an animation sequence for idle on the ground and maybe to descend. This is a great model.

The object is big in the map. You cant get within range of it to activate some stuff, so I used a appear no col script for the startup. That way I could at least walk under the blades.

In my map. I start looking at it in a 20 x 20 ground map. I changed the script to detect when the player is within 300 units from it.
It just sits there till I get within 300 units of its insert point (green dot), then it lifts, and hoovers

FPI file included new. Use any appear no collision script in the Start script.

The reason for the jump in state= numbers is just for seperation of tasks I would like the script to do. Also leaves room to add to a part without having to renumber all the state= lines.

I have things with a rem <;> in front of them explaining what I want that section to do. Check out the script I sent in download button. This one works.


Attachments

Login to view attachments
The Storyteller 01
15
Years of Service
User Offline
Joined: 11th May 2009
Location: On a silent hill in dead space
Posted: 27th Aug 2011 21:46 Edited at: 27th Aug 2011 21:48
I have written a "conversation-animation" script for ErrantAI's TF 341 characters.

It didn't look convincing ingame but at least the animations played one after the other without any fault.



I know I had problems too, but I don't remember which
But I DO remember that they where solved with the first line

which was an advice from ErrantAI himself afair.

PS: The timers in the scripts are not necessary, they are simply there to have the character display no animation at all for some seconds.

In case you find my grammar and spelling weird ---> native German speaker ^^
007
13
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 28th Aug 2011 04:27
Thanks friends!

I think i finally solved my problem, it is not perfect, however, it does what i wanted, play one animation after another.

As i said, i am learning FPS Creator, so for my learning purposes it` well enough.

Pirate Myke: I used your script, it`s good, but i even changed the plrdistwithin to a greater value, but however, it only works when i go close, almost when i touch the helicopter.

But as i said, it`s enough for me because i am not going to create a game by now. As far i understandood, when you are using an dynamic object, and it has multiple animations, you must use one condition like plrdistwithin, or activated, and such, i mean, the state variable itself is not enough.

As an example, an animated door (door use), if you see it only has one animation (0,30), however, in the fpi script it checks if you press enter, then play the animation of opening the door, and if pressed again, it will reverse the animation (decframe) to simulate the door closing.

But instead this, i tried a door with 2 animations, open and close, and i used incframe=0 (to open, because anim0 is the opening animation) and then i used incframe=1 (to close, because anim1 is the closing animation)

I dont know if you noted, but in FPSC if one object has multiple textures applied and embeded in the X file, the object must be set to dynamic, otherwise, the texture won

Goldenye 007 N64
Pirate Myke
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, Ca
Posted: 28th Aug 2011 12:28
Multiple textures have a couple of disadvanteges.

The first is the object has to be dynamic always.
The second is all the textures have to be in the same spot with the entity. ( not so bad)
he third and probably the most important is that you cannot use a shader on it at all.

Thus the reason for combining your textures into one map and UV unwrapping your model to texture the peices on the texture map.
Then it can be dynamic or static, and you can put a shader on it making it look even better then it is. BTW Nice model.


Login to post a reply

Server time is: 2024-11-24 06:05:31
Your offset time is: 2024-11-24 06:05:31