Tuesday, July 30, 2013

[TUT] ScriptHook installation with OpenIV Package Installer - GTA iV

First of all

Make sure that you have installed:
  • Microsoft .Net Framework 4.0
  • Microsoft Visual C++ 2010 Redistributable Package (x86)
  • OpenIV, installed and configured
  • At least game patch 1.0.4.0 installed

Source: http://www.gtaforums.com/index.php?showtopic=392325


Let me explain how it works:

  1. ASI loader is loaded by game because game "thinks" that is a normal dsound.dll file
  2. ASI loader loads any file that is in GTAIV.exe folder that ends with .asi (extension .asi)
  3. The ScriptHookDotNet.asi is loaded by the ASI loader 
  4. ScriptHookDotNet.asi loads the ScriptHook.dll file
  5. ScriptHook.dll loads any .net.dll, .vb or .cs file that is inside the Scripts folder

Installation

*Run everything with admin rights.

1 - Download the ScriptHook here
2 - Extract all files to an folder:


Open the OpenIV and click in Package Installer:


Select the ScriptHook.oiv file:


Select in what game version you will install:


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 :)


Monday, July 29, 2013

GTA V style in GTA IV - Char switch

***
Veja aqui a versão PT-BR deste post
***

This script is an "try" to bring to GTA IV the character switch system from GTA V, at this moment we can switch between Niko, Luis and Johnny in GTA iV.




Download last version here


***
If you want share this mod anywhere, please use this link as reference for download link, this will help me a lot:



***


Remember this is under develop stage and has some bugs. You will need ScriptHook installed to use this script, put the file inside your Scripts folder.

See the ScriptHook installation guide: here


When we change to other char the old one will wander around or evade from cops if wanted level is greater than zero.

Each char has his own health, armor, ammo and vehicle, those info are saved each time you change chars and will be loaded when game starts.

Unfortunately to me this mod is being developed by other scripters/coders, this is why i'm not sure if i will release this at official sites.


Hotkeys

Numpad 1 to 3 - Switch to Niko, Luis and Johnny
or
Hold X to see the char HUD and move mouse left or right to set the new char

You can edit the hotkeys in the .ini file

This mod was tested in GTA iV patch 1.0.7.0 and EFLC TBoGT first patch.

Saturday, July 27, 2013

[TUT] Drawing shapes and text on screen (Menu, HUD, Message) - GTA iV

One basic thing that great part of mods have is Messages, HUD and/or Menus on the screen, to show info and options.

I will show in this tutorial what i know about drawing things on game screen.

Download the source code of this tutorial here


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_WINDOW
DRAW_FRONTEND_HELPER_TEXT
DRAW_RECT
DRAW_SPRITE


DRAW_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

Result with those params:



DRAW_CURVED_WINDOW

Native.Function.Call("DRAW_CURVED_WINDOW", 0.1, 0.11, 0.2, 0.25, 200)

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 window
0.2 - Width percent of the game screen to be the Width of the window, 1.0 = 100% = full screen width
0.25 - Height percent of the game screen to be the Height of the window
200 - 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.):

Native.Function.Call("DRAW_FRONTEND_HELPER_TEXT", "ADD_FILTER_CAP", "INPUT_F_ENTER", 0)

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.

Result with first call with 0 and second call with 0:


Result with first call with 0 and second call with 1:



DRAW_RECT

This method will draw a rectangle o.O

Native.Function.Call("DRAW_RECT", 0.5, 0.52, 0.5, 0.2, 255, 100, 50, 150)

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 width
0.2 - Percent of the game screen that will be the Height of the rectangle
255 - Red color amount
100 - Green color amount
50 - Blue color amount
150 - Alpha amount, 0 to 255

Result:




DRAW_SPRITE (Based on Michael 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 methods
0.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 texture
0.1 - percent of game screen to be the Width of the texture, 1.0 = full width
0.09 - percent of game screen to be the Height of the texture
0.0 - rotation of the draw in degrees
255 - Red color amount
255 - Green color amount
255 - Blue color amount
255 - 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)

Drawing lines

e.Graphics.DrawLine(200, 10, 200, 500, 5, Color.White) ' white line
e.Graphics.DrawLine(300, 10, 500, 700, 10, Color.FromArgb(100, 255, 0, 0)) ' red line with alpha amount at 100

Params:
200 - X initial position
10 - Y initial position
200 - X final position
500 - Y final position
5 - Width of the line
Color.White - color of the line, you can use Color.FromArgb to have more control of the color components

Result:



Drawing rectangles

e.Graphics.DrawRectangle(225, 235, 400, 250, Color.FromArgb(150, 0, 255, 0))

Params:
225 - X that will be the X center of the rectangle
235 - Y that will be the Y center of the rectangle
400 - Width
250 - Height
Color.FromArgb(150, 0, 255, 0) - Color, in this case a green color with alpha amount at 150

Result:



Drawing text

e.Graphics.DrawText("This is a text o.O", 20, 30, Color.FromArgb(255, 0, 255, 255))

Params:
"This is a text o.O" - the text :P
20 - initial X position
30 - initial Y position, left top corner of text
Color.FromArgb(255, 0, 255, 255) - the color, unfortunately the alpha low values only will make the text look more dark

We can change the font too, but i don't know too much about this.

Result:



Drawing sprites (images)

To draw an non game image on screen first we need to read the bytes of this image and create one Texture with those bytes:




We need the import of System.IO (or we can call System.IO.File...)
We need the Texture object
We need to read the bytes and create the Texture object, the path used is:

