If you don't have an ASI loader you can install it clicking in the first option, the ASI loader is necessary to load the ScriptHook:

After the installation click in Close, now open the OpenIV again, select the same file and install the ScriptHook based in your game patch version:

Now let's test the ScriptHook, open the game, load an save game and when your character is on screen press ' or ~, an black window must appear, this indicates that the ScriptHook was loaded:

Now press Insert to see if the scripts that is inside the Scripts folder is loading, an menu like this must appear:

Done! Now you can drag to Scripts folder any .net script for GTA IV :)

Troubleshooting

My game don't load anymore

You probably have an issue with the ASI loader, remove the dsound.dll file from GTAIV.exe folder and see if the game opens again. Now try o find another ASI loader version, gtaforums is a good choice to search for this kind of file.

If you are running the game without admin rights maybe you will obtain an error message indicating that the file asilog.txt can't be created, in this case you can try to run the game as admin using right click or manually create the asilog.txt file and saving inside gtaiv.exe folder

My game crash at loading screen

This is probably related to wrong ScriptHook.dll version, make sure that you choose the right ScriptHook based in your patch version.

Black window don't appear

ScriptHook or ASI loader failed in the startup, try other ScriptHook or ASI loader versions

The mod menu don't appear when i press Insert

This can be a issue with the ScriptHook version, send to me the ScriptHook.log file :)

Native methods
We have some cool methods that we can call to draw shapes and game textures on screen, they must be called in a tick or loop, those are the ones that i know how to use:

DRAW_SPRITE_FRONT_BUFF (New: Added 15/11/2013)DRAW_CURVED_WINDOWDRAW_FRONTEND_HELPER_TEXTDRAW_RECTDRAW_SPRITEDRAW_SPRITE_FRONT_BUFF (New)Native.Function.Call("DRAW_SPRITE_FRONT_BUFF", 0.2, 0.21, 0.3, 0.3, 0.0, 150, 190, 195, 200)
This method is interesting, it draws the actual screen on the specified area, its like a mirror of the reality but not mirrored ^^.

Params:
0.2 - X percent of the game screen to be the center of the window, 1.0 = 100%
0.21 - Y percent of the game screen to be the center of the window
0.3 - percent of the screen that will be the width of the window, 1.0 = full width
0.3 - percent of the screen that will be the height of the window
0.0 - rotation in degrees
150 - Red component of the color
190 - Green component of the color
195 - Blue component of the color
200 - Alpha component of the color

Params:0.1 - X percent of the game screen to be the X position of the window, 1.0 = 100%0.11 - Y percent of the game screen to be the Y position of the window0.2 - Width percent of the game screen to be the Width of the window, 1.0 = 100% = full screen width0.25 - Height percent of the game screen to be the Height of the window200 - Alpha value, 255 = full opaque, 0 = full transparent

Result:

DRAW_FRONTEND_HELPER_TEXT
This method will draw game predefined messages on right bottom corner and will display a key draw (Enter, Delete, Backspace, etc.):

Params:"ADD_FILTER_CAP" - This is the predefined message, you can find more in the SCOCL files searching for the native method."INPUT_F_ENTER" - This will make the "Enter" game display message appears, you can find other examples in SCOCL files.0 - Not 100% sure what this does, but if the second call has an number 1 instead of 0, this message will appear below the previous, if its 0 it will appear in same line.

Params:0.5 - X percent of the game screen to be X center of the rectangle, 1.0 = 100%0.52 - Y percent of the game screen to be Y center of the rectangle,0.5 - Percent of the game screen that will be the Width of the rectangle, 1.0 = full width0.2 - Percent of the game screen that will be the Height of the rectangle255 - Red color amount100 - Green color amount50 - Blue color amount150 - Alpha amount, 0 to 255

Result:

DRAW_SPRITE (Based onMichael Wojtanis tip)
This method will draw a game texture, it's very interesting.
This method requires that we load the TXD and the Texture that will be displayed before call the method, we need to do this only one time, so, in the Sub New of the project we can load it, in this example i'm loading at global variable declaration but i don't recommend this:

Params for LOAD_TXD:

"binoculars" - Name of the TXD where the texture is located

Params for GET_TEXTURE:

txd - The ID returned by LOAD_TXD call

"binoculars" - Name of the texture

