Author Topic: [SA] SCM Tutorials  (Read 3530 times)

0 Members and 1 Guest are viewing this topic.

Offline JayFoxRox

  • Posts: 2221
    • View Profile
    • Homepage
[SA] SCM Tutorials
« on: August 13, 2006, 02:49:54 PM »
*Coming soon - Please dont remove*

S C M - T u t o r i a l s
by J-Fox

Before Starting

What is SCM?

SCM is the Mission Scripting engine made by R* for GTA3. Its almost the same in VC and SA. The only thing which changed is the opcode range/function. An opcode is an number pointing to a function in GTA.

Code: [Select]
0001: Wait 100 ms
In this case the 0001 is the Opcode. 100 is the time the game waits until the next opcode gets executed. Values which are needed for an opcode (called params/parameter) can be either  float, integer or variable.

Float: 123.45
Integer: 123
Variable (Global): $Variable
Variable (Local): @0 - @16
(Local stuff will be shown later)

so basicly:

Code: [Select]
0001: Wait 123 ms
equals to

Code: [Select]
0004: $Wait = 123
0001: Wait $Wait ms

because the $Wait is defined as 123!

There are more than 1000 opcodes! They can be found on 2 pages:

http://vc-db.webtools4you.net/ < VC
http://sa-db.webtools4you.net/ < SA

Alot of them can be found on gtaforums.com as well but the database is more handy in my opinion.

Ok this have been the really basic description of SCM

The editor works like this:

$ - Global
@ - Local
: - Sub/Label
;; - Comment
££ - Global jump
£ - Local jump

i allready shew you how to use the global variables. the others are working like this

Code: [Select]
:LOOP            
0001: wait  10 ms
;; My Text! This is ignored by the editor. The following too
;; 0001: wait 1337 ms
0002: jump ££LOOP

The editor is kewl and helps you alot finding opcodes. So when typing:

wait

in a empty line and you press F1 while the word is marked it will change to the first keyword found which will be

Code: [Select]
0001: wait 1000 ms
Also the editor isnt looking at the text in normal code lines with opcodes. So:

Code: [Select]
0001: wait 1000 ms
equals to

Code: [Select]
0001: 1000
or

Code: [Select]
0001: set_player_health 1000
because the builder is only looking on the params (1000) and the opcode (0001)
However: Opcode 0001 (which leads to the wait function) requires one parameter only and the type MUST be integer. So this one wont work:

Code: [Select]
0001: set_player_health 1000.0
same as:

Code: [Select]
0001: wait 1000.0
Maybe it isnt crashing but sometimes the value is used wrong by the game so it will cause into lag or fatal errors

What you will need
  • GTA: San Andreas - V1.0
  • BW SA-Mission builder 0.3 - Download
Setting up the mission builder

Extract the mission builder and open the SASCM.ini using notepad. At the bottom simply add this text:

Code: [Select]
0A4A=2,%1h% %2h%
0A4B=0,

Now save and close the file.

To make SA Builder fully functional now Copy the following files to the mission builder directory:

data/default.ide
data/peds.ide
data/vehicles.ide

so the 3 files are in the same directory as the SABuilder033.exe

Markup Script

LESSON 1:
The Basics


*Coming soon*

LESSON 2:
Adding more checks


*Coming soon*

LESSON 3:
The best markup script in the world


*Coming soon*

The final code

Known bugs:
  • Can be used to exploit the game when getting caught or wasted..
  • Respawn still needs to be improved - Use current car instead new one
  • Tuning states arent safed yet
Code: [Select]
;; Markup Script:

:Markup_Initialize
0004: $Markup_ID = -1 ;; integer values      

:Markup
0001: wait  50 ms  

:Markup_Get
00D6: if  0
00E1:   key pressed  0  11
004D: jump_if_false ££Markup_Set  

018C: play sound  1056 at  0.0 0.0 0.0

00D6: if  0
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false ££Markup_Get_Foot

:Markup_Get_Car                  
03C0: $Markup_Player = actor $PLAYER_ACTOR car
0441: $Markup_ID = car $Markup_Player model
00AA: store car $Markup_Player position to $Markup_X $Markup_Y $Markup_Z      
0174: $Markup_A = car $Markup_Player z_angle
0001: wait  100 ms
0002: jump ££Markup_Set

:Markup_Get_Foot                                                            
0004: $Markup_ID  =  0 ;; integer values
00A0: store actor $PLAYER_ACTOR position to $Markup_X $Markup_Y $Markup_Z  
000D: $Markup_Z -=  .981 ;; floating-point values
0172: $Markup_A = actor $PLAYER_ACTOR z_angle    
0001: wait  100 ms

:Markup_Set  
00D6: if  1
00E1:   key pressed  0  10    
8038:   NOT   $Markup_ID ==  -1 ;; integer values    
004D: jump_if_false ££Markup            

018C: play sound  1056 at  0.0 0.0 0.0

00D6: if  0
8038:   NOT   $Markup_ID ==  0 ;; integer values
004D: jump_if_false ££Markup_Set_Foot  

016A: fade  0 ()  100 ms
0001: wait  100 ms
00D6: if  0          
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false ££Markup_Set_Car    
0362: remove actor $PLAYER_ACTOR from car and place at  $Markup_X $Markup_Y 1000.0
:Markup_Remove
0001: wait  50 ms
00D6: if  0
80DF:   NOT   actor $PLAYER_ACTOR driving
004D: jump_if_false ££Markup_Remove
:Markup_Create_Car
00A6: destroy car $Markup_Car
00D6: if  0
8248:   NOT   model $Markup_ID available
004D: jump_if_false ££Markup_Teleport
0247: request model $Markup_ID
038B: load requested models      
:Markup_Teleport
00A5: $Markup_Car = create_car $Markup_ID at  $Markup_X $Markup_Y $Markup_Z  
0249: release model $Markup_ID
:Markup_Set_Car  
036A: put actor $PLAYER_ACTOR in car $Markup_Car    
00AB: put car $Markup_Car at $Markup_X $Markup_Y $Markup_Z
0175: set_car $Markup_Car z_angle_to  $Markup_A
0229: set car $Markup_Car color to  $Markup_Color_A  $Markup_Color_B
02EB: restore camera with jumpcut  
016A: fade  1 ()  100 ms
0001: wait  100 ms
0002: jump ££Markup

:Markup_Set_Foot    
016A: fade  0 ()  100 ms
0001: wait  100 ms
00D6: if  0          
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false ££Markup_Set_Foot_Fixed  
0622: AS unknown remove actor $PLAYER_ACTOR from car $Markup_Car      
0362: remove actor $PLAYER_ACTOR from car and place at  $Markup_X $Markup_Y 1000.0
:Markup_Set_Foot_Fixed
00A1: put_actor $PLAYER_ACTOR at  $Markup_X $Markup_Y $Markup_Z
0173: set_actor $PLAYER_ACTOR z_angle_to  $Markup_A            
02EB: restore camera with jumpcut                        
016A: fade  1 ()  100 ms
0001: wait  100 ms
0002: jump ££Markup
« Last Edit: August 15, 2006, 03:14:36 AM by Fox »

Offline BlackPearl

  • Posts: 687
    • View Profile
    • http://
[SA] SCM Tutorials
« Reply #1 on: August 13, 2006, 03:10:07 PM »
A, Helpfull is all i can Say  
i Could make a Tut For making Spawning Places for cars, weapons etc.

Offline JayFoxRox

  • Posts: 2221
    • View Profile
    • Homepage
[SA] SCM Tutorials
« Reply #2 on: August 13, 2006, 03:12:06 PM »
This is going to be more complex. I will explain how to add a spawner while runtime so you select a car type for spawning etc.

and the markup script is able to remember runup points etc so when bailing you simply press a key to get the car back to the runup and put you back on driverseat.

Offline Fugitive

  • Veteran Member
  • Posts: 4883
    • View Profile
    • http://www.fugitivesplace.3x.ro
[SA] SCM Tutorials
« Reply #3 on: August 13, 2006, 03:48:46 PM »
Great job, I can't wait to see more, professor.
« Last Edit: August 13, 2006, 03:49:11 PM by Fugitive »

Offline Master_Yayo

  • Posts: 1523
    • View Profile
    • http://
[SA] SCM Tutorials
« Reply #4 on: August 13, 2006, 04:03:25 PM »
memorize your runup and vehicle spawn points! that sounds wicked insane! It's crazy how much time you'd save. ps2 is so lame! lol

Offline Daffy

  • V.I.P. Member
  • Posts: 13506
  • WH & NU Founder
    • View Profile
[SA] SCM Tutorials
« Reply #5 on: August 13, 2006, 04:14:14 PM »
Make a SA MAIN.SCM with a spawner that has Spoosh features, yeah do that!

Offline JayFoxRox

  • Posts: 2221
    • View Profile
    • Homepage
[SA] SCM Tutorials
« Reply #6 on: August 13, 2006, 04:20:31 PM »
Quote from: Master_Yayo
memorize your runup and vehicle spawn points! that sounds wicked insane! It's crazy how much time you'd save. ps2 is so lame! lol

This works on Xbox and PS2 too. Simply burn it to a DVD when done and play using a modchip or copy to your cache or HDD  

Offline Master_Yayo

  • Posts: 1523
    • View Profile
    • http://
[SA] SCM Tutorials
« Reply #7 on: August 13, 2006, 05:00:35 PM »
what's a modchip, or HDD, and how do you copy to cache. (ps2)?

Offline Dannye

  • Veteran Member
  • Posts: 3567
    • View Profile
[SA] SCM Tutorials
« Reply #8 on: August 14, 2006, 07:27:39 AM »
Quote from: Fox
... and put you back on driverseat.

If you get that working, I'd love to see how you went about it, because when I was doing it for the VC USCM I found some crazy bugs which I had to work-around, and I've always been curious if there's a better way of doing it (and I'm sure if anyone here can do that, its you).

Offline JayFoxRox

  • Posts: 2221
    • View Profile
    • Homepage
[SA] SCM Tutorials
« Reply #9 on: August 15, 2006, 03:09:58 AM »
Just added the first version of the markup script > But its alot of work to doc it so you have to wait a bit until the "lessons" for it are released

To add the code to your main.scm simply add it on the bottom - just after mainloop and add this code: 004F: create_thread ££Markup_Initialize   just before the mainloop.

This will create a new section in RAM (aka Thread) which is our code. The code is looped and checks for the keys 11 (Conversation Yes) and  10 (Conversation No) and markups the current position, angle and vehicle model  When the Conversation no key is pressed it will simply teleport you.
« Last Edit: August 15, 2006, 03:15:04 AM by Fox »

Offline Fugitive

  • Veteran Member
  • Posts: 4883
    • View Profile
    • http://www.fugitivesplace.3x.ro
[SA] SCM Tutorials
« Reply #10 on: August 15, 2006, 02:10:08 PM »
I was always wondering how to do that, thanks for sharing your knowledge!

EDIT:
I just tested it and...  Oh my God dude, it's totally awsome  I guess I'll use it instead of SACC.
« Last Edit: August 15, 2006, 04:20:59 PM by Fugitive »

Puto_jr

  • Guest
[SA] SCM Tutorials
« Reply #11 on: September 03, 2006, 12:29:00 PM »
cool tutorial

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal