Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
tomworld10

Coding bible part II

Recommended Posts

tomworld10

Grand Theft Auto

 

San Andreas

 

 

 

 

Mission Coding with Sanny Builder Tutorial

Part II

Coding Basics

 

 

 

 

 

 

 

 

Introduction

 

Hi, in Part II we will get some basics of coding, create spheres, actors, cars, markers, texts, panels etc....

 

If you need to look at Part I it's here.

 

As in Part I, I recommend you to print the topic using Printable Version of Topic, by clicking print this topic on top right of the first message. Or read it in Sanny Builder's Help by pressing F12 in Articles section.Which I think is the best place to read it. You can print it as well from Sanny Builder's Help.

 

 

 

A lot of examples here use globals (variables that start with a $ like : $markerxx, $car00, $actor00, $myweaps00) but it doesn't mean you cannot use locals (varaiables that end with a @ like : [email protected], [email protected], [email protected], [email protected]). I use gobals so I can name them for easier understading. But when you'll be coding you should use locals, for many reasons they are better. You only need to use gloabls when you need the varaible in two (or more) different threads (it's pretty rare, and it isn't usually much more than a few varaible).

 

 

 

Often I will give a four digit hexadecimal number (like 0103, 02a8, 00ec, 032b, etc...) they're opcodes, to have a description write the four digit number on a new line in Sanny Builder and press F1.

 

 

Most examples are given in a CODE tag like this :

 

CODE tag

 

So you can copy and past it in Sanny, I recommand you to do so often, it will help you understanding. And you won't have to write the opcode number and press F1 everytime.

 

 

 

 

 

 

 

 

1. Using Sanny

 

This part is most repeat parts of Sanny's Help but sometimes explained differently. But you can still report to the Hotkeys page for more details.

 

Hotkeys :

 

 

- F1 : the magic hotkey !!!!! write an opcode like 004F and press F1 and ho magic appears :

004F: create_thread @ODDVEH

 

 

or write thread and press it and press it again, Sanny will suggest you all those different lines :

 

004E: end_thread004F: create_thread @ODDVEH  00D7: create_thread_with_wasted_busted_check @NONAME_2 03A4: name_thread 'MAIN' 0459: end_thread_named 'INT' 004F: create_thread @ODDVEH  

 

 

F1 will be the key you'll use a lot, just think about what you want (car, actor, checkpoint, markers, weapon, money, paintjob, etc...) write it and press F1. It won't do what you want everytime but it will get you going.

F1 is kind of google for Sanny !!!!!!!

 

But notice that it only works for one and only one word.

 

