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

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    1. Announcements

    2. Support

    3. Suggestions

Please be aware that this is not a tutorial request forum! Use the appropriate topic for the effect.
Sign in to follow this  

[CLEO]Some Tutorials...

Recommended Posts


Since so many people have been helping me lately (thanks biggrin.gif) I thought I'd do something to help others... Here are some tutorials I made AGES ago but never had a chance to post here...



Making Panels


This is one of the things I hate doing most when it comes to coding. It's annoying and requires wayy too much coding for the simple thing it does. This is useful for making menus in which people can choose things...


The way I'm going to be teaching is only a fraction of what you can do with panels, but hopefully you will experiment with what I've taught you and learn how to do things for yourself.



Firstly, we need to create the panel...


08D4: [email protected] = create_panel_with_title 'MYPAN' position 29.0 170.0 width 180.0 columns 1 interactive 1 background 1 alignment 0


[email protected] is the variable where the panel is stored and can be accessed by. You should already know about the basics of variables.


title 'MYPAN' is the text that appears at the top in the San Andreas font. Don't be confused into thinking that the text will be "MYPAN" in-game. 'MYPAN' is simply the entry name in the gxt file. You should already know about using gxt.


position 29.0 170.0 is the location of the panel. No, this is not coordinates. It's the location on the screen which is why it only has X and Y axis'. You may need to experiment to get it in the right place on the screen.


width 180 is the width of the panel. The wider the panel, the more text you can put on without squashing it up. Although, too wide and it may cover up the screen.


columns 1 are the amount of columns. If you don't know what a column is... Go to school!


interactive 1 whether the user can interact with the column... 1 = on, 0 = off. If off, then the user cannot select rows.


background 1 whether the panel should have a semi-transparent black background. 1 = on, 0 = off.


alignment 0 whether the panel is left, right or center aligned.



Now you'd have a panel with some stylish text at the top and nothing else on it. So let's put some stuff on it!



08DB: set_panel [email protected] column 0 header '50' data '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' '11' 'DUMMY'


[[email protected]] is the panel we're effecting...


[column 0] is which column we're changing the rows of.


[header '50'] is the gxt of a header. This looks rather ugly though, I recommend using it if you want to add notes about the panel.


[data '1' '2' ect.] Are the rows. You MUST NOT delete any strings (' ') or the game will not like you. Instead just change any you don't want to 'DUMMY'.


Again, header and data strings (' ') are the gxt entries of each row. '1' would be the top row... 'DUMMY' is the bottom. 'DUMMY' is nothing... It not only displays no text, but disables the whole row.


You can user 1number gxts using 08EE to do each row one at a time. It's a bit more tedious but managable.


Now you'll have a panel with text! You can press up and down to select the rows. But one problem... Nothing happens when you try to exit (Enter) or select (Sprint)!




Randomization Tutorial



Here's a lil tutorial on ways to make something random.


There are 3 ways to do this. The first way is to use a jump table like this...


0871: init_jump_table $VIDEO_GAME total_jumps 8 default_jump 0 @MAIN_5502 jumps 0 @MAIN_5335 1 @MAIN_5353 2 @MAIN_5371 3 @MAIN_5389 4 @MAIN_5407 5 @MAIN_5425 6 @MAIN_5443


0872: jump_table_jumps 7 @MAIN_5461 -1 @MAIN_5502 -1 @MAIN_5502 -1 @MAIN_5502 -1 @MAIN_5502 -1 @MAIN_5502 -1 @MAIN_5502 -1 @MAIN_5502 -1 @MAIN_5502


I'm not familliar with this and could use some confirmations or extra info from someone who knows more about it but I think it would work in a pretty simple way.


The global variable; $VIDEO_GAME would have a pre-defined value. If the value was 2, then it'd jump to :XX_XX - This is just my idea. It's probably totally wrong so ignore it.



The second way is my favourite. All you have to do is use this opcode...


0209: [email protected] = random_int_in_ranges 0 10


The variable is where the random number is stored and the random number is between the 1st number and the second number.


So, let's break the parameters down and explain a bit more...


[email protected] is the variable to store the number.

0 is the first integer (number). This is the lowest possible answer for the random number to be.

10 is the second int (number). This is the highest possible answer for the random number to be.



Now for an example:


0209: [email protected] = random_int_in_ranges 150 165


Here the random number could be anything between 150 and 165.


The number could be... 150,151,152,153,154 ect. all the way to 164, 165...


Any one of those numbers will be stored in a variable which means it'll be remembered by the game via that chunk of space... Best way I can describe it, really...


So, [email protected] is our chunk of space (variable). That is where our number is stored.


We can ask the game what the number is in the same way that you usually might with 0039. So lets see a larger example of using the random_int.



