Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,908 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

ZAZ

[SA] ~ CLEO Script Tutorial ~

Recommended Posts

Diegoti

 

Hello i have to said something:

I come from the Warcraft 3 world editor, where all the scripts had three factors.

 

Event -> Something that must happen for the script to run

examples: cj jumps, a car explodes, cj dies, cj enters X area. etc

Standart Cleo scripts start automaticly as soon as ingame world is present, initialized by cleo.asi

 

As example a very simple script that displays the internal timer [email protected]

(local variable [email protected] and [email protected] are reserved for timer, never use it for anything else)

 

Low level script

 

{$CLEO .cs}thread 'TIMER':Runwait 003F0: enable_text_draw 1045A: text_draw_1number  100.0  200.0 'NUMBER' [email protected]    // valuejump @Run
High level script

 

{$CLEO .cs}thread 'timer'while truewait 003F0: enable_text_draw 1 045A: draw_text_1number 100.0  200.0 GXT 'NUMBER' number [email protected]

It's also possible to initialized a script by another script. In any way, it requires always a standart cleo script initialized by cleo.asi as trigger script

1. The mission script

 

The trigger script needs opcode 0A94: to start a mission script

 

{$CLEO .cs}thread 'Trigger'$ONMISSION =  10A94: start_custom_mission "MyMission"0A93: end_custom_thread
The mission script must have {$CLEO .cm} as *.cm file and the file must have the name that is called by the trigger script, in this case MyMission.cm

 

{$CLEO .cm}thread 'Mission'00BA: text_styled 'M_PASS'  5000 ms  1$ONMISSION =  0004E: end_thread

 

 

2. Another standart cleo script with extention *.s

 

The trigger script needs opcode 0A92: to start a another standart cleo script

 

{$CLEO .cs}thread 'Trigger'0A92: create_custom_thread "timer.s"0A93: end_custom_thread
The other script must have {$CLEO .s} as *.s file and the file must have the name that is called by the trigger script, in this case timer.s

 

{$CLEO .s}thread 'timer'while truewait 003F0: enable_text_draw 1 045A: draw_text_1number 100.0  200.0 GXT 'NUMBER' number [email protected]    if        [email protected] > 7000    then        [email protected] = 0    endend
you can also give other extensions by renaming the file manually, for example rename timer.s into timer.xxx

and use following in the trigger script:

 

0A92: create_custom_thread "timer.xxx"

 

 

Condition -> This is what decides to run or not to run the script (its like a IF)

example: cj dies -> if cj is in x area -> run action so

Condition isn't required to run a script but it's the propper way to let the code pass inside the the script to the action part.

Also should the trigger script have conditions in case if you want to start another script.

 

But mostly we have a standart Cleo script that starts automaticly

Best way is to build a loop, let's say a default loop that contains the main conditions, that needs to be passed and then can go to the action codes

Check always if player_char is present or ready with opcode 0256: and then the main condition, then the action

And in following an action loop that contains again 0256:

check the script inside the spoiler, it let the player_char do animation by keypress backspace

 

 

Low level script

 

{$CLEO .cs}:IFP_PARKthread 'IFPPARK':IFP_PARK_1wait 0if0256:   player $PLAYER_CHAR definedjf @IFP_PARK_1if0AB0:   key_pressed 8//-----------------key = Backspacejf @IFP_PARK_104ED: load_animation "PARK":IFP_PARK_5wait 0if04EE:   animation "PARK" loadedjf @IFP_PARK_50812: AS_actor $PLAYER_ACTOR perform_animation "Tai_Chi_Loop" IFP_file "PARK" 1.0 loopA 1 lockX 1 lockY 1 lockF 0 time -1 // versionB0001: wait 1000 ms:IFP_PARK_7wait 0if0256:   player $PLAYER_CHAR definedjf @IFP_PARK_12if and8AB0:   not key_pressed 8//-----------------key = Backspace80E1:   not player 0 pressed_key 15jf @IFP_PARK_12jump @IFP_PARK_7:IFP_PARK_120792: disembark_instantly_actor $PLAYER_ACTOR04EF: release_animation "PARK"0001: wait 1000 msjump @IFP_PARK_1
High level script

 