.\ - Results in current directory, GTAIV.exe/EFLC.exe folder
Scripts - inside current directory, Scripts folder
AnyImage.png - the image file inside Scripts folder, if this file don't exists script will crash because of exception at the byte reading:


So, make sure that the image file exists and is readable.

Now that we have the texture loaded we can draw it on screen:

e.Graphics.DrawSprite(myImage, 500, 200, 100, 150, 0, Color.FromArgb(150, 255, 255, 255))

Params:
myImage - the Texture object created before
500 - X center of the image on screen
200 - Y center of the image on screen
100 - Width
150 - Height
0 - Rotation in degrees
Color.FromArgb(150, 255, 255, 255) - Color, this param is optional, the alpha amount don't will change anything, you can change the color components to obtain different color filters

Result:



Combining Rectangles and Text draws we can create cool Menus or Messages:






That's all what i know (until now) about drawing things on game screen, any tip is welcome ;)

Monday, July 22, 2013

Switch Player model - Small script request - GTA iV

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.


Download: MEGA

Need more speed with your MEGA downloads? click here


How to use

First you need scripthook installed.
Copy the two files inside he zip to the Scripts folder of your GTA IV or EFLC

The file goes with a sample .ini file with two examples of use for the models ig_Brian and ig_Tuna

Press control + hotkey (based on .ini config) to change into the desired model

Aim at an pedestrian and press middle mouse button to switch to the targeted ped model, you will have same clothes.

The hotkeys can be switched in the .ini file :)


Screens




Monday, July 15, 2013

[TUT] OpenIV Package Installer guide - User side

Now we can use the OpenIV package installer feature to make easy to install mods in GTA IV or EFLC, the use it's very simple.

*To install mods in GTA it's interesting use last patch update to have all native methods, or at least patch 1.0.4.0

Watch the guide here:




***


Setting up OpenIV

IMPORTANT: If you don't have OpenIV installed and/or configured:
  • First download the OpenIV here and install it
  • Run it and click in the game that you want to mod
  • It will ask the game folder, for GTA IV for example it's (commonly):


C:\Program Files\Rockstar Games\Grand Theft Auto IV
or for Steam users:
C:\Program Files\Steam\steamapps\common\grand theft auto iv\GTAIV


  • Close OpenIV.
***




Installing .oiv files (easy setup files)

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.

Tuesday, July 9, 2013

GTA V - First gameplay video released by R* o.O

OMG, this will be awesome:


Rockstar released an new video about GTA V, showing to us what we will have in this awesome game.

Three characters, best graphics ( i hope with better performance :) ), characters and car customization, big map, wild animals, mountains, multiplayer, planes, dive, bicycles, tennis, golf, amazing environment desctruction, and more, this is a "must buy" game.

We can notice how the characters (Ped) of the game looks much better and with more fluid animation.
Those animals are perfect, the grass, the illumination, everything just awesome.

Can't wait o.O



Tags: gta v first gameplay, gta v news, gta v coming soon, gta v awesome gameplay, notícias gta v, gameplay do gta v, gta v multiplayer, gta v customization.

Sunday, July 7, 2013

HULK GTA iV - Update v1.1

***
Veja aqui a versão PT-BR deste post
***

This is the last released version of this script the v1.1, fixed some bugs and added some new features.

See the demo: Niko vs HULK




If you wanna make videos of this mod or share it anywhere, please use the following links in the post, this will help me a lot :)



Download

Changes:

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.


Hotkeys

Insert or H - Activate/Deactivate (or show the mod menu)

Middle mouse button - Grab/lift peds, dumpsters, vehicles, lamp poles and rockets (hold for rockets)

Left mouse button - Attack with punches, throw grabbed/lifted things, attack with lamp pole

E - Hold to charge the Thunder clap attack, release to perform the attack

R - Hold to charge the Punch ground attack, release to perform the attack

Hold space for a while to perform the Big jump, you can do this running too

While falling from Big Jump hold Left mouse button to perform Big Jump fall attack

You can hold space when getting close to ground to perform the big jump again with more forward speed

Right mouse button - Set targets, use Left mouse button to attack/jump to target

When grabbing or lifting something hold left mouse button to increase the Throw force

With grabbed ped if you reach more than 70 of Rage you will perform a "ped smash" attack ( kinda Hulk vs. Loki in Avengers movie :) )

When falling and facing a wall you will grab the wall if forward key is down ( commonly W )
Hold W to keep grabbed to the wall, press Space to jump to an position above or press Left mouse button to climb the wall


XBox 360 controller:

Activate (keyboard)
Jump
Grab
Left bumper Punch gound
Right bumper Thunder clap
Left trigger Aim
Right trigger Attack
Left ThumbStick Move player
Right ThumbStick Point camera


W.I.P. videos:



Enemy features:

The enemy will be able to:
  • Perform basic melee attacks
  • Lift and throw vehicles
  • Use lamp pole as baseball bat

Screens:





------------------------------------------------------------------------------------------
Edit: 11/07/2013

Second attack done: Lift and throw vehicles o.O



------------------------------------------------------------------------------------------
Edit: XX/XX/XXXX ^^

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.
------------------------------------------------------------------------------------------


This weekend i was developing the XBox 360 control support for the HULK script and decided to try to create a enemy with HULK powers.


In the end i hope that we can spawn an HULK enemy and use other mods like Iron Man to defeat him, that would be amazing.

Now an Abomination model would be nice too ^^, it's a shame that the model sizes can't be bigger without side effects.

I will add to this blog post more news about this update and in the end of the process the link to download it.
Need support using my mods? Contact me via my facebook page

Receive link to new posts in your Email

Recent Posts