Thursday, February 28, 2013

[TUT-IV] Basic tools to script

To help we implement scripts for GTA iV we need some tools/links, the most important in my opinion are:

The scripthook help file: Through this help file we can have easy access to any .net scripthook object and see their properties and methods, the parameters needed and some basic info about the behavior.

The Microsoft Visual Basic: What about an program to help us insert the code showing list of objects, methods and parameters? Yeah, Visual Studio will help a lot in the script develop, and we can test the compilation before trying it in the game.

  • You can download an free version here or here.

The GTA Modding sites: Very useful pages listing game native functions, animations, particle effects, models, etc.. Add in your Bookmarks, you will need it ^^

  • List of native functions: List of game native functions, great part of them with parameters specification and description of the effect/result.

  • List of models: List of game models, vehicles, pedestrians, objects, weapons, all...

  • List of animations: List of game animations, here we can find all game animations and play it with the pedestrians.

  • List of particle effects: List of all particle effects like fire effects, water effects, bullet hit, blood splash, explosions, etc..

Open IV or Spark IV: With those programs we can search and preview game models, extract and replace them, the same we can do about textures and sounds, also we can extract or replace animations, very useful when you need to search for some model to use in your script.
  • Download Open IV here
  • Download Spark IV here

Decompiled scripts: This is pure gold, we can see how they use some methods with those files, it's very interesting to find how to use an method, you need some luck and logic to identify the params (if they are not listed at the list of native functions) but it's not so hard.

For example let's say that we wanna see how to use this method: PLAY_SOUND_FROM_PED
This method has no info in the wiki (list of native func.) but we can search into the decompiled files and find something like this:

PLAY_SOUND_FROM_PED( l_U375, "E1_RB2_SCREAM", l_U697[2] );

First param is a variable, we search for this variable and see his type:

l_U375 = GET_SOUND_ID(); - based on what we know about get_sound_id, this variable can be one integer. And based on what this variable is receiving we notice that it's an sound id, and it's the first param of the native call (play_sound_f...)

Now we look at next param, it's a string: "E1_RB2_SCREAM", based on method name we can imagine that this is the sound name.

Now the last param: l_U697[2], this is an array (because of the [ and ]) and based on the method name (that ends with from_ped) we can imagine that it is a Ped id, like the return of Player.Character.

So if we do this on

Native.Function.Call("PLAY_SOUND_FROM_PED", -1, "E1_RB2_SCREAM", Player.Character)

we probably will hear a sound, but you must pay attention from what folder this decompiled script is, some scripts uses methods and names of particle effects, sounds or whatever from a specific game version (GTA IV or EFLC), some methods will work only in EFLC. To make sure test in both before give up :)

Basicaly those are the main tools/sites that i use as reference/source when coding scripts for GTA iV, in next tutorial i will show how to start an new script in visual basic and show some basic scripting ideas.

Download the sample project here,

Receive link to new posts in your Email

X Close Join the Patreon Club
Join the club ;) Join the club ;)
X Close Subscribe to my YT channel and stay up to date to my new mod releases
Subscribe ;) Subscribe ;)
X Close
Kinguin - Best Games in Best Prices