Monday, September 16, 2013

GTA IV Superman script

Veja a versão PT-BR deste post aqui

This script will give to player some Superman powers like:
  • Invencibility
  • Fast sprint
  • Heat vision
  • Super wind blow
  • Super strength
  • Super melee attacks
  • Lift and throw cars
  • Use lamp poles as baseball bat
  • Fly :)
and more 



Download

***
if you want share or make videos of this mod, please use the following links as reference in description:

http://gtaxscripting.blogspot.com/2013/09/superman-script.html
https://www.youtube.com/user/taltigolt
https://www.youtube.com/user/YeardlyDiamond1
http://www.youtube.com/user/indirivacua

Thanks
***

Other Superman models

Superman mix by Quechus13: Easy setup (mirror) (Source)
Injustice Superman with working cape by wapeddell: Easy setup (mirror) (Source)
Man of Steel by wapeddell: Easy setup (mirror) (Source)
Superman v1.0 by H1Vltg3: Not fully supported because it's a playerped mod (Source)


Installation

This mod goes with .oiv file for easy setup using OpenIV package installer, see how to install .oiv files here.



Hotkeys

*Some people had issues with the mod menu don't showing the Superman option, if this happen press ' or ~ to see the ScriptHook console window and type the command superman to show the mod menu :)

Insert - Show mod menu to be able to switch player model to Superman model or activate and deactivate powers
R - Heat vision
T - Super wind blow (extinguish fire and push everything in front of player)
E - Grab lamp poles or lift cars
Left mouse button (LMB) - Super melee, throw cars
Right mouse button - Aim
Space - Toggle flight mode (must hold when not dressed as Superman)
Direct ped/vehicle attack - Set a targeted ped/vehicle that is not too much far away and press LMB
Ground attack - Fly against ground with more than 30 of speed

You can use all powers when flying too

The mod starts by default with powers ON, this means that you will have superman powers when not looking like superman, to disable the powers go to the mod menu and toggle the powers option :)

XBox 360 controller support is under develop.



Credits

Script: JulioNIB
Flight anims: Yeardley Diamond
Superman model: Indirivacua
Tests: Taltigolt

[TUT] Scripthook installation - Manual setup - GTA iV

To manually install the ScriptHook we need to identify and copy some files.

First download the Scripthook + ASI loader here

Before start, make sure that you have 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

Let's start with the ASI loader, in my mods its the file dsound.dll, it must be copied to GTAIV.exe file folder:


We must do the same with the following files: NAudio.dll, ScriptHook.dll, ScriptHookDotNet.asi, if your GTA have patch 1.0.4.0 or lower you need to copy the file ScriptHook.dll.4 instead of ScriptHook.dll and paste in GTAIV.exe folder and rename from ScriptHook.dll.4 to ScriptHook.dll:


Now we copy the Scripts folder from the ZIP and paste in GTAIV.exe folder:


If you run the game without administrator rights you may obtain an error message indicating the file asilog.txt, in this case you need to check if the file exists in your GTAIV.exe folder and create it if necessary using notepad for example.



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


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



Other mod files

Some mods like Dual wielding goes with files that must be added to .img game files using OpenIV or SparkIV, if it's a animation (.wad extension) it must be inserted in the anim.img file (anim\anim.img), if it's a weapon it must be inserted in the weapons.img (models\cdimages\weapons.img), if it's a ped it must be inserted in the componentpeds.img (models\cdimages\componentpeds.img), if it's a playerped.rpf file it must replace the playerped.rpf file (models\cdimages\playerped.rpf), always enable the Edit Mode before insert any file and do this with the game closed, you can export the original game files before to make backups.



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

Saturday, September 7, 2013

[TUT] Camera control

My knowledge about camera is limited, i will show in this tutorial what i know about cameras in GTA IV.

Download the source code used here (mirror)

First of all we have direct access to the actual active camera using the following object:

Game.CurrentCamera

With this object we can obtain useful info about actual active camera:



Other way to obtain access to actual game camera is using this object:

Game.DefaultCamera

The problem with this object is that it disappear (= nothing) when an ped is set as targeted by player when player is unarmed, so, if you want use this camera be careful and make the Exists(Game.DefaultCamera) check before use.

GET_GAME_CAM
This native method will return the game camera, very useful when we need to find the actual game camera doesn't matter if we have a gun or not:




Creating a camera

To create a camera we need an object of type camera and we need to create a new instance of it:



Now to see the view of this camera we need to Activate it:


To demonstrate some camera control let's create an free camera with keyboard control, when i press move keys the camera will move forward and backward, when i press + and - camera will zoom in and out and when i press left/right/up/down camera will change direction:


Basically what i'm changing here is Position, Rotation and FOV.

An interesting method to use is the LookAt, we can set the camera to look at a Ped, Object, Vehicle or a single position, when we set this we can't control the camera direction or rotation anymore:


To obtain control over Direction and Rotation again we need to call UNPOINT_CAM method:


Another cool method to use is the SET_CAM_SHAKE:


First param is the camera, we can shake the game camera too but before we need to call CAM_PROCESS and specify game.default camera as the param.

Second param seems to be the level of movement, from 1 to 8

Third param is the time in milliseconds, -1 will result in a shake of approximated 1 second

This is what you need to do to shake the game default camera:




Attaching a camera

We can attach camera using the following methods:

ATTACH_CAM_TO_OBJECT
ATTACH_CAM_TO_PED
ATTACH_CAM_TO_VEHICLE
ATTACH_CAM_TO_VIEWPORT

After attaching the camera we can set the offset from the attach point using this method:

SET_CAM_ATTACH_OFFSET

To make the attach be relative to the object we need to call this method:

SET_CAM_ATTACH_OFFSET_IS_RELATIVE

To remove the attach we use UNATTACH_CAM

Let's make an example of this attach, let's attach the camera to player current vehicle, if player aren't in a car let's attach the camera to him:


Now, in a tick we need to set the camera direction or rotation:



With some coding and imagination you can easily create a basic first person camera.

Monday, September 2, 2013

Race day [W.I.P.]

This is a first try to make a race script for GTA IV, i plan to use this script as base for my Death race script.

The intention of this release is just let you test the actual script, so, if you find any error, bug or have a tip please comment in the comments section down there.

At this moment the AI racers still very bad drivers :(

Download: here (mirror)

This mod was initially requested as a drag race script by Kovács Péter

The file goes with two races for airport, you can create or edit races (up to 100)


***

If you want share or make videos of this W.I.P. please use the following link as download reference:

http://gtaxscripting.blogspot.com/2013/09/race-day-wip.html

***


Installation

Copy all files from the zip file to your GTA Scripts folder (you need ScriptHook installed)

files after copy the files from the zip to your GTA Scripts folder


Hotkeys

Press Insert to see the mods menu and select the Race day option

 mod menu with the Race day option

mod main menu with the two races
//propaganda YT float style='display:none;'