Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,780 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

Sign in to follow this  
Shmoopy

Cleo User Interface [How To]

Recommended Posts

Shmoopy

Hi There , today i'm gonna show you the way to include a custom User Interface into GTA:SA via coding ...

So here are the steps to procceed with :

 

1. We will collect first some images from Google that are related to our theme of the project , in my case , i chose " Hitman 2 ".

 

2.Then , we will create a new TXD dictionary that will hold the pictures as textures for the game.

3.And the finale step will be of course Coding the script , wich will be in this case a MissionPack (MPACK)

 

 

 

So lets begin ...

 

 

______________________________________________________________________________

 

Before you begin

______________________________________________________________________________

 

 

You will need to have these tools : Sanny Builder ; CLEO 4 ; TXD Workshop .

 

______________________________________________________________________________

 

Downloading the pictures

______________________________________________________________________________

 

 

We will need for this Hitman 2 UI :

 

1. A cursor icon

2. Some cool hitman background

3. Menu text ( Start Game , Load Game ...) wich can be done by urself without download ...

 

Cursor ; Background

 

user posted image ; http://www.zastavki.com/pictures/1024x768/..._2_001426_1.jpg

 

 

 

Save your pictures at your desktop , rename the cursor picture "Cursor" and the Background "Menu" , Note that the pictures should either be one of the following formats : BMP , PNG or TGA , if not then convert them .

______________________________________________________________________________

 

Setting up the TXD file

______________________________________________________________________________

 

Using Txd workshop 4.5 open a txd file that u find at /Models/Txd folder , any one , it doesn't matter ... then Click >> File >> Save as >> and name the new file Hitman.txd , click Save .

Now Close the txd file and open Hitman.txd , then delete all the images that you find in it , and start sliding the ones that you downloaded ( Cursor , background ...) on top of the Software ... now you should see you pics added in the list , Compress them by clicking on Image >> Compress All .

Save the TXD

 

______________________________________________________________________________

 

Coding

______________________________________________________________________________

 

Now its coding time , the file that i attached with the topic contains he MPACK folder , put it at GTA SA USER FILES /

 

Here i 'll explain why i did this and that ...

 

I created 3 threads : Load , Menu and Check .

 

The "Load" Thread will be used to load your models that you'll need for your missions , we dont need any models in our UI ...

 

Menu will hold our script of the User Interface .

 

Check will be used for loop .

 

 

_____________________

 

thread 'Load'

_____________________

 

 

:Loadthread 'Load' wait 0end_thread   

 

 

Empty as we dont need any models ...

 

_____________________

 

thread 'Menu'

_____________________

 

 

:Menuthread 'Menu' wait 0$GUI = 00390: load_txd_dictionary 'hitman' 038F: load_texture "cursor" as 1 // Load dictionary with 0390 first  038F: load_texture "menu" as 2 // Load dictionary with 0390 first 038F: load_texture "none" as 3 // Load dictionary with 0390 first  038F: load_texture "selec" as 4 // Load dictionary with 0390 first 0A8C: write_memory 0xBA6745 size 1 value 0 virtual_protect 003F0: enable_text_draw 1$x = 320.0$y = 224.0$sl == 3Player.CanMove($PLAYER_CHAR,0)0826: enable_hud 0 0581: enable_radar 0 fade 1 800$GUI = 1:Menuwait 0if and$sl == 40AB0:  key_pressed 1thenjump @StartGameelse0A4A: store_joystick_X_offset_to [email protected] Y_offset_to [email protected] 0059: $x += [email protected] // (float) 0059: $y += [email protected] // (float) 03E3: set_texture_to_be_drawn_antialiased 1 038D: draw_texture 2 position 320.0 224.0 size 640.0 448.0 RGBA 255 255 255 255038D: draw_texture $sl position 100.0 210.0 size 100.0 25.0 RGBA 255 255 255 255 038D: draw_texture 1 position $x $y size 20.0 20.0 RGBA 255 255 255 255 endjump @Menu:StartGamewait 0fade 0 0wait 5000391: release_txd_dictionary Player.CanMove($PLAYER_CHAR,1)0A8C: write_memory 0xBA6745 size 1 value 1 virtual_protect 0  Audiostream.PerformAction($rollo,STOP)$GUI = 001B2: give_actor $PLAYER_ACTOR weapon 23 ammo 100 // Load the weapon model before using this 01B2: give_actor $PLAYER_ACTOR weapon 29 ammo 100 // Load the weapon model before using this wait 1000fade 1 500end_thread   

 

 

 

 

