Pages

Friday, March 29, 2013

[Update] Heli Combat v1.2

Download: GTA 4 Mods

News for Heli Combat script:

Added customizable hotkeys, now you can set the keys for:

Shoot - hkShoot=LButton
Switch actual gun - hkSwitchGun=Q
Switch camera - hkSwitchCam=X
Shoot cannon - hkShootCannon=ControlKey
Shoot hellfire - hkShootHellFire=NumPad0
Shoot rocket - hkShootRocket=ShiftKey
Release flares - hkReleaseFlares=E
Show helicopter spawn menu - hkShowSpawnMenu=Subtract
Switch turret camera mode - hkSwitchNightVisionMode=N

Also you can set an custom resolution, for users with very large resolutions like 3840x2160, i didn't tested but i believe that will work:

bForceCustomResolution=1
myWidth=3840
myHeight=2160

Added config for some helicopter models (folder \Scripts\HeliFiles\Helicopters\More helicopters):

AH-1Z Viper
http://www.gta4-mods.com/vehicles/ah-1z-viper-from-battlefield-3-f19524


AH6 Little Bird
http://www.gtainside.com/en/download.php?do=getfile&id=43972&t=1


AH-64 Longbow Apache
http://www.gta4-mods.com/vehicles/ah-64d-longbow-apache-11-f17899


MI-24 Hind
http://www.gtainside.com/en/download.php?do=getfile&id=43647&t=1


Z11W Changhe
http://www.gta4-mods.com/vehicles/changhe-z-11w-f17976

Added night vision effect for turret camera (last camera)


Added thermal vision effect, this will work only in EFLC, some Icenhancer/ENB can make this effect don't work properly, but this is not big deal, use night vision if thermal don't works fine :)



Added new HUD with damage and weapon usage bars



Improved cop's cannons



Improved cop's rocket aim, now they will shoot more but dont will cause too much damage like instant car explosion



And fixed some issues...

Thursday, March 28, 2013

[TUT] Heli Combat - Creating custom helicopter config

In this video i try to explain with my bad english :( how to create an custom config for an helicopter in Heli Combat script.

Resuming:
  • Download the helicopter, install it, you can try to follow this tutorial to add the helicopter without replace an game helicopter, or you can replace one of the game helicopters :)
  • In the game, press " to see the scripthook console window then type the command helispawn to create the helicopter:

  • Now that you are inside the helicopter and in an stable position, type the command heliedit:

You will see this menu:


  • Now type the name of the model in the item Model name, use up/down to move through the menu items
  • Edit the Display name too
  • In the Can be enemy option you can set if this helicopter will be an possible enemy when chopper cops come, actually to work you need to replace polmav or annihilator models, but i will change this in future, i hope :)
  • In the Edit camera item you can set the position of the custom cameras, use Numpad 2, 4, 6, 8 to move (X and Y axis) and Page Up and Page Down to move up or down (Z axis), the penultimate camera is the Gunner camera, this camera will display an gun in front of the camera, it usually stay in one of the back doors of the helicopter:

          The last camera is another kind of Gunner camera, but this one have Night vision and, for EFLC only, Thermal vision  effect, it usually stay in the front of the helicopter


  • In the Edit "mini rockets" option you can set the Hellfire launchers position, like camera, use numpad and page up/down to move, put it always one or more steps ahead of the correct position, do this to avoid hit the rocket when launching it with the helicopter going fast
  • Use Edit rocket to set the position of the rockets
Tip: after setting the position of the mini rocket or rocket you can press C to create the cloned opposite item, this is very useful and make the process more fast and precise.

After setting all press Numpad0 to save, note that you can't be editing the display name or model name when pressing Numpad0 to save because in this position the press will result in number 0 on the name :)

[TUT] Adding vehicles(without replace game vehicles)

Today i wanna show how you can add vehicles to GTA IV without replace any game vehicle.
This tutorial is based on this video.


  • Easy way

Download this file (press ctrl + s to save), extract the files to this folder:

Open the OpenIV and choose the game version, navigate to the folder "\models\cdimages", click in the button "Edit mode" and drag and drop the file added_vehicles.img to the OpenIV window:


Now open the game and use an trainer to spawn the models :), inside OpenIV double click the file added_vehicles.img to see the names of the models, you will have in this file some helicopters, later you can add cars, bikes, etc..


  • Hard, but more indicated, way


First we need an .img file to store the new vehicles, open the OpenIV and choose the game version, in this tutorial i will use EFLC, navigate to the folder "\models\cdimages":


now click in the button "Edit mode" and confirm the question:

right click an clear space of the file browser and go to New > GTA IMG Archive (.img ...


in the new window we choose the name of the image file, let's use added_vehicles:


now double click the file added_vehicles and drag and drop the files of the desired models to add, always add new vehicle files to this img file instead of vehicles.img:



Now we need to create two files: added_vehicles_handling.dat and added_vehicles.ide, open the Notepad and click in Files > Save as, then choose an folder and type the name added_vehicles_handling.dat, in the combo box bellow choose the option All files (*.*), do the same to create the file added_vehicles;ide, in the end you will have this two files:


pay attention to the extension, must be IDE and DAT, not TXT :)

Ok, now we need to copy this files to the following GTA folder:


Open the file added_vehicles.ide with notepad and add the following text to it:


Now, when adding new info to this file, always insert the data between "cars" and "end", example:


Save the file and close.

Obs.: I'm doing this example with EFLC, with GTA IV its almost the same, what changes is the root folder, in GTA IV its the folder where is the file GTAIV.exe (commonly C:\Program Files\Rockstar Games\Grand Theft Auto IV), for EFLC its the folder where its the file EFLC.exe (commonly C:\Program Files\Rockstar Games\EFLC).

Now find the file default.dat, right click it and make sure that the Read only check box it's unmarked:


Open this file with the Notepad to edit it, add to the line before "HTML http:" the path to the added_vehicles_handling.dat file:


Save and close. Now find the file gta.dat, do the same about Read only option and open it with notepad, add the following lines to reference the added_vehicles.ide file:


Save and close, find the file images.txt, same with Read only option, open with Notepad and add the following line to reference the img file:


Save and close.

Now what we need to do its edit the files added_vehicles_handling.dat and added_vehicles.ide to define the info that we usually replace into GTA files (handling.dat and vehicles.ide)

For example, for the Helicopters that i added in the OpenIV i added those lines to added_vehicles_handling.dat file:


Obs.: Pay attention to extra tabulation/spaces between symbol $ and name of the model, this can make the game crash or not find the models, the correct its only one space.

And in the added_vehicles.ide file:



One for each vehicle

Now in the game you can test it using an vehicle spawner that accepts name input or use the scripthook console window and the command spawn name_of_model:


Sunday, March 24, 2013

[Script] Heli Combat

What about heavy armored choppers on Liberty City? 

This is what this mod brings to you, Heli Combat (Beta)


Download GTA 4 Mods


V1.1 - Train Derail + flares + fixes



Features


Spawn menu: Select the model to spawn


Cannon: This weapon still need some improve, actually it lags a little and don't shoots with the expected fire rate.


Hellfire launcherThis one is cool, shoots up to 20 rockets with fixed flight direction and have an smaller explosion if compared with normal rocket, but its very destructive



Rocket launcher with lock on target feature: Lock the target and shoot up to 8 rockets :)


GunnerBe the "gunner" in one of the sides of the helicopter shooting  everything with an powerful gun





Also we have Enemy helicopter with cannons and rocket launchers:




Controls

- (Numpad minus) - SHow helicopter spawn menu
X - Switch camera, last two cams are gunner camera, you will be able to aim and shoot with mouse/xbox control, for xbox shoot with A and aim with right thumb stick
Shift - Shoot Rocket
Control - Shoot cannon
Numpad0 - Shoot "mini rocket"
Normal game shoot key - Shoot actual weapon
Q - Switch actual weapon
E - Release flares


XBox 360 controls

B - Switch cams
A - Shoot actual weapon
D-Pad Down - Switch actual weapon
Right thumb stick - move aim when in gunner camera mode




For Model modders we have an config feature that helps setting rockets, launchers, cannons and camera positions, i will explain this feature in an future post:


Wednesday, March 20, 2013

[TUT] Playing native sounds and external sounds

One interesting feature in scripts its the sounds, some effects become incomplete without the proper sound effect.

*** Check new method to play external sounds simultaneously here :) ***

  • Playing game sounds

Basic requirements:

-One of the play sound methods:

  • PLAY_SOUND
  • PLAY_SOUND_FROM_OBJECT
  • PLAY_SOUND_FROM_PED
  • PLAY_SOUND_FROM_POSITION
  • PLAY_SOUND_FROM_VEHICLE
  • PLAY_SOUND_FRONTEND
-Sound ID
-Sound name
-Method to stop sound (optional)
-Method to release sound ID (optional)

the PLAY_SOUND i don't know exactly how to use, never worked in my tests, so i will show only the other five methods.

* Edit - 31/03/2013
To play "non looped" sounds we can use -1 as sound ID because the sound will end automatically. So, to play sounds of weapons shooting, bullet impact, etc., we can use -1 as sound ID and we don't need to get an sound ID :)
*

Before we be able to play an looped sound, we need to get an sound ID to be able to control the sound with this ID in future, to get this ID we use the method GET_SOUND_ID and store the ID in an int32 variable:




Now we can proceed :)


Download the sample project here, let's use this project as the base for this tutorial.


PLAY_SOUND_FROM_OBJECT


As the name says, this will play an sound in an object, if the object moves, the sound moves too, but if the object its deleted the sound keeps in last object position :P

The parameters to use this method are:
  1. The sound ID
  2. The name of the sound
  3. The object where the sound will be played
Let's create an simple example? Ok, i will get all objects surrounding player, get the first that is with less than 5 units of distance and play the sound on it, lets use the sound GENERAL_WEAPONS_ROCKET_LOOP that is the looped sound of rocket flight:



Simple? Yes, it is.



PLAY_SOUND_FROM_PED
  1. The sound ID
  2. The name of the sound
  3. The pedestrian where the sound will be played






PLAY_SOUND_FROM_POSITION
  1. The sound ID
  2. The name of the sound
  3. The position (x, y and z) where the sound will be played







PLAY_SOUND_FROM_VEHICLE
  1. The sound ID
  2. The name of the sound
  3. The vehicle where the sound will be played









PLAY_SOUND_FRONTEND

This one will play an sound like an normal/external sound, without 3D positioning, the sound will always be the same. It needs:
  1. The sound ID
  2. The name of the sound






Ok, now we know how to play an sound, but how we stop it? Its simple too:


STOP_SOUND

just needs the sound ID:








We also can stop the sound playing other sound using same sound ID.


RELEASE_SOUND_ID

When the sound its no more needed, we can release the ID using RELEASE_SOUND_ID:










One thing that we cant do its release an sound ID without stopping it, for an loop sound like the one from the example this will result in an uncontrollable sound, its annoying.

After releasing the sound ID you must use GET_SOUND_ID to get an new sound ID to use.


_____________________________________________________________________________________________________
  • Playing audio event
We can play audio events too, its very similar to play_audio_ methods:


PLAY_AUDIO_EVENT - needs just the sound name

PLAY_AUDIO_EVENT_FROM_OBJECT - needs sound name and object

PLAY_AUDIO_EVENT_FROM_PED - needs sound name and ped

PLAY_AUDIO_EVENT_FROM_VEHICLE - needs sound name and vehicle



The harder part will be find the correct sound name to use, if we take a look into decompiled SCOCL files we will see some examples like:



"MOBILE_PHONE_SMS_RECIEVE"

 "WEAPON_PICKUP_HANDGUN"
 "WEAPON_PICKUP_SHOTGUN"
 "WEAPON_PICKUP_BARETTA"
 "WEAPON_PICKUP_MP5K"
 "WEAPON_PICKUP_UZI"
 "WEAPON_PICKUP_SNIPER_RIFLE"
 "BODY_ARMOUR_BUY"


_____________________________________________________________________________________________________
  • Playing external sounds

To play external sounds we can use an object of type SoundPlayer:




after creating the object we need to set the sound location and then load the sound:





now its just use the Play method to play the sound:





The bad side of using this method is that we can only play one sound at time, if we start playing an sound, then try to play another sound, the previous will be stopped, don't matter if we are using different sound files or different sound player objects.

*Always check the sound location to be sure that the sound file its available to be loaded, otherwise you will get an error in your script:







Download the script of this tutorial here




_____________________________________________________________________________________________________
  • The Sounds demo script and the sounds list

Maybe you are asking yourself now: Where i can find the name of the game sounds to use? Here.

Press Control+S to save the file in your Scripts folder, save with the name sounds.txt, why? Because you will use this txt file with my Sound Demo script, so, download the script and the sounds.txt file and put in your Scripts folder, in the game press " to see the console window, type the command "sd" to enable the script:



Now you will see the help menu:


This sound list i get from an GTA file using OpenIV, great part of them don't result in anything :(, so to help us find an usable sound i created an filter method, in the console window type "sfilter filter_string"

for example, lets filter sounds with string explosion:


Now close the console window and press Left/Right to change between filtered sounds, the name of the sound appears in the bottom of the screen and the sound should be played, you will easily find the sound "PIGEON_EXPLOSION" that is the sound of an poor pigeon dieing when shot ^^


If no sound is being played restart the game (restart not reload), this may happen after a lot of reloadscripts and GET_SOUND_ID calls :(

Some names are with extra characters from the original file, you can try to remove this extra chars using backspace, in great part of cases, remove the last char its enough, but remember, a lot of those sounds can't be played.