Mission Coding for Dummies - Animations

A Tutorial for Grand Theft Auto: San Andreas

Yo, buddy. We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Arman Ossi Loko points.
  • Post: Give Arman Ossi Loko your thoughts on this Tutorial.
  • Vote: Help Arman Ossi Loko win the Monthly Awards.
  • Rate: Give this Tutorial a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Tutorial.
  • Watch: Get notified when this Tutorial is updated.
Mascot

Interested?

Sign up

Already a Bananite? Login

Actor Animations and Animation Paths Introduction You can assign all kind of animations to actors, just to make the mission more amusing. You have to know two things about the animations: the name of the animation and the name of de IFP-file that contains the animation. You can find a list of it here. The bold and large words are the names of the IFP-file, then the animation names inside that IFP-file will follow. For example, if you want that your actor dances, you have to look in the list and you will find the IFP-file "DANCING". That file contains all kind of animations, in this tutorial we will use "dnce_M_a". Of course you can give the actor also other animations, but please note: I can't guarantee that all of these animations will work! First we will create an actor, which has to perform the animation. When you worked through the other tutorials of this topic, this won't need any explanation. If you don't understand it, please go back to the tutorial about actors. CODE > 0247: load_model #BFYST > 038B: load_requested_models > > :MODEL_LOAD > if > 8248: not model #BFYST available > else_jump @MODEL_SPAWN > wait 0 ms > jump @MODEL_LOAD > > :MODEL_SPAWN > 10@ = Actor.Create(CIVFEMALE, #BFYST, 2491.3635, -1661.4694, 13.3359) > Actor.Angle(10@) = 182.9651 > > 0249: release_model #BFYST We will first have to load the IFP file, then we have to check if the animation is loaded. After that you have to give her an animation. You can do this with the following opcodes: CODE > 04ED: load_animation "DANCING" > > repeat > wait 0 > until 04EE: animation "DANCING" loaded > > 0605: actor 10@ perform_animation_sequence "DNCE_M_A" IFP_file "DANCING" 10.0 loop 1 0 0 0 time -1 // versionA Sometimes you don't have to load the animation, but I have to admit that I don't know when. I've seen many bugged scripts because they didn't load the animation, so my advice is to load it always. What do you have to lose? Better a few lines to much, than a bugged script! Opcode 0605 is exactly the same as opcode 0A1A and 0812. So it doesn't matter which opcode you choose. I will only explain the most important parts of this opcode. Feel free to experiment by changing the other parameters. First you have to say which actor you will give an animation, in our case that will be 10@, which we just created. The first integer number, the only 1 in the opcode above, will indicate how many times the animation has to repeat itself. When you make it a 0, the animation will only be done once. When you make it a 1, it will repeated. After time you will see "-1". This means that the actor will perform the animation until there is an opcode that says that it has to stop. You can change it into a number like 4000, which means that the animation had to continue for 4 seconds. There is also a variant on the opcode: CODE > 0829: actor 10@ perform_animation "DNCE_M_A" IFP_file "DANCING" 4.0 time 4000 and_dies In my opinion this is a bit stupid, but you can give it a try. After the actor performed it for 4 seconds, it will die. But it doesn't die like you would espect, it only freezes. There will be blood on the ground, but the actor is still standing, frozen. You can walk through it, and only if you kick the actor it will lay down. Funny to see, though. CODE > 0804: AS_actor 10@ walk_to 2498.1187 -1671.9563 13.3427 angle 0.0 radius 0.2 animation "GRLFRD_KISS_03" IFP_file "BD_FIRE" 4.0 LA 0 LX 0 LY 0 LF 0 LT -1 > 0804: AS_actor 10@ walk_to 2498.1187 -1671.9563 13.3427 angle 0.0 radius 0.2 animation "DNCE_M_A" IFP_file "DANCING" 4.0 LA 0 LX 0 LY 0 LF 0 LT -1 Two examples of one opcode, try it to see the result (you can edit it into the code at the end, if you find it difficult to create something from a stripped file). The actor walks to the supplied coordinates, and then perform the animation. In the first the actor will walk to the point and then give a kiss. To nobody in this case, but of course, you can add another actor next to it. The second will let the actor dance when he is at the location. CODE > 0611: actor 2@ performing_animation "LRGIRL_IDLE_TO_L0" > 8611: not actor 2@ performing_animation "LRGIRL_BDBNCE" This opcode is a condition, so you have to use with for example an if-structure. This can be handy if you want to check if the animation is stopped, or if the actor is doing an animation. Here is an example of a code that checks if the animation is stopped: CODE > 0605: actor 10@ perform_animation_sequence "DNCE_M_A" IFP_file "DANCING" 10.0 loop 1 0 0 0 time 3000 // versionA > repeat > wait 0 > until 8611: not actor 10@ performing_animation "DNCE_M_A" Yet another opcode for an animation: CODE > 0612: set_actor 10@ animation "DNCE_M_A" paused 1 With this code you can pause an animation. 1 means that it has to start, 0 means that it has to pause. For example we will make an actor with an animation, that has to do it for 1 second, then has to stop for 1 second, and then has to continue. CODE > 0605: actor 10@ perform_animation_sequence "DNCE_M_A" IFP_file "DANCING" 10.0 loop 1 0 0 0 time -1 > wait 1000 > 0612: set_actor 10@ animation "DNCE_M_A" paused 0 > wait 1000 > 0612: set_actor 10@ animation "DNCE_M_A" paused 1 CODE > 0605: actor 10@ perform_animation_sequence "DNCE_M_A" IFP_file "DANCING" 10.0 loop 1 0 0 0 time -1 > wait 3000 > 0614: set_actor 10@ animation "DNCE_M_A" progress_to 0.5 // 0.0 to 1.0 This is another opcode, of course we are talking about the 0614 opcode. You can split up every animation. The whole animation is 1.0, it starts at 0.0. So you can say: I want that the actor perform the animation for 3 seconds, and then it has to start over from 0.5. Of course you can also say it has to start from the beginning after some time, then you have to write 0.0. Release animation Of course you have to release the animation when you loaded it: CODE > 04EF: release_animation "DANCING" Animation Paths CODE > 0754: define_new_animation_path > 0755: add_animation_path_3D_coord 2496.5234 -1671.363 13.3359 animation "ROADCROSS" IFP_file "PED" > 0755: add_animation_path_3D_coord 2499.4873 -1661.1962 13.3587 animation "ROADCROSS" IFP_file "PED" > 0755: add_animation_path_3D_coord 2490.1294 -1661.246 13.3359 animation "ROADCROSS" IFP_file "PED" You first have to define the animation path. You have to start with define new animation path. Then you have to add coordinates. In this example, we will add three coordinates. The Animation and the IFP-file is just like the animations explained at the beginning of the tutorial. You can also use "NONE" instead of "ROADCROSS" and "PED", but then they won't do an animation. The animation will be performed at the coord, so it won't be during the time that the actor walks to the coord. Then you have to add an actor to the animation path: CODE > 0817: assign_actor 10@ to_animation_path_with_walk_mode 4 route_mode 3 You can just expriment with this opcode. The route-mode: 0-normal order of waypoints, once (ABCD) 1-normal order of waypoints and reverse, once (ABCDCBA) 2-normal order of waypoints plus reversed, looped (ABCDDCBAABCD...) 3-normal order of waypoints, looped (ABCDABCDABCD...) (Source: this topic) Finally I will give you the code of a stripped file with an actor that performs an animation: [click](http://pastebin.com/f6163feeb "").

Posts

None found

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Original Authors
Dutchy3010

Submitter

Arman Ossi Loko avatar
Arman Ossi Loko avatar Lurkin'
Admin Joined 10y
71,925 points Ranked 56th
63 medals 9 legendary 16 rare
  • GTAV First Adopter Medal icon
  • Submitted 15 Tools Medal icon
  • Submitted 30 Tutorials Medal icon
  • 1st place - 2015 Uberstyles Contest Medal icon
  • Achieved Admin clearance Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2015 Medal icon

Arman Ossi Loko avatar
Arman Ossi Loko
KOPASSUS Incorporated Flag
KOPASSUS Incorporated

Redistributor
Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Details

Difficulty Level
Beginner Difficulty

Attributes

Stats

Posts
0
Views
4,176
Date Added
5y
Date Modified
4y
bcp.crwdcntrl.net tracking pixel