$GUI = 0

$x = 320.0

$y = 224.0

$sl == 3

Its a variable that i declared that will let the game to check if the menu is active or not : $GUI = 1 means Menu is shown , 0 means not shown. $x and $y reffers to the position of the Cursor , $sl ( selected ) will be used at the Check thread to see if the cursor is on the "Start Game" if true , $sl becomes 4 ( Start game turns red ) if not , $sl is 3 ( Start game is grey , not selected )

 

 

 

0390: load_txd_dictionary 'hitman'

038F: load_texture "cursor" as 1 // Load dictionary with 0390 first 

038F: load_texture "menu" as 2 // Load dictionary with 0390 first

038F: load_texture "none" as 3 // Load dictionary with 0390 first 

038F: load_texture "selec" as 4 // Load dictionary with 0390 first

Loads the Hitman.tx that we've made earlier along with the 4 textures

 

 

 

03F0: enable_text_draw 1

We will start to draw on the screen , so we need this .

 

 

if and

$sl == 4

0AB0:  key_pressed 1

then

jump @StartGame

 

As you know the Menu thread and the Check thread are running simultaneously , they are cooperating , this Check ( if and ) will see if the cursor is on "Start game" ( if you habe selected it ) and if you pressed it ( key pressed 1 means you pressed Left Mouse Button ) then the Game starts . ( [email protected] startgame )

 

 

 

 

else0A4A: store_joystick_X_offset_to [email protected] Y_offset_to [email protected] 0059: $x += [email protected] // (float) 0059: $y += [email protected] // (float) 03E3: set_texture_to_be_drawn_antialiased 1 038D: draw_texture 2 position 320.0 224.0 size 640.0 448.0 RGBA 255 255 255 255038D: draw_texture $sl position 100.0 210.0 size 100.0 25.0 RGBA 255 255 255 255 038D: draw_texture 1 position $x $y size 20.0 20.0 RGBA 255 255 255 255 endjump @Menu

 

 

If you didn't press Start Game , then the script continues updating the Cursor's positions , notice that

: 0A4A: store_joystick_X_offset_to [email protected] Y_offset_to [email protected] does not store the actual position of the cursor , instead it just checks within you move your mouse left ( negative float ) or right ( positive float ) up ( positive float ) or down ( negative float ) , so if you dont move your mouse , the value becomes 0.0 , therefore , i used the :

0059: $x += [email protected] // (float)

0059: $y += [email protected] // (float)

And it turned out that it just fits perfectly , pure luck ...

 

______________________________________________________________________________

 

Prefiew

______________________________________________________________________________

 

 

 

 

 

 

______________________________________________________________________________

 

Download

______________________________________________________________________________

 

 

Click here

Share this post


Link to post
Share on other sites
LINK/2012

Guy, fix those global variables. Don't use global variables in CLEO.

Share this post


Link to post
Share on other sites
Michael-Knight1

dude Use end custom thread in cleo cryani.gif

Share this post


Link to post
Share on other sites
ZAZ

 

Guy, fix those global variables. Don't use global variables in CLEO.

 

dude Use end custom thread in cleo  cryani.gif

He posted codes for MPACK, but yes, locals are always better if possible

use 0A93: end_custom_thread in cleoscripts

use end_thread in main.scm

 

Share this post


Link to post
Share on other sites
Deji

He's indecisive. The topic says "Cleo User Interface", yet his examples are written under the premise that they're MPACK's.

 

I can't believe this was moved to tutorials tounge.gif

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  

×

Important Information

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