Remember (or learn if you didn't know) that F1 gets it's suggestions from opcodes.txt so make sure you did what it's in part II introduction.

 

- Ctrl + Shift + <0..9> : make bookmark, at the line you are like :

user posted image

They should be save when you save the file.

 

- Ctrl + <0..9> : go to bookmark number <0..9>, put you at the line of the bookmark (if it exist)

 

- Ctrl + Num2/Num8 : when you place your cusor (the blinky |) on a jump (or gosub or jf -jump_if_false-)and press it the editor will bring you the the label. Look animation to see that I've place on @PSAVE1_1498 and it bring me to the label it self :PSAVE1_1498.

user posted image

 

- F3 : find next

 

- Ctrl + F3 : find previous

 

- Ctrl + Alt holded : Rectangular selection :

user posted image

 

- Ctrl + Alt + 1 : Coords Manager (game must be running)

user posted image

 

- Ctrl + Alt + C : Insert player coordinates where you cursor is

 

- Ctrl + Alt + E : Insert z angle value where you cursor is

 

- Ctrl + T : delete word, remember things like end_thread will be considered as one word.

 

- Ctrl + Y : delete line

 

- Ctrl + Shift + Y : clear line, leave the line but delete what's written in it.

 

- Ctrl + Scroll Up/Down : page up / down

 

- Ctrl + Shift + U/L : make word UPPERCASE / lowercase.

 

- Ctrl + Q : comment out the line your cursor is (adds // at begining of the line), so the line will be ignored when compiling.

 

- Ctrl + G : go to line

 

- Ctrl + R : replace

 

- Ctrl + C : copy

 

- Ctrl + V : paste

 

- F7 : compile and copy to GTA SA folder main.scm and script.img

 

 

 

 

 

Editor completion :

 

Sanny can complete some thing for you like global variables, labels, model IDs, to use it just write first character ($, @, or #) and get what you need. Look the animation I think it explains well :

user posted image

 

Those are the most used exemples, but you might find many use for this tool.

 

Notice that with models, the nudel number is shown, so it's a pretty easy way to find what number a model is.

user posted image

 

 

 

Coords Manager :

 

Very usefull tool here which get the 3D position of the player. Of course the game muste be running....

 

The 3 dimension position is the value of each axis (x, y, z). The San Andreas map goes from -3000.0 to 3000.0 on x and y axis. The altitude (z) max of planes is about 800.0 units. Axis x is oriented west east, the x value increases when going east. Axis y is oriented south north, the y value increases when going north. Center of the map is located at 0.0 0.0 0.0.

Well it looks like that :

user posted image

This screenshot is from old Sanny Builder new coord manager is slightly different.

 

 

Copy will copy into clipboard the 3d pos like 747.756 -1809.0986 13.0234

 

Read will refresh the position of the player ingame.

 

Set will put player at the position you've written in the three dimensions.

 

 

In new Sanny Builder you get the Z angle value. This is the value of the angle around z axis which means what direction the player (CJ) is looking at. 0.0 is north, 180.0 is south, 90.0 is east, 270.0 is west.

 

 

 

 

 

 

 

 

 

2. Adding mission mods :

 

This isn't really coding but it is usefull for everyone to look/test/use/imitate parts of other's mods.

 

First thing to know when adding mods : FOLLOW INSTRUCTIONS !!!!!!!!!!!!!!!!!!!! Every mods is different so when adding a mod first follow the author instructions to add it, they're the best instructions. But sometimes there isn't much instruction.

 

Then, most of mods are main part (look part I, 1.Main.scm architecture) mods. So they're activated (create_thread) and executed in the main part. You probably want to add mods to original main.scm (or modded main.scm), then you'll will use 004F (create_thread) here :

 

004F: create_thread @ODDVEH  004F: create_thread @R3  004F: create_thread @GYM  004F: create_thread @SHOOT  004F: create_thread @BLOODR  004F: create_thread @HOTR  004F: create_thread @KICKS  004F: create_thread @PSAVE1  004F: create_thread @FLOW  004F: create_thread @HELP  004F: create_thread @COLLS  004F: create_thread @CRANES  004F: create_thread @BUY_PRO  004F: create_thread @VALET_L  004F: create_thread @ADPLANE  

 

 

Between any of those lines you'll add :

 

004F: create_thread @modlabel

where it will be of course the mod's first label name instead of modlabel.

 

Then you've got the mod itself, you have to add it anywhere in main part. BUT it isn't really anywhere, it's more like anywhere after it's been created/activated, and not inside another thread. to simplify just put it at the very end of main part, so before :

//-------------Mission 0---------------// Originally: Initial 1

 

 

 

Then compile and copy to San Andreas data\script (F7), launch the game, start a new game and.....

 

 

 

have fun

 

 

 

 

Hang on, if it really did work, you're like really very very lucky (and you did a good job apparently) !!!! Most of time first try simply doesn't work. So watch what you've done, look how the author of the mod did it, watch global variables (if only numbers you should change it to a custom name), the try again, and if you really can't get it working, ask the author how he did (do that after several tries and checks, don't disturb the author for a mistake you've done).

 

 

 

 

 

 

 

 

 

3. Weapon pickups and parked cars :

 

For me this part isn't real coding neither but it's usefull and asked very very very often, and it's a good opportunity to explain how it works.

 

Pickups and parked car are spaecial opcode because it telle the engine to create such car or such weapon if player is close enough to the point.

 

Well I'll take exemple to the cars/vehicles that you always find in one place (the skimmer near the dam, the AT400 at Vegas airport, the cropduster in the desert, these are the only one I can think of right now) everytime (actually not everytime) you come back it's here. Same for weapons (the heatseek rockets at the abandonned village, the gun behind Sweet's house...), life (red heart in gang wars), and armor.

 

 

 

 

 

Parked cars :

 

014B: $mycarx00 = init_parked_car_generator #CHEETAH 15 15 1  alarm 0 door_lock 0 0 0 at -1253.1 -348.0 13.9 angle 0.0 014C: set_parked_car_generator $mycarx00 cars_to_generate_to 101

 

 

 

- This will create a cheetah (#CHEETAH)

 

- at the 3d coordinate -1253.1 -348.0 13.9

 

- the car will be headed the z_angle 219.0 (z_angle is the angle around the axis z, 0.0 and 360.0 is north, 180.0 is south, 90.0 is east, 270.0 is west), so this car is

directed to south-west

 

- with color one number 15 (you can notice sometimes -1 which mean any)

 

- with color two number 15 (you can notice sometimes -1 which mean any)

 

- Car belongs to the player (the cops don't think you've stole it) becasue next parameters is set to 1. If would set on 0 cops will give you a wanted level when you enter it

 

- Without alarm, because it's 0. It's actaully percentage of chances of getting alarm. So if you want the alarm to go off everytime set it to 100, if you want it once out of two time then 50 etc....

 

- Doors won't be lock. As you can read door_lock is set to 0. If 1 doors will be lock. The two others parameters are unknown.

 

- This car generation (not the car itself) is set as handle $mycarx00

 

 

And you should be wondering how do I know all that (beside simply reading and thinking) ???????

Well go check http://sa-db.webtools4you.net/, clic go without writting anything, and with your internet browser (if you don't know what it is then it's Internet Explorer) go Edition\Find in the page, and search for 014B.

 

You'll then get 014B description

 

 

The line after 014C just activates or unactivate the parked car generator for this car generation handle : 101 makes it spawn and 0 doesn't. It is needed don't forget one for each car generation, but they don't have to be together you can separate them.

 

 

There is other types of parked cars they're very close to this one and they ain't much usefull.

 

 

 

 

 

 

 

 

Weapon pickups :

 

There is two types of weapons pickups, one for weapons which doesn't need ammunitions (like dildos, katana, golf club, shovel, parachute....), and is actualy just a normal pickup.

 

Those both pickup opcodes like with parked cars opcode don't need to request and load the model before using.

  1. Melee (and gift) weapons

     

    0213: $myweaps00 = create_pickup #CHNSAW type 15 at -2083.0 298.0 42.0 0213: $myweaps01 = create_pickup #BAT type 15 at -2306.0 93.0 35.0 0213: $myweaps02 = create_pickup #SHOVEL type 15 at -2796.4155 123.686 6.844 0213: $myweaps03 = create_pickup #POOLCUE type 15 at -2135.0 197.0 35.0 0213: $myweaps04 = create_pickup #KATANA type 15 at -2208.0 696.0 50.0 0213: $myweaps05 = create_pickup #BRASSKNUCKLE type 15 at -2206.0 961.0 80.0 

     

     

    You can use this opcode for other pickups like the keycard (what you get with the croupier girl- model : #KEYCARD), armour (model : #BODYARMOUR), life (model : #HEALTH), bribe (model : #BRIBE), save disks (only the pickup not the saving routine ! - model : #PICKUPSAVE), briefcase (model : #BRIEFCASE) etc...

     

    All the melee weapons (including parachute -#PARA_PACK- but not the goggles), and health, armour, bribes, are hardcoded that mean you don't have to check if the player picks up the so-called pickup, just go to the pickup and it automaticly gives the weapon/bribe/armour/health etc....

     

     

    For keycard, save disk, briefcase, but as well as all define objects models (if there ain't too big of course) because they can be use as a pickup, you have to check if the pickup has been pickup or not. You don't have to destroy it once it's been picked, because as soon as the player is on it it will automaticly disappear.

    For this you must use something like this :

     

    00D6: if  0214: pickup $pickupvar picked_up 004D: jump_if_false @

     

     

     

     

  2. Firearms (and all others)

    But for weapons which have ammunition, with an exeption for the night and infrared goggles, (models : #NVGOGGLES, and #IRGOGGLES) you'll need to use the pickups which give ammunition with the weapon (doesn't it sound obvious ?) :

     

     

    032B: $myweaps06 = create_weapon_pickup #NVGOGGLES 15 ammo 1 at 299.5 -31.7 1001.0 032B: $myweaps07 = create_weapon_pickup #IRGOGGLES 15 ammo 1 at 299.6 -41.3 1001.0 032B: $myweaps08 = create_weapon_pickup #M4 15 ammo 60 at 2021.879 1001.467 10.3203 032B: $myweaps09 = create_weapon_pickup #MP5LNG 15 ammo 120 at 2025.286 1001.496 10.3203 032B: $myweaps10 = create_weapon_pickup #SHOTGSPA 15 ammo 120 at 2021.327 1013.349 10.3203 032B: $myweaps11 = create_weapon_pickup #SATCHEL 15 ammo 20 at 2023.775 1013.527 10.5203 032B: $myweaps12 = create_weapon_pickup #SNIPER 15 ammo 60 at -2035.7729 139.4337 28.3359 032B: $myweaps13 = create_weapon_pickup #MICRO_UZI 15 ammo 120 at -2038.4301 139.6281 28.3359 032B: $myweaps14 = create_weapon_pickup #CHROMEGUN 15 ammo 120 at -2038.6639 137.4694 28.3359 032B: $myweaps15 = create_weapon_pickup #GRENADE 15 ammo 20 at -2035.474 137.2511 28.3359 032B: $myweaps16 = create_weapon_pickup #AK47 15 ammo 120 at 2499.3899 -1707.463 1014.25 032B: $myweaps17 = create_weapon_pickup #TEC9 15 ammo 120 at 2499.5139 -1709.64 1014.25 032B: $myweaps18 = create_weapon_pickup #SAWNOFF 15 ammo 60 at 2493.491 -1708.2371 1014.932 032B: $myweaps19 = create_weapon_pickup #MOLOTOV 15 ammo 20 at 2493.553 -1706.863 1015.132 032B: $myweaps22 = create_weapon_pickup #COLT45 15 ammo 100 at -365.4774 -1422.401 25.5 032B: $myweaps23 = create_weapon_pickup #FLAME 15 ammo 200 at -366.066 -1418.683 25.5 

     

     

    Well for those ones, the number after ammo is the number of ammunition you'll have when you pick the weapon up.

For all pickups (both 0213 and 032B) :

 

type 1 disables the pickup (you can't pick it up)

type 3 make the pickup pickable only one time

type 15 make the pickup re-grows up everytime after you picked it up (probably what you want)

 

 

the three floats are the coordinates of the pickup like those :-366.066 -1418.683 25.5

 

$myweapsxx is the handle of the pickup, the variable that contains it.

 

and #GRENADE is the model.

 

One last thing is that you can find a weapon list in the file [sA] Weapon numbers.txtin the help folder of Sanny Builder folder.

 

There is some weapons like the jetpack, or the parachute where you can use either 0213 or 032B with ammo 1 it has the same result.

 

 

You can destroy pickups before it's been pickup, with 0215 :

 

0215: destroy_pickup $myweaps01

 

 

 

 

 

4. Threads :

 

There isn't much to say more than what's been told in Part I : 4. Threads and labels.

 

Just that you create them with 004F like that :

 

004F: create_thread @name_of_your_thread

 

 

You name it with 03A4 :

 

03A4: name_thread 'NAME' 

 

No more than 7 letter.

 

You can end it with 004E from the thread itself :

 

004E: end_thread 

 

 

Or from anywhere else with 0459 :

 

0459: end_thread_named 'NAME'

 

 

 

 

Sometime you can find weird 004F like :

 

user posted image

 

Don't worry it's just how you can set local variable for the thread you create. Like on the example $ACTOR_RYDER will be [email protected], 0 (first one) will be [email protected], 0 (second one) will be [email protected], 2 will be [email protected], 1 will be [email protected] in the thread :AUDIOL.

 

Like Sanny tells you you can set up to 32 locals there for the thread you create from [email protected] to [email protected]. It can be very usefull but if you don't really understend it doesn't really matter, it's just so you know about it.

Edited by tomworld10

Share this post


Link to post
Share on other sites
tomworld10

5. Spheres and markers :

 

 

Spheres :

A sphere (also called POI cylinder) is the red round thingy that you walk in when you start a mission.

 

Even if you don't actually see the red circle, the game (and you while modding) uses many sphere all the time. Just to check if actor x is near a given coordinate within a certain radius.

 

To create thoses special spheres that checks if actor is near it you need a special type of opcodes that have a command and are conditional !!!! There rare but so usefull since GTA III. They are conditional because they check if the actor is near it and in the meanwhile they display the red sphere ingame.

  1. 2d opcodes

    from 00ec to 00f4.

     

     

      00EC: actor $PLAYER_ACTOR 0 near_point 1812.369 -1929.9215 radius 80.0 80.0  00ED: actor $PLAYER_ACTOR 0 near_point_on_foot 2043.6801 -1635.73 radius 4.0 4.0  00EE: actor $PLAYER_ACTOR 0 near_point_in_car 2067.3999 -1831.2 radius 15.0 15.0  00EF: actor $PLAYER_ACTOR stopped 0 near_point 2196.239 -1191.459 radius 2.0 2.0  00F0: actor $PLAYER_ACTOR stopped 0 near_point_on_foot 2175.29 -2259.22 radius 3.0 3.0  00F1: actor $PLAYER_ACTOR stopped 0 near_point_in_car -175.29 -59.22 radius 3.0 3.0 00F2: actor [email protected] near_actor $PLAYER_ACTOR radius 20.0 20.0 0  00F3: actor $PLAYER_ACTOR near_actor_on_foot [email protected] radius 2.0 2.0 0  00F4: actor [email protected] near_actor_in_car $PLAYER_ACTOR radius 6.0 6.0 0 

     

     

    Those opcodes shouldn't be used because they can lead to many bugs particulary in interiors.

     

     

  2. 3d opcodes

    from 00fe to 0106.

     

     

      00FE: actor $PLAYER_ACTOR 0 near_point_3d 658.0068 -1866.3127 4.4537 radius 15.0 15.0 15.0  00FF: actor $PLAYER_ACTOR 0 near_point_3d_on_foot $X_JOHNSON_HOUSE $Y_JOHNSON_HOUSE $Z_JOHNSON_HOUSE radius 1.0 1.0 2.0  0100: actor $PLAYER_ACTOR near_point_3d_in_car 1793.0676 -1904.2538 12.3989 radius 4.0 4.0 4.0 sphere 1  0101: actor $PLAYER_ACTOR stopped_near_point_3d [email protected] [email protected] [email protected] radius 5.0 5.0 3.0 sphere 0  0103: actor $PLAYER_ACTOR stopped_near_point_3d_in_car -1577.9417 52.6333 16.3281 radius 4.0 4.0 6.0 sphere 0  0104: actor $PLAYER_ACTOR near_actor_3d [email protected] radius 15.0 15.0 15.0 sphere 0  0105: actor $PLAYER_ACTOR near_actor_3d_on_foot [email protected]([email protected],9i) radius 5.0 5.0 2.0 sphere 0  0106: actor $PLAYER_ACTOR near_actor_3d_in_car [email protected] radius 15.0 15.0 15.0 0 

     

     

    These opcodes are good use them !!!

For all of them opcodes :

 

Where ever it is placed the integer 0 or 1 tells the engine to show the red circle (1=show;0=don't show).

 

The first 2 or 3 (2 for 2D, 3 for 3D) floats like -366.066 -1418.683 25.5 are the position.

 

The second 2 or 3 (2 for 2D, 3 for 3D) floats like 4.0 4.0 6.0 are the radius of the sphere.

 

$PLAYER_ACTOR or [email protected], are the actor variables.

 

 

To have the sphere working (and then appearing) you need to place it in a loop :

 

 

:SPHERE_LOOP0001: wait 0 ms 00D6: if  00EC: actor $PLAYER_ACTOR 0 near_point 1812.369 -1929.9215 radius 80.0 80.0 004D: jump_if_false @SPHERE_LOOP 

 

 

The thread must be running on the loop for the condition to checked, and for the red circle to appear. The wait is needed don't make it too long otherwise it will be flickering, keep to 0 ms to have it nice.

 

 

 

Markers :

  • Marker icons

    Markers icons are the radar assets you go to to do a mission. Like user posted image, user posted image, or user posted image, etc...

     

    Thanks to LazioFreak for finding them. You can find a list of the icons and the numbers to use them on this page [sA] radar icons or in Sanny Builder help contents in SCM Documentation: GTA SA: radar icons.

     

     

    There is four opcodes to create them :

     

    Three without sphere (like it's said in the opcode description) 04ce and 0570 :

     

    04CE: $marker01 = create_icon_marker_without_sphere 12 at 2447.3643 -1974.4963 12.54690570: $marker02 = create_asset_radar_marker_with_icon 36 at 1837.3643 -1974.4963 12.5469 02A8: $marker03 = create_marker 23 at 658.0068 -1866.3127 4.4537

     

    02a8 will ALWAYS be visible on the radar.

     

     

    One with a sphere 02a7 :

     

    02A7: $marker00 = create_icon_marker_and_sphere 33 at 2514.5601 -1666.84 13.38 

     

    Like 02a8, this one is pretty cool because it will be ALWAYS visible on the radar, where ever you go you'll see it.

    But watch out it's only a sphere (just the red circle) it doesn't check if the player is near it, just the radar marker and the sphere. To check if the player is near it use opcodes told upper in spheres.

     

    All of them are 5 parameters opcodes :

    • $markerxx is the handle of the marker
    • The integer like 12, 36, or 23 are the marker icons number you can find on [sA] radar icons
    • The three floats are the x y z coordinates
  • Color markers

    The color markers are that :

    user posted image

     

    And on the radar they are represented by a colored square like that :

    user posted image

     

     

     

    To create them on vehicle/actor/object/pickup :

     

    0186: $marker04 = create_marker_above_car $car00 0187: $marker05 = create_marker_above_actor $actor00 0188: $marker06 = create_marker_above_object $object00 03DC: $marker07 = create_marker_above_pickup $myweaps00 

     

    Watch out the vehicle/actor/object/pickup must be existing and store in the hanlde otherwise you'll crash the game.

    With 03dc, the marker over the pickup will always be green what ever you do with it.

    • $markerxx is the handle of the marker
    • $car00, $actor00 , $object00, $myweaps00 are the handles of vehicle/actor/object/pickup
    You can change the color of the marker with :

     

    0165: set_marker $marker05 color_to 1 

     

    • 0= red
    • 1= green
    • 2= light blue
    • 3= white
    • 4= light yelow
    With 0168 you can change the size of the marker (unlike the description says) :

     

    0168: show_on_radar $marker04 1 

     

    • < 3 : smaller the default size
    • = 3 : default size
    • > 3 : bigger
    You can set to enemy or friendly color (it only change the color):

     

    07E0: set_marker $marker04 type_to 1 

     

    • 0 : enemy red
    • 1 : friendly blue
To hide and show them (both icons and colored markers) :

 

018B: show_on_radar $marker02 1 

 

  • 0= hide
  • 1= hide
  • 2= show
  • 3= show
  • 4= hide
  • 5= hide
To destroy them (both icons an colored markers) :

 

0164: disable_marker $markerxx 

 

Where of course $markerxx is the handle of the marker.

 

 

 

 

 

 

6. Actors, weapons and vehicles :

 

Now let's create some things to destroy them !!!!!

 

 

First when you create actors, vehicles, objects, or give weapons to an actor, you have to load the models and check they are loaded before creating them.

 

So you need to request the models with 0247 :

 

0247: request_model #CHEETAH 0247: request_model #DESERT_EAGLE

 

 

then load requested models with 038b :

 

038B: load_requested_models 

 

 

 

After you need a check to confirm that the models are really loaded (available for the engine to use):

 

00D6: if and  0248: model #HEATSEEK available  0248: model #DESERT_EAGLE available 0248: model #MP5LNG available 0248: model #CR_AMMOBOX available 0248: model #CHEETAH available  0248: model #WFYSEX available 004D: jump_if_false @LOOP_RQ_10 

 

 

The jump if false jumps to :LOOP_RQ_10 where the model will be requested again loaded again.

 

All in one it look like that :

 

:LOOP_RQ_100001: wait 0 0247: request_model #WFYSEX 0247: request_model #CR_AMMOBOX 0247: request_model #CHEETAH 0247: request_model #DESERT_EAGLE0247: request_model #MP5LNG0247: request_model #HEATSEEK038B: load_requested_models 00D6: if and  0248: model #HEATSEEK available  0248: model #DESERT_EAGLE available 0248: model #MP5LNG available 0248: model #CR_AMMOBOX available 0248: model #CHEETAH available  0248: model #WFYSEX available 004D: jump_if_false @LOOP_RQ_10 

 

 

Notice the wait because it's very important here you do a loop, you make the engine comes back to where it was before. You need this wait, wait 0 ms is far enough, you don't need more, but you DO need it.

 

 

Now that the models are available you can create your actors/vehicles/objects, and give weapons to the actors :

 

 

00A5: $car00 = create_car #CHEETAH at 2368.5601 -1666.84 13.38 009A: $actor00 = create_actor 22 #WFYSEX at 2490.56 -1666.84 14.38 009A: $actor01 = create_actor 22 #WFYSEX at 2495.56 -1666.84 14.38 009A: $actor02 = create_actor 22 #WFYSEX at 2490.56 -1660.84 14.38 009A: $actor03 = create_actor 22 #WFYSEX at 2495.56 -1660.84 14.38 0107: $object00 = create_object #CR_AMMOBOX at 2502.5601 -1566.84 24.38 01B2: give_actor $actor00 weapon 36 ammo 900 // Load the weapon model before using this01B2: give_actor $actor01 weapon 29 ammo 900 // Load the weapon model before using this01B2: give_actor $actor02 weapon 24 ammo 300 // Load the weapon model before using this01B2: give_actor $actor03 weapon 29 ammo 900 // Load the weapon model before using this

 

  1. For creating a car with 00a5 :
    • $car00 is the car handle
    • #CHEETAH is the model. Use editor completion to have a list of models (watch out there is ALL models, cars, actors, objects).
    • 2490.56 -1666.84 14.38 are the coordinates.
  2. Create actor with 009a :
    • $actor00 is the actor handle
    • #WFYSEX is the model. Use editor completion to have a list of models.
    • The integer 22 is the ped type. The ped type is the temper, the way the actor will act by default (without any order given). You can find a list of ped types in Sanny Builder help contents in SCM Documentation: GTA SA: PedTypes. Here they don't like cops and will defend themself if they're attacked, among other things.
    • 2368.5601 -1666.84 13.38 are the coordinates.
  3. 0107 will create an object :
    • $object00 is the object handle
    • #CR_AMMOBOX is the model. Here you can use any objects defined in the map files (.ide files in GTA San Andreas\data\maps folder) as long as you defined the object in define object section in the scm. See Part I : 1. Main.scm architecture.
    • 2502.5601 -1566.84 24.38 are the coordinates.
  4. Finally 01b2 gives an actor a weapon :
    • $actor00 is the actor handle
    • The first integer 36, 29 or 24 after weapon is the Weapon number. You can find a list of weapons their numbers and the correponding model in Sanny Builder help contents in SCM Documentation: GTA SA: Weapon numbers.
    • The second integer 300 or 900 after ammo is the number of ammunition given to the actor along with it's weapon. Here it's too much depends of how time the actor will live but I found that 150 is usualy far enough.
    Even if you might think that this opcode don't need the weapon model to be loaded, but it DO NEEDS the model to be loaded. To ensure you can look at the comment (after //) which says : "// Load the weapon model before using this"
Now they're ready to shoot away but they'll have to wait a bit !!!!

 

 

 

 

You might need to change the direction of the car (z angle), or its colors (there is up to four colors for cars) :

 

0175: set_car $car00 z_angle_to 90.0 0229: set_car $car00 color_to 11 0 0A11: (unknown) $car00 6 12 

 

 

It's pretty easy so I'll be fast :

  • for all of them $car00 is the car handle as usual !!!!
  • In 0175 the float 90.0 is the z angle from -360.0 to 360.0.
  • In 0229 the integers 11 is the primary color and 0 is the secondary color.
  • In 0a11 the integers 6 is the tertiary color and 12 is the quaternary color. Don't worry about the opcode description, by the time the sascm.ini used here (the one given with Sanny) was written the opcode wasn't known yet, but it will still work very well, and now that you know what the opcode does, there is nothing to stop you !!!
For infos, those were only "set" opcodes, but there is opposite opcodes for all thoses "get" opcodes. The "get" opcodes will get the color/angle of the car and stores it in variables :

 

 

0174: $carangle = car $car00 z_angle 03F3: get_car $car00 color $primcolor $scndcolor 0A12: (unknown) $car00 $tertcolor $quatcolor 

 

 

Well, what can I say, it the same as before but the all way around, instead of saying the engine to put a color on the car or put the car in such direction, it finds what color the car is or what direction the car is and put the resulting integer in the variable.

The variable names should speak form themselves.

 

 

As much obvious as it is, you can't change the color of an actor !!!!!! But you can change the direction (s)he's looking at, and know where (s)he's looking :

 

0172: $actorangle = actor $actor00 z_angle 0173: set_actor $actor00 z_angle_to 262.0 

 

 

 

Same for objects, here is just the angle, but there is more on objects just next :

 

0176: $objangle = object $object00 z_angle 0177: set_object $object00 z_angle_to 180.0 

 

 

 

 

When you finished using those actor/vehicles/object you have two different ways to get rid of them :

  • First you can simply destroy them (they will just disappear straight away) :

     

    00A6: destroy_car $car00 0108: destroy_object $object00 009B: destroy_actor_instantly $actor01 034F: destroy_actor_with_fade $actor00 // The actor fades away like a ghost 

     

    034f as the comment says "// The actor fades away like a ghost". Is usualy what you see happening in original game when an actor is dead, it slowly disappear.

     

  • Secondly you can remove references from them, this will turn them into normal peds (just like every pedestrian/vehicle you see ingame). So the actor/vehicle/object will still be there but the handle $car00/$actor00 /$object00 won't hold the actor/vehicle/object anymore :

     

    01C2: remove_references_to_actor $actor00 // Like turning an actor into a random pedestrian 01C3: remove_references_to_car $car00 // Like turning a car into any random car 01C4: remove_references_to_object $object00 // This object will now disappear when the player looks away 

     

    The comments (after //) explain what the opcodes do pretty well again.

Now that the actors/vehicles/objects are destroyed the engine don't need the models any more. So to free some game memory you can release the models with 0249 :

 

0249: release_model #WFYSEX       0249: release_model #CR_AMMOBOX   0249: release_model #CHEETAH      0249: release_model #DESERT_EAGLE 0249: release_model #MP5LNG       0249: release_model #HEATSEEK     

 

 

 

 

 

About special actors :

 

Actors like Ryder, BigSmoke, Sweet, Tenpeny, Pulaski, Toreno, Ceasar, Jethro etc... are called special actors, they're not like the usual ped you find on the street. Then, in scm coding, they're handled in a special way, with special opcodes those so special actors !!!!

 

It goes like this :

 

023C: request_special_actor 'TENPEN' as 1 023C: request_special_actor 'PULASKI' as 2 023C: request_special_actor 'HERN' as 3 023C: request_special_actor 'CESAR'   as 4 023C: request_special_actor 'JETHRO'  as 5 023C: request_special_actor 'MADDOGG'     as 6

 

 

Here you have requested the models 'TENPEN', 'PULASKI' and 'HERN' and define them as special actor models integers 1, 2 and 3.

You can find a special actor list in Sanny Builder help contents in SCM Documentation: GTA SA: Special actors. You can only define 9 special actor models at the same time (integers from 1 to 10 included).

 

 

Then you have to check if the special actors are loaded and create them either on foot or in a car with the usual create_actor opcodes :

 

wait 000D6: if and023D:   special_actor 1 loaded 023D:   special_actor 2 loaded 023D:   special_actor 3 loaded 023D:   special_actor 4 loaded 023D:   special_actor 5 loaded 023D:   special_actor 6 loaded 0248:   model #COPCARLA available 004D: jump_if_false @check_1 00A5: [email protected] = create_car #COPCARLA at 2431.609 -1254.061 22.8303 01C8: [email protected] = create_actor 23 #SPECIAL01 in_car [email protected] passenger_seat 0 0129: [email protected] = create_actor 23 #SPECIAL02 in_car [email protected] driverseat 01C8: [email protected] = create_actor 23 #SPECIAL03 in_car [email protected] passenger_seat 1 009A: [email protected] = create_actor 23 #SPECIAL04 at 2436.609 -1254.061 22.8303009A: [email protected] = create_actor 23 #SPECIAL05 at 2437.609 -1254.061 22.8303009A: [email protected] = create_actor 23 #SPECIAL06 at 2438.609 -1254.061 22.8303

 

 

When creating actors, see how the model is named #SPECIAL01 and that it refers to the integer used in 023c(request_special_actor). Then special actors models are named from #SPECIAL01 to #SPECIAL10.

 

If you need other special actors later (like in another mission) follow the same procedure with different models names but keeping 1, 2 and 3 as special actor model integer, like :

 

023C: request_special_actor 'SMOKE'   as 1 023C: request_special_actor 'TORINO'   as 2 023C: request_special_actor 'SWEET'     as 3023C: request_special_actor 'TRUTH'   as 4 //etc...

 

 

To release the model simply use 0296 with the special actor integer model, and destroy the actor with usual 009b, 034f or 01c2 :

 

0296: unload_special_actor 1 0296: unload_special_actor 2 0296: unload_special_actor 3 0296: unload_special_actor 4 0296: unload_special_actor 5 0296: unload_special_actor 6 009B: destroy_actor_instantly [email protected] 009B: destroy_actor_instantly [email protected] 009B: destroy_actor_instantly [email protected] 009B: destroy_actor_instantly [email protected] 009B: destroy_actor_instantly [email protected] 009B: destroy_actor_instantly [email protected] 00A6: destroy_car [email protected] 

 

 

 

 

7. Objects and moving them :

 

In Grand Theft Auto San Andreas there is many many things you can do with objects, but I won't (and I can't) tell you everything about it. I'll give you far enough to do nice and fun things with them.

 

I won't repeat (even if I do repeat a lot of things) how to request and load models to create objects, it's told upper. I won't repeat neither how to destroy/remove references and release objects for the same reason.

 

 

 

First some general (general because there is similar opcodes for vehicles and actors) things about coordinates and offsets. Sometime you need to know where the object is placed, and sometimes you need to know what are the coordinates just a bit away from the object (this is called an offset) :

 

01BB: store_object $object00 position_to $objpos_x $objpos_y $objpos_z0400: create_coordinate $objpos_x $objpos_y $objpos_z from_object $object00 offset 1.0 2.0 3.0 

 

  • 01bb will simply get the object $object00 x y z coordinates and store them into $objpos_x $objpos_y $objpos_z.
  • In 0400 it will store the coordinates at the offsets 1.0 2.0 3.0 of the object. It means that the coordinates that will be stored in $objpos_x $objpos_y $objpos_z will be 1.0 unit away from the object on the object's z axis, 2.0 unit away from the object on the object's y axis, and 3.0 unit away from the object on the object's z axis.

 

As I said there is similar opcodes for cars and actors, the explaination is the same as before just replace object by car or actor :
  • For vehicles :

     

    00AA: store_car $car00 position_to $carpos_x $carpos_y $carpos_z 0407: create_coordinate $carpos_x $carpos_y $carpos_z from_car $car00 offset 1.0 2.0 3.0 

     

  • For actors :

     

    00A0: store_actor $actor00 position_to $actorpos_x $actorpos_y $actorpos_z 04C4: create_coordinate $actorpos_x $actorpos_y $actorpos_z from_actor $actor00 offset 1.0 2.0 3.0

     

 

 

 

Once the object is created you can move the object to new coordinates :

 

01BC: put_object $object00 at 2368.5601 -1666.84 13.38

 

For info similar opcodes for actors and cars are : 00a1 for actors and 00ab for cars.

 

You can use this to make the object move along, it's isn't the best way to do it but it's simple and works well. Here is an example :

 

:MOVE_100001: wait 3 ms 00D6: if  0031: [email protected] >= 200.0 // floating-point values 004D: jump_if_false @MOVEND01BC: put_object $object00 at [email protected] [email protected] [email protected]: [email protected] += 0.1 // floating-point values 0002: jump @MOVE_10

 

You can see here that the object will move along x axis, as every 3ms the object will go 0.1 distance unit further on the x axis until [email protected](which is here the x axis unit) reaches 200.0. DON'T FORGET THE WAIT !!!!!!

 

 

The same way you can change the created object angles x y and z

 

0453: object $object00 set_rotation 0.0 0.0 180.0

 

Same as 01bc with a little loop you can make the object turn around. And as for 01bc there is better ways to do it, but this one is simple and works well. It also as the advantage of giving you the possibility to change any angle x y or z.

 

 

But you can as well use 034d so it will move around x axis :

 

034D: object $object00 at_angle 0.0 then_rotate_by_angle 360.0 flag 0 

 

This is how Rockstar open many garage doors (not all).

 

But before using moving opcodes (like 034d or 0381) you need to give the object the ability to move (objects ain't able to move when you create them) :

 

0392: object $object00 toggle_in_moving_list 1

 

  • 0 = unable to move
  • 1 = able to move
You can aswell throw the object (just like throwing a ball) with 0381 :

 

0381: throw_object $object00 distance 20.0 10.0 5.0 

 

  • 20 is the distance on x axis
  • 10 the distance on y axis
  • 5 the distance on z axis
You can attach object to cars, actors or other objects :

 

0681: attach_object $object00 to_car $car00 at_offset 0.5 0.3 0.3 rotation 0.0 0.0 0.0 069B: attach_object $object00 to_actor $actor00 at_offset 0.0 0.5 -1.0 rotation 0.0 0.0 0.0 069A: attach_object $object00 to_object $object01 at_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0 

 

Those are pretty obvious, and as I already explained about offsets, so I'll just have to tell that the three floats after rotation are the x y and z angles that will be set, and that the object isn't solid whan attach to something else.

 

 

If you don't want the object to be solid you can turn off the collision detection

 

0382: set_object $object00 collision_detection 0 

 

  • 0 not solid
  • 1 solid
You can make the object liftable like this :

user posted image

with 08e9 :

 

08E9: set_object $object00 liftable 1 

 

As usual 1 = on, 0 = off.

 

 

 

 

 

 

 

 

 

This is a very very very cool thing (thanks to DexX and PLPynton) :

user posted image

You can attach object to body parts of the actor, actually you can attach 2 object to the actor and make the actor do an animation !!!!!!!

There will be more on animation later, but I'll explain those now :

 

 

 

070A: AS_actor $PLAYER_ACTOR attach_to_object $object00 offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1

 

attach the first object (object A)

 

 

 

09A0: actor $PLAYER_ACTOR attach_object $object01 with_offset 0.0 0.0 0.0 on_bone 5 16 perform_animation "NULL" IFP_file "NULL" time -1

 

attach the second object (object B)

 

For both of them :

  • $PLAYER_ACTOR is the actor handle (here it's you CJ)
  • the three floats 0.0 0.0 0.0 are the x y and z offsets from the normal bone coordinates
  • the first integer 5 or 6 is the bone number (it's not the same as player body parts numbers for clothes)
    • 0 - crashes the game
    • 1 - chest?
    • 2 - neck?
    • 3 - left shoulder
    • 4 - right shoulder
    • 5 - left hand
    • 6 - right hand
    • 7 - root?
    • 8 - ??
    • 9 - left foot
    • 10 - right foot
    • 11 - right knee
    • 12 - ??
    • 13 - left elbow
    • 14 - right elbow
    • 15 - left clavicle
    • 16 - right clavicle
    • 17 - back of neck
    • 18 - mouth or chin
    • 19 - crashes the game
  • the second integer 16 is unknown and is always 16
  • the first long string "NULL" is the animation file (more on them later, and IT HAS TO BE LOADED like models) where the engine will get the animation. Here "NULL" means that no animation will be done.
  • the second long string "NULL" is the animation itself within the animation file. Here "NULL" again means that no animation will be done.
  • Last integer 0, 1 or -1 is unknown
To take theses objects off you have two opcodes :

 

 

070B: set_actor $PLAYER_ACTOR onbone_attached_object_operation 1 // drop or detaches object B automatically with object A 09A1: set_actor $PLAYER_ACTOR onbone_attached_objectB_operation 0 // drop or detaches object B only

 

 

070b : detaches/drops object A and B if object B attached

09a1 : detaches/drops object B

  • $PLAYER_ACTOR is still the actor handle (here it's you CJ)
  • the integer 1 or 0 tell if the object will be droped of just been detach.
    • 1 drops the object
    • 0 detaches the object

 

!!!!!!!!!!!!!!!!!!!!!!!!!!! watch out !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Attach object A fisrt because otherwise object B won't appear. When you hold object A you can't get in a car and your weapon won't be visible. If you hold two objects, object B will drop when you fall or shoot with a weapon. If you die both objects will drop.

 

 

 

 

As I said there is many things to do with objects in San Andreas but now you know the most important things you can do.

Edited by tomworld10

Share this post


Link to post
Share on other sites
tomworld10

8. Animations and particules :

 

 

 

A. Animations :

 

Lets get to something very important in GTA : The actors animations !!!!!!!!!!!!!!

The animations topic in SA in unending but as with objects we will see most important things.

 

First lets say what are animation sequences, they are animations of an actor. Like when CJ is moving his arms while talking, when Ryder is smoking, when CJ is using the keycard, or when CJ is using the parachute...

user posted image

More generally when an actor is making an action, when it's been animated !!

 

There is two types of animation sequences (AS), one which does one precise animation and another which make the animation you put as parameters in the opcode from the anims files (*.ifp in the anim.img file in anim folder of game directory). The second type need the animation to be loaded with 04ed, and as usual you need to check if the animation is loaded.

First type anims : one opcode does one animation

 

some examples :

 

05BA: AS_actor $actor00 chew_gum 10000 ms 05BB: AS_actor $actor00 fall_down 0 time_on_ground 500 05BC: AS_actor $actor00 jump 1 05C5: AS_actor $actor00 cower 3000 ms 05C7: AS_actor $actor00 use_atm 05C8: AS_actor $actor00 look_around 05C9: AS_actor $actor00 on_guard 2000 ms 05CD: AS_actor $actor00 exit_car $car00 05D3: AS_actor $actor00 go_to 81.42 1474.63 51.56 speed 4 3000 ms 05D4: AS_actor $actor00 rotate_angle 77.0 0639: AS_actor $actor00 rotate_to_actor $actor01 0672: AS_actor $actor00 attack_car $car00 0673: AS_actor $actor00 dive_to_offset 1.0 -3.0 time_on_ground 1000 ms 0676: AS_actor $actor00 in_car $car00 move_from_passengerseat_to_driverseat 0677: AS_actor $actor00 chat_with_actor $actor02 1 1 06A9: AS_actor $actor00 look_at_point 681.81 -474.15 15.53 5000 ms 06E3: AS_actor $actor00 roll_sideways 1 

 

 

 

They are the easiest to use, just put the opcode, the right parameters (the first is the actor which will do the animation ($actor00), then there are like said in the description either an angle (77.0), a 3D position (681.81 -474.15 15.53), a car ($car00), another actor ($actor01), the time the animation will last (5000) etc....

They're easy simple and work very well don't hesitate to use a lot of them !!!!!!

 

 

Second type anims : one opcode does the anim you have put as parameters

 

 

some examples :

 

0829: actor $actor00 perform_animation "CRCKDETH3" IFP_file "CRACK" 4.0 time 0 and_dies 0605: actor $actor00 perform_animation_sequence "PASS_RIFLE_PED" IFP_file "MISC" 4.0 loop 0 0 0 0 time -1 // versionA0812: AS_actor $actor00 perform_animation "LRGIRL_IDLELOOP" IFP_file "LOWRIDER" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB0A1A: actor $actor00 perform_animation "HIKER_POSE_L" IFP_file "MISC" 4.0 loopA 0 lockX 0 lockY 0 lockF 1 -1 ms // versionC088A: actor $actor00 perform_animation "RAIL_FALL" IFP_file "SWAT" 8.0 loopA 0 lockX 0 lockY 0 lockF 1 limT -1 unknown 0 unknown 1 070A: AS_actor $actor00 attach_to_object $object00 offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1 09A0: actor $actor00 attach_object $object01 with_offset 0.0 0.0 0.0 on_bone 5 16 perform_animation "NULL" IFP_file "NULL" time -1

 

 

Or with very good PLPynton's sascm.ini descriptions they look like this :

 

0829: char $actor00 perform_animation "CRCKDETH3" group "CRACK" 4.0 limT 0 and_dies 0605: char $actor00 perform_animation "PASS_RIFLE_PED" group "MISC" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 limT -1 //versionA 0812: char $actor00 perform_animation "EAT_VOMIT_P" group "FOOD" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 limT -1 //versionB 0A1A: char $actor00 perform_animation "VEND_EAT1_P" group "VENDING" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 limT -1 //versionC 088A: char $actor00 perform_animation "RAIL_FALL" group "SWAT" 8.0 loopA 0 lockX 0 lockY 0 lockF 1 limT -1 unknown 0 unknown 1 09A0: set_char $actor00 attach_objectB $object00 with_offset 0.0 0.0 0.0 on_bone 5 16 perform_animation "NULL" group "NULL" time -1 //object no 2 070A: set_char $actor00 attach_objectA $object00 with_offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" group "NULL" time 1 //object no 1 

 

 

 

 

 

 

First for those you have to load the animation file before using the animation opcode. It's aesy, it's just like we requested car and actors models before :

 

:ANIMLOAD0001: wait 0 ms 04ED: load_animation "FOOD"  00D6: if  04EE: animation "FOOD" loaded 004D: jump_if_false @ANIMLOAD

 

 

As you have probably noticed it's just a bit diferent than with models, because here you directly load the anim, and with models, you request (with 0247) and then load the models (with 038b).

 

Don't forget after using it to release the anim with

 

04EF: release_animation "LOWRIDER" 

 

 

 

Here to explain opcodes parameters I will use the PLPynton's sacsm.ini descriptions instead of using original Sanny Builder sascm.ini descriptions like I usually do, because it will be much easier for you to understand. But don't worry it is the same parameters order.

 

Parameters (thanks ceedj):

  1. The first word between quotation marks is the animation name ("CRCKDETH3", "PASS_RIFLE_PED", "HIKER_POSE_L", etc...)
  2. The second is the library (animation file) where the anim is ("CRACK", "SWAT", "VENDING", "FOOD", etc...).

    In some cases, like for 09a0 and 070a "NULL" means that no animation will be done, they are both explained in chapter 7.Objects and moving them.

  3. 4.0 is playback rate. Default is 4.0, less than this slows it down, more speeds it up and may skip animation frames with higher numbers.
  4. loopA or loop It's the Loop flag, to make the animation start again once finished. 1 on/0 off, BUT if on, Timelimit (parameter 8.) MUST be set to -1.
  5. lockX unlocks or locks actor in position on X axis. If 1 and if the actor is moving on the X axis from actor's origin (left to right), he will stay at those new coords. If 0, the actor will return to the start position coords.
  6. lockY unlocks or locks actor in position on Y axis. If 1 and if the actor is moving on the Y axis from actor's origin (front to back), he will stay at those new coords. If 0, the actor will return to the start position coords.
  7. lockF lock the actor in final postion. If 1 it will play the animation through once, then lock the actor into the final frame of the animation. This can NOT be stopped with opcode 0687 (clear_actor_task), but proceeding to another animation will.
  8. limT the Timelimit in milliseconds, is the time the actor will do the anim, set to 1000 ms for 1 second, 6000 ms for 6 seconds etc... If set to -1 it will play the entire animation, once through. With the Loop flag on (1), the animation will loop until interupted by either opcode 0687 (clear_actor_task) or another animation.
To find anims name and in which anim file they are you can look in the very good file wrtitten by ceedj : SAAnims.txt, but you can as well think of where this animation has been used in the original game, go in the mission or the external script in original main.scm it is used and search with Sanny Builder the anim you want in the mission/external you've seen it.B. Particules :

 

The particules in San Andreas are plenty of things, from little flees to cement or drops of yellow liquid I wouldn't drink. But as well as smoke, flames, teargas, water, coke, bullet shells, sparks, tree leafs, clouds, bits and pieces, some fires (but we have a better way to make fire)...

It is also called the Fxsystem, simply because they're special effects. In the same way as animations there is two types of particle or fx system. One type where you read from a particle file (named with a string variable, and has an handle for the engine like $particle00) which you have to activate with 064c, and another type where one looped opcode does everything.

 

Ok let's make some particles from particles files !!! It's pretty easy no need to load anything you just have to create it with those opcodes and make it visible with 064c :

 

0669: $particle00 = attach_particle "EXHALE" to_actor $actor00 with_offset 0.0 0.0 0.0 flag 1 066A: $particle00 = attach_particle "PETROLCAN" to_actor $actor00 with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0 flag 1 066B: $particle00 = attach_particle "PRT_SPARK" to_car $car00 with_offset 0.0 0.0 0.0 flag 1 066C: $particle00 = attach_particle "CEMENT" to_car $car00 with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0 flag 1 066D: $particle00 = attach_particle "SMOKE_FLARE" to_object $object00 with_offset 0.0 0.0 0.0 flag 1 066E: create_particle "COKE_TRAIL" attached_to_object $object00 with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0 flag 1 handle_as $particle00 064B: $particle00 = create_particle "PUKE" at 369.2483 162.346 1024.774 type 1064C: make_particle $particle00 visible

 

 

 

 

You can attach the effects to actors, cars, objets or from a coordinates. Each particle has is own way of moving : smokes goes up, liquid or semi-liquid flow down, sparks go mostly in all directions, powder just puffs. But you can give it a direction using the rotation angles, you'll probably have to go throught some testing to get it in the direction you want. Some effects are limited in time so you might have to repeat it. Never forget to activate it with 064C, you ALWAYS have to make it visible.

 

Params :

  1. $particle00 is the particle handle which you will use to recall it.
  2. "EXHALE" is what particle it is, cement, pee, smoke... You can find a list in Sanny Builder's Help contents in SCM Documentation: GTA SA: Particle effects
  3. $actor00 or $car00 or $object00 or coordinate is where it is attached
  4. The offset number is the of where the particle start, if 0.0 0.0 0.0 is from the center of the object/car/actor
  5. The next three number, 0.0 0.0 0.0 the rotation, is the direction the particle will go.
  6. But I don't know what the flag or type 1 but it's always 1.
If you use 0669 or 066a you can use 0883 to put it in different places on the upper body, but you'll still have to use 064c to activate the particle.

 

0883: attach_particle $particle00 to_actor $actor00 mode 5 

 

The last integer change the place of the fx :

-1 and under : make the particle invisible

0 : croth

1 : hip

2 : stomach

3 : chest

4 : neck

5 : mouth

6 : forehead

7 : head

8 : head

9 and more : make the particle invisible

 

With 064e you can make the particle invisible and make it visible again later with 064c.

 

064E: stop_particle $particle00 064C: make_particle $particle00 visible

 

 

 

0650 and 0976 just destroy your particle. But with 064f the particle will be visible until the camera will look elsewhere, but don't use the handle anymore.

 

0650: destroy_particle $particle000976: destroy_particle $particle00064F: remove_references_to_particle $particle00 

 

 

Here some others usefull effects, which are of the second type of effects, no need for activate it. They are not named by an handle, but as they're only temporary, you have to put it inside a loop with a wait.

 

09E5: create_flash_light_at 1306.4 -1137.5 22.5 RGB_mask 255 255 255 radius 200.0 09B8: create_blood_gush_at 791.7 -1627.0 12.3 with_offset 0.1 0.0 0.2 density 20 on_actor $actor00 08EB: create_sparks_at 1580.85 -1752.32 12.91 velocity_direction 0.0 0.0 1.0 density 60 095C: create_smoke_at -2365.3 1471.5 64.7 velocity -1.5 1.5 0.1 RGBA 0.0 0.0 0.0 0.2 size 1.0 last_factor 1.0 058A: create_gun_flash_from 2193.871 -1364.441 1031.124 to 2194.456 -1369.475 1031.124 06BC: create_M4_shoot_from 1193.268 1165.441 31.124 target 1195.58 1166.341 61.124 energy 1 

 

They pretty much speak for themselves, for 09e5, RGB_mask is the color in red, green, and blue in 0 to 255 values of the flashlight.

With 095c you can make the nicest smoke with cool colors, with floats used after RGBA the first three are red, green, blue, and the last one is the thickness (tranparency) of the smoke, and the last_factor is the time the cloud of smoke will disapear, 1.0 is about 20 to 30 seconds.

058a create is own smoke.

06bc actualy shoots, an actor will loose life if in sight, more the int value energy is high, more deadful it is.

 

You can also make shadows with the fx system (loop it as well) :

 

016F: create_particle 3 rotation_factor 1.0 size 3.0 intensity 50 flags 0 0 0 at 2221.179 -1177.662 24.767016F: create_particle 2 rotation_factor 0.0 size 1.0 intensity 150 flags 0 0 0 at 1303.211 -788.2426 95.5

 

Edited by tomworld10

Share this post


Link to post
Share on other sites
tomworld10

9. Animating vehicles and car mods :

driver behaviour

follow path/road

"put at" methode

AS drving

for plane/cars/boats

carmods, request set, numbers

carparts, open/close break/repair

trailers attach

Tyres inflate deflate

gas tank explosion

damage rules 03f5

fix/repair component 073c/068a

 

10. Fire, explosions and interiors :

 

 

A. Fire :

 

Humm fire... The nice smell of burnt plastic, make me love grenades in the morning. But first let's think SAFETY, we'll need some fire retardant just in case :

 

 

:LABEL000001: wait 0 ms 0247: load_model #FIRE_EX 00D6: if 0248:   model #FIRE_EX available 004D: jump_if_false @LABEL00 01B2: give_actor $PLAYER_ACTOR weapon 42 ammo 6000 // Load the weapon model before using this 

 

With this, you (the player) will have the fire extinguisher !!!!!

 

First, you need to know that fires can propagate themselves easily and extinguishing them in-game destroy it in the SCM engine, and that actors are immune to fire you can only set them on fire with opcode 0326, flamethrower or explosion. Lets look at the opcodes :

 

02CF: $fire00 = create_fire_at 1824.118 -2423.674 13.5547 propagation 7 size 8 0325: $fire01 = create_car $car00 fire 0326: $fire02 = create_actor $actor00 fire 06F5: create_coordinate $firepos_x $firepos_y $firepos_z from_fire $fire00 06C3: get_number_of_fires_within_sphere_at 1550.68 -1675.49 14.51 radius 1.2 store_to $firenumb 0786: get_number_of_fires_within_cube_cornerA 541.0 -1278.0 17.5 cornerB 536.0 -1275.0 31.5 store_to $firenumb 02D1: remove_fire $fire00 0980: extinguish_all_fires_at -973.759 1077.152 1350.399 radius 200.0 031A: remove_all_fires 055D: make_player $PLAYER_CHAR fireproof 1 

 

Where $fire00, $fire01 and $fire02 are the fire handles.

For 0325 $car00 is the car we'll put fire on, if not fireproof it will be damaged, and if not "damage_rules" (03f5) changed may explode.

Pretty much the same goes for 0326, $actor00 will be set on fire and will loose health if not extinguish.

With 06f5 the three dimensional position of $fire00 will be saved into $firepos_x $firepos_y $firepos_z.

Both 06c3 and 0786 will count fires in a circle or a cube and store it in $firenumb.

All 02d1, 0980, and 031a will extinguish the fire in-game, and empty the variable of the fire $fire00.

Finally 055d will make the player fireproof, like after finishing the firetruck sub-missions. 1 you're fireproof, 0 you're NOT.

 

 

B. Explosions :

 

Let's forget the safety now and blow everything down :

 

020C: create_explosion_with_radius 0 at 1827.1169 -2415.7666 13.5547 0565: create_soundless_explosion_at 681.8004 -474.1063 15.5363 type 7 0948: create_explosion_at 870.1503 -25.3395 62.9589 type 11 camera_shake 5.0 0356:   explosion_type -1 in_cube_cornerA 541.0 -1278.0 17.5 cornerB 536.0 -1275.0 31.5  

 

 

In here the floats are the positions, the good idea here is to use random numbers, and the int numbers 11, 0 and 7 are the type of the explosion.

 

Here is a little routine to make some nice explosions :

 

 

:LABEL0001: wait 10 ms 00AA: store_car $car00 position_to [email protected] [email protected] [email protected] 00A0: store_actor $actor00 position_to [email protected] [email protected] [email protected]: store_object $object00 position_to [email protected] [email protected] [email protected]: [email protected] = random_float_in_ranges -20.0 20.0 0208: [email protected] = random_float_in_ranges -15.0 15.0 0208: [email protected] = random_float_in_ranges -5.0 5.0 005B: [email protected] += [email protected] // (float)005B: [email protected] += [email protected] // (float) 005B: [email protected] += [email protected] // (float) 020C: create_explosion_with_radius 10 at [email protected] [email protected] [email protected] 000A: [email protected] += 1 00D6: if 0029:   [email protected] >= 150 004D: jump_if_false @LABEL 

 

 

By changing 10 in the wait the explosions will be more spaced, choose between actor, car, or object. By changing the random numbers you change the size of the area that will be strike. 150 is the number of explosions. Have fun

 

C. Interiors :

 

We've red the bible, we've play with explosives, so after passing out let's go to heaven where fast foods, shops, tattoo parlors, gym, shooting range, Liberty City, safehouses, casinos, hotel suite, Mansions are waiting for us !!!!!!

In GTA San Andreas all indoor area are not inside buildings, they're high up in the sky above maximum flight level in a so called world heaven. There is actually multiple heavens, seventeen of them. To be visible and solid actors, cars, objects, and player have to be linked to it, you can find a list of heavens and they're numbers in Sanny Builder's Help contents in SCM Documentation: GTA SA: GTA SA Interior. There is a lot a things to say with interior but a simple Google search will give you far more informations that you need.

We'll look here only at the opcode :

 

 

04BB: select_interior 0 0860: link_actor $actor00 to_interior 6 0840: link_car $car00 to_interior 140566: link_object $object00 to_interior 1 077E: get_active_interior_to $interior00 09E8: $interior00 = actor $actor00 active_interior 04F9: set_interior 1 color_to 0 04FA: reset_interior 0 colors 

 

 

Interior 0 is no interior, the normal outside world. The other numbers up to 18 are interiors. 04bb is for the camera and player, 0860 for actors like $actor00, 0840 for cars, and 0566 for objects.

077e is used to know in which interior the player is and save it to $interior00. 09e8 does the same with $actor00.

04f9 change the color of an interior, and 04fa change the interior back to normal color.

 

 

 

11. Cameras and directering scm cutscenes :

you're the director !!!!!

moving the camera

cam on vehicle/on actor looking to vehicle

in and out shot,

rendering indoor outdoor

use anims

skip cutscenes

12. Texts and panels :

panels

textboxes

text draw

gxt

13. Maths, stats and timers :

variables and int and floats where a float or int can be used you can use a variable that contains the float or the int

+/-

* /

==

stats

internal timer [email protected] [email protected]

14. Randoming and table jumps :

Random

table jumps

15. Arrays :

16. Missions and externals scripts :

starters mission/externals

One mission at a time, many external at the same time

locals range

Mission cleanup

Conclusion :

opcode search ****

do experiments

try easy for beginning

Immitate existing code

use you brain !!!

multiply information sources

use search google in domain gta forum, or gtaforum search tool

ask question there is plenty of good guys (hi you guys wink.gif ), I was like you a while ago, and someone helped me (thank you again Dem), now I'm here writting a tutorial.

CREDITS: cns (I wouldn't be here without him), Demarest (idem), Seeman (he created Sanny Builder !!!!), PLPynton, ceedj, Y_less, PatrickW, Gangsta Killa, Bigun, SteaVor but as well as anyone who posted opcodes description (like Opius, spaceeinstein, Craig Kostelecky, DexX...), and anyone who helped me or will helped me for this, as well as people who point out mistakes I've done in the bible, and maybe YOU soon...

 

Have fun

Edited by tomworld10

Share this post


Link to post
Share on other sites
tomworld10

reserved

Share this post


Link to post
Share on other sites
tomworld10

reserved

Share this post


Link to post
Share on other sites
tomworld10

reserved

Share this post


Link to post
Share on other sites
tomworld10

just to be safe

 

Share this post


Link to post
Share on other sites
tomworld10

We never know

Share this post


Link to post
Share on other sites
tomworld10

 

 

Hi,

 

 

It's been a busy nigh tonight, thank you all yo you guys for your help, and your support for this I grantly appreciate it and it's give me even more will to continue this.

 

Thank you again for correcting errors/typos/mistakes, now everytime someone will advice me of something, correction should be done in about a week. So please tell me about it by PM so I get an email telling me.

 

I think I have enough room to finish up part II without troubles so I "granted you the right" to make replies in here, so you can post questions, suggestions, comments right now. But for correction please stick to PM, it will be easier for me, thank you.

 

 

I got to go sleeping, but I'll thank you all for everything.

 

 

Have fun

 

 

 

Share this post


Link to post
Share on other sites
domagoj_z

can you now please write a code that brings cheetah on coordinates -2052.4907, 145.6189, 28.8359 and the angle 187.5421

 

i've tryed and my game crashes......just for the record.....you place that code before the -------mission 0-----? thanks

 

Share this post


Link to post
Share on other sites
ZAZ

 

can you now please write a code that brings cheetah on coordinates -2052.4907, 145.6189, 28.8359 and the angle 187.5421

 

i've tryed and my game crashes......just for the record.....you place that code before the -------mission 0-----? thanks

Open a new topic in mission coding section to discuss your problem

and

post your script !!!

Share this post


Link to post
Share on other sites
Deji

Ever need any help with the bible then I'm willing to lend a hand smile.gif

Share this post


Link to post
Share on other sites
TheSiggi

Do'hh!!

 

The part I absoulutely need is still not written XD

Share this post


Link to post
Share on other sites
Deji
Do'hh!!

 

The part I absoulutely need is still not written XD

What d'yeh need help with? smile.gif

Share this post


Link to post
Share on other sites
haroon snm

 

can you now please write a code that brings cheetah on coordinates -2052.4907, 145.6189, 28.8359 and the angle 187.5421

 

i've tryed and my game crashes......just for the record.....you place that code before the -------mission 0-----? thanks

{$CLEO .cs}

03A4: name_thread 'TEXT'

0001: wait 1000 ms

0A95: enable_thread_saving

014B: [email protected] = init_parked_car_generator #CHEETAH color -1 -1 1 alarm 0 door_lock 0 0 10000 at -2052.4907, 145.6189, 28.8359 angle 187.5421

014C: set_parked_car_generator [email protected] cars_to_generate_to 101

0A93: end_custom_thread

 

 

 

make new sanny builder file and compile it

then save in your cleo folder

 

if your gunna modify your main.scm your gunna have to start your game again

thats why i sed make a cleo (.cs) file.. biggrin.gif

 

put the angle in the coordinatess line (not enough space on here)

 

tell me if it worked!

 

 

bye biggrin.gifbiggrin.gif and do wat zaz sed next time! biggrin.gifbiggrin.gif bye

Edited by haroon snm

Share this post


Link to post
Share on other sites
Adler

After three years, I don't think he still needs that question answered. Check the post dates next time before replying. wink.gif

Share this post


Link to post
Share on other sites
Hayate Kankichi

Look I need a help. I want to make a script Which could help to fire Sniper bullets like Battlefield style. So I don't know how to set it's velocity.
I know how to set it's effect on object but here comes the some problems, Can you please help me to solve them.

 

1. I don't know how to set Projectile's direction which is based on camera's position (I try it with player's cords but I can't set it with Camera's cords)

2.What command should be use to make it just throw. don't want it to just let it move. I want bullet drop too. (I saw a Captain america shield throw mod which is same as I want the mod)

3. in Scripting I found that it's crashing the game. and I don't know why but script is shows that it's completed and compiled, but why it's crashed I have no idea.

4. I know how to set a scope for mod, and it's position and scale, but there is a huge problem that when I try to use it some times it's kinda glitched, it's completely turns white, and alpha is gone. Don't know why, So this is huge reason why I can't use that kind of Battlefield sniper scope.

 

I m waiting for your reply please help me to solve this problem.

And before you telling me about script let me clear it first. I make a script by looking at your tutorial and I already make a script for Single player.

here is the link

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 2 Users Currently Viewing
    0 Members, 0 Anonymous, 2 Guests

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.