wait 1000

0209: [email protected] = random_int_in_ranges 150 165


0039: [email protected] == 154

else_jump @MYTHREAD




02A3: enable_widescreen 1



Here we have a random number being created in a loop running every second meaning that we get 1 random number per sec. Once the random number is 154, widescreen mode is activated. If not, a random number will be made again after one second until it is 154.


Eventually, the widescreen will be activated. It could take a second, it could take a year (unlikely). It all depends on what random number is selected. Of course, there are more useful ways to use that opcode than what the example shows... You could use it for thread jumping or even simply getting random numbers to use. Imagine you wanted a level where the player had to press the number that appears on screen as fast as possible... You could define the numbers one by one... But then the player could memorize them making it easy work. With the beauty of the random int opcode, you can make it so it's a different number each time.



The third way is a little restricted. You can only use it for one type of thing. This way is very simillar to the second way.


Here it is...


0208: [email protected] = random_float_from -1620.9921 _to_ -1642.4629


This is just like the random number/integer except with a float which means a decimal number.


To me, this just screams out "Coordinates!". It's perfect for randomization of locations. If you've been to ammunation on the shooting range, you'll see how on the third round... The target is created anywhere between the range. This is a great way to do just that!


I used it myself for a shooting range code in my Vigilante Justice Mod. It was great!


Here's a little sample (slightly edited) of my use of the code in Vigilante Justice...


0208: [email protected] = random_float_from -1620.9921 _to_ -1642.4629

0107: [email protected] = create_object #MYOBJECT at [email protected] 648.2003 -5.2422


Here it gets a random float (decimal number) from -1620.9921 to -1642.4629. These coords are each side of one of the walls at SFPD underground. So, the object is created at the exact Y and Z axis. But the X axis has been randomized, so it'll spawn anywhere from the left to the right smile.gif


Again, I'll simplify that.


[email protected] is the result to the random float that is created.


The floats you should know by reading the second way.


[email protected] is the object. This is not relevant to this tutorial, ignore it.


#MYOBJECT See above. This is the object model.


[email protected] this is the X axis which travels from left to right in the PD compound. This is the only axis to change.


The other 2 floats are the Y and Z axis. They will stay the same, otherwise chances are that they will go off the screen. We dont want the object anywhere in San Andreas, do we? We only want it to be anywhere along the X axis.


It's very simple. Try testing it out. You might try making a system where the player has to run around to different markers and collect them. You dont have to leave out the Y and Z axis. Just set the right from - to values. Also, make sure that you dont make it possible for one of the axis' to f- things up. For example: You might put -100.0 as the from value of the z axis meaning people would have to fall through the floor to get there...




Using Timers



As you should know, [email protected] - [email protected] are local variables. [email protected] - [email protected] are local variables for use in missions. So what are [email protected] and [email protected]? Well, these are timers. They are basically stopwatches that count in milliseconds.


[email protected] and [email protected] are always going up. If you were to randomly ask the game what that number was, it'd be high. Very high, unless you've recently done a certain thing. That is because to make these timers count up from 0, they need resetting. Unlike what you'd expect... There is no start_timer command. Well, there is... But that is for a totally different thing. Instead, we just use 0006...


0006: [email protected] = 0


Thats it! It's that simple. We can put it to anything else we want too... Such as 1000 meaning it will start from 1 sec instead of 0 secs.


Now that you've set it to 0 it will be counting up automatically. So after 4 seconds, the timer will be 4000 regardless of what the code is doing or what it isn't. The timers are just automatic. They are hard-coded to count up forever.


Now, one could try using the 0039 opcode to test if it has reached a certain amount... But that would be risky as if the timer went above that without the code checking in time, it'd never count the check as true.


The correct opcode to use is 0019...


0019: [email protected] > 5000


The above would test if the timer is higher than 5000 (5 seconds).


That's basically it! It's simple but very useful. Unlike the wait's... The code can carry on while the timer is counting meaning you can loop a text draw and fade after 5 seconds properly without using waits which would make the text either flash or not appear.





Share this post

Link to post
Share on other sites

Tutorials belong in the tutorial section, moved.


I advise to use some more bb-codes to make it more readable (like [ code][/ code] ).

Share this post

Link to post
Share on other sites
Tutorials belong in the tutorial section, moved.


I advise to use some more bb-codes to make it more readable (like [ code][/ code] ).

Couldn't be bothered tounge2.gif I don't really use BB code much. Plus, I made all these in notepad and just pasted them in. Can't even be bothered to read them to check they say the right things xO


I'm lazy, yeah.

Share this post

Link to post
Share on other sites

good...very good lol.giframpage_ani.gifwhatsthat.gif

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

  • Create New...

Important Information

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