Now that we have the texture ID we can proceed and call the draw method in a tick:

Native.Function.Call("DRAW_SPRITE", tTexture, 0.2, 0.1, 0.1, 0.09, 0.0, 255, 255, 255, 255)
Params:tTexture: The texture ID obtained with the previous two methods0.2 - X percent of game screen to be the X of the center of the texture, 1.0 = 100%0.1 - Y percent of game screen to be the Y of the center of the texture0.1 - percent of game screen to be the Width of the texture, 1.0 = full width0.09 - percent of game screen to be the Height of the texture0.0 - rotation of the draw in degrees255 - Red color amount255 - Green color amount255 - Blue color amount255 - Alpha amount

Result:

Using OpenIV we can discover the TXD and Textures names and preview the Textures:

We can draw interesting things like gun icons, zombie scratch ( i never saw this in the game :( ), loading screen images, etc.:

Drawing with the PerFrameDrawing event
Be careful with this method, i recommend to only use the draw methods inside this event because you can cause game crash or lag if you do heavy things here, if this event stops, the frame drawing stops.

This is the method:

Using the "e" object we will be able to draw rectangles, text, lines and textures (images)

Params:200 - X initial position10 - Y initial position200 - X final position500 - Y final position5 - Width of the lineColor.White - color of the line, you can use Color.FromArgb to have more control of the color components

Result:

Drawing rectanglese.Graphics.DrawRectangle(225, 235, 400, 250, Color.FromArgb(150, 0, 255, 0))
Params:225 - X that will be the X center of the rectangle235 - Y that will be the Y center of the rectangle400 - Width250 - HeightColor.FromArgb(150, 0, 255, 0) - Color, in this case a green color with alpha amount at 150

Monday, July 22, 2013

The idea here is be able to switch player model to any ped model using hotkeys or command lines or clone an pedestrian copying their skin, attached objects like Bags, Glasses and Hats don't will be copied.

Jatin Narula asked to me this script and i have some parts of this code done for my future Prototype mod, so, was easy to extract it and create this script.

Now that your OpenIV is ready to make modifications on your GTA let's see how to install the .oiv files

*Remember: It's recommended do those steps with the game closed :)

When you download a OpenIV package you will have an .oiv file that must be opened with OpenIV:

Open the OpenIV and click in Package Installer and select the .oiv file:

You will see the initial screen that will have buttons to choose the game version, click in the game version that you plan to install the mod:

In the next step you will choose what to install, commonly the mod will come with one option only, my mods goes with two or three, depending on gta iv/eflc choice, basically what we need to do first is install the mod, then, if necessary, install the additional files:

So, after installing the mod (first option) you need to install the ScriptHook if you don't have it installed.

To see if your ScriptHook is installed and working, with the character on screen, press ' or ~, a black window should appear, this is the scripthook's console window:

***

Manual setup - How to manually install .oiv files

If you can't install using OpenIV you can install the mod manually, it's very simple, you just need a file compression unity like WinZIP or WinRAR.

Open the .oiv file with winzip or winrar and you will see this files:

Inside folder "content" you will see all required files, now just copy the folder Scripts to your gtaiv.exe (or eflc.exe) folder and copy the ScriptHook files if you don't have the ScriptHook installed.

*The ScriptHook files are: dsound.dll (ASI loader), NAudio.dll (required to play some sounds), ScriptHook.dll, ScriptHook.dll.4 (that should overwrite ScriptHook.dll when installing it on game with patch 1.0.4.0 or lower) and ScriptHookDotNet.asi

**Extra folders (like Models to IV) may contain models that must be installed in game.

Added mod menu, press Insert to see the menu, when you install an updated mod made by me it will appear on that list
Added support for XBox 360 controller
Fixed some issues with jump and attacks
Increased basic melee attack speed
Added the enemy feature, now you can create and HULK enemy and try to kill him, he is a little dumb but will be fun, i hope.

Actually i adapted the basic Punch attack (left mouse clicks) to make it capable of being performed by any pedestrian, this means that we can spawn an pedestrian and make him perform the HULK basic punch attack against vehicles and poor pedestrians that are on the way.

The actual result it's very cool, now i need to improve the tasks to make the ped more aggressive and find more targets to attack, then i will adapt other attacks like lift and throw vehicles, use lamp poles as baseball bat (this will be cool) and perform big jumps.