{$CLEO .cs}thread 'Tai_Chi'while truewait 0    if        0256:   player $PLAYER_CHAR defined    then        if            0AB0:   key_pressed 8//-----------------key = Backspace        then            04ED: load_animation "PARK"                    while 84EE:  not animation "PARK" loaded                wait 0            end            0812: AS_actor $PLAYER_ACTOR perform_animation "Tai_Chi_Loop" IFP_file "PARK" 1.0 loopA 1 lockX 1 lockY 1 lockF 0 time -1 // versionB            wait 1000                        while 0256:   player $PLAYER_CHAR defined                wait 0                if or                    0AB0:   key_pressed 8//-----------------key = Backspace                    00E1:   not player 0 pressed_key 15// --- key = Enter/Exit                then                    break                end                end                       0792: disembark_instantly_actor $PLAYER_ACTOR            04EF: release_animation "PARK"             wait 1000        end    endend

 

 

Note: it's important to check if the stuff is alive

check if actor isn't dead if he should do something

check if the car isn't wrecked if it do something of should give informaions

 

Other example:

Cj enters to X area -> If cj is driving a Hydra -> Add 6 stars

Ok, script below gives 6 stars in case if cj is driving a Hydra at Grovesstreet, if not it gives 0 stars

 

 

Low level script

 

{$CLEO .cs}thread 'HYDRA' :HYDRA_1wait 0 if 0256:   player $PLAYER_CHAR defined jf @HYDRA_1 if and00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2487.653 -1669.195 13.3359 radius 90.0 90.0 350.0 00DD:   actor $PLAYER_ACTOR driving_car_with_model #HYDRA jf @HYDRA_1 010D: set_player $PLAYER_CHAR wanted_level_to 6 :HYDRA_3wait 0if0256:   player $PLAYER_CHAR defined jf @HYDRA_5 if or80FE:   not actor $PLAYER_ACTOR sphere 0 in_sphere 2487.653 -1669.195 13.3359 radius 100.0 100.0 400.0 80DD:   not actor $PLAYER_ACTOR driving_car_with_model #HYDRA jf @HYDRA_3 :HYDRA_5010D: set_player $PLAYER_CHAR wanted_level_to 0 jump @HYDRA_1 
High level script

 

{$CLEO .cs}thread 'HYDRA'while truewait 0    if        0256:   player $PLAYER_CHAR defined    then        if and            00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2487.6528 -1669.1953 13.3359 radius 90.0 90.0 350.0            00DD:   actor $PLAYER_ACTOR driving_car_with_model #hydra        then            010D: set_player $PLAYER_CHAR wanted_level_to 6                        while 0256:   player $PLAYER_CHAR defined                wait 0                if or                    80FE:  not actor $PLAYER_ACTOR sphere 0 in_sphere 2487.6528 -1669.1953 13.3359 radius 100.0 100.0 400.0                    80DD:  not actor $PLAYER_ACTOR driving_car_with_model #hydra                then                    break                end                        end                        010D: set_player $PLAYER_CHAR wanted_level_to 0                    end    endend 

 

Thanks bro!

Share this post


Link to post
Share on other sites
Evil empire

I found a solution with the missing Frosted winter bonus.

 

I'd still like to know about unlocking the quadruple insane stunt through CLEO, please.

Share this post


Link to post
Share on other sites
ZAZ
Posted (edited)

You can't modify main.scm code by cleo script

have you read here and here?

Edited by ZAZ

Share this post


Link to post
Share on other sites
Recommended

@MH-T88

 

I don't think Zaz's Cleo tutorial topic should be used for requesting. It's kind of rude to drop in here and demand someones cleo mod to be fixed. This is more suited: GTA 3D Era Modding Requests & Finds

Share this post


Link to post
Share on other sites
MH-T99
12 hours ago, Recommended said:

@MH-T88

 

I don't think Zaz's Cleo tutorial topic should be used for requesting. It's kind of rude to drop in here and demand someones cleo mod to be fixed. This is more suited: GTA 3D Era Modding Requests & Finds

Sorry, I didn't know this is not the suitable topic. My mistake.

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

×

Important Information

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