Pages

Friday, April 26, 2013

[TUT] Particle effects

Today let's play with particle effects, it's simple and give an good look to the script effects.

Download the project here.

As you probably know an particle effect (PTFX) in GTA IV is the effect of bullet impacts, water splash, explosions, fire, water fountain, weapons muzzle, sparks, etc.. They are almost everywhere in the game.

In this video i show some interesting particle effects, take a look :)

To call this effects we can use the following methods:


START_PTFX
START_PTFX_ON_OBJ
START_PTFX_ON_OBJ_BONE
START_PTFX_ON_PED
START_PTFX_ON_PED_BONE
START_PTFX_ON_VEH

TRIGGER_PTFX
TRIGGER_PTFX_ON_OBJ
TRIGGER_PTFX_ON_OBJ_BONE
TRIGGER_PTFX_ON_PED
TRIGGER_PTFX_ON_PED_BONE
TRIGGER_PTFX_ON_VEH

As you can see we have two types of method, START and TRIGGER, the difference is that START will return an Particle Effect ID, and with this ID we have some control over the PTFX, we can stop the effect when we want for example, or change the particle effect Offset too.

The TRIGGER will only call the particle effect and don't will return any ID, not all particle effects can be used with trigger, some only work with start method.
We use trigger in particle effects that will end automatically, for example to simulate an shoot we can trigger the muz_pistol to make the muzzle effect, i use this effect in Iron Man script to simulate the effect in his boots and hands when he is flying.

Important: If you want restart an PTFX satrted using START method, always stop the previous, otherwise  you can create an "bug" in the game and the particle effects don't will work anymore for your script until you reopen the game :(

We have a lot of particle effects to use in this game, so i made an small script to preview this particle effects in game, you can download it here, extract the .net.dll and .txt file into your GTA Scripts folder, to activate the script type the console command "pd" and use the command "pfilter filter_word" to filter the list if you wish:


Another interesting thing about particle effects is that some particle effects has sounds and interact with game physics and pedestrians/vehicles, for example, the ambient_fire_generic will burn any ped that touches it,  the fire_chopper_tail will produce fire sound :)

Let's start with the more basic TRIGGER method:


What happens here is that when i press number 0 i will get an position in front of player then call the TRIGGER_PTFX method using that position.

The parameters are:


Easy no? Now let's use one more advanced: TRIGGER_PTFX_ON_PED_BONE:


We are making the player bleed with the PTFX blood_gun_entry_arterial

The parameters are similar:


Basically what is new is the Ped ID and the Ped Bone ID.

Now let's use an START method, i wanna be able to control when it will end:


The PTFX water_carwash_drips never ends.

Here I'm storing the ID returned by START_PTFX_ON_PED_BONE into tmpID variable, an int32 type. As you can see the parameters are just the same type used in TRIGGER_PTFX_ON_PED_BONE.
After 10 seconds i will use the method STOP_PTFX to stop the effect, as parameter we need the ID returned by the start method.

Also we can remove the effect using:

REMOVE_PTFX_FROM_PED
REMOVE_PTFX_FROM_OBJECT
REMOVE_PTFX_FROM_VEHICLE

Those methods will remove all PTFX from the ped/object/vehicle.


The EVOLVE_PTFX method will make some changes in the PTFX, i never used this but i can demonstrate the functionality based on SCOCL files :)


Here we call the EVOLVE_PTFX method and use the param "fade" and an float number to reduce the opacity of the smoke effect, 0 = full opacity ~1.8 = no opacity.

The parameters are:

PTFX ID (tmpID)
Attribute to change ("fade")
Attribute value (c)

This is the original code from SCOCL:


Easy to read? Never ^^, but very useful.


The UPDATE_PTFX_OFFSETS method will update the offset (or start position) and rotation of the PTFX:


Parameters:

PTFX ID (tmpID)
X, Y, Z offset/position (0, 0, c)
Pitch, Yaw, Roll rotation (0, 0, 0)

With this method we can make an spinning PTFX changing one of the last three parameters :)



Friday, April 19, 2013

Requests

Let me write here some mod's requests:


Alessio Calandrella
Hi, can u help creating a little script.
The Script must work in this way:
Press Alt+Z to get the ems bag.
The bag will attach to the player.


Jebus28279
Hey man, what's up? So I have had an idea of a script on GTA IV for about 4 years now, but no one has seemed to do it or attempt it. I was really wanting to know if somehow or someway it would be possible to make a grab mod. And I don't mean cars, I mean walls, and objects, because it seems possible considering when peds begin to fall off of a ledge, slide down a hill, or etc they try to grab and hang on to the nearest thing they can grip to save their self. But I've wanted a mod that would allow the player to press a key and grab onto a wall at anytime. I have no idea if it can be done, but it's just something I've been wanting on this game for a loonnnggg time, because I always use things like the ragdoll mod to mess around with every time I play because I really do enjoy it more than anything, haha. But yeah, If you could look into something like this, or tell someone else who makes script about it, I would greatly appreciate it! You know, if you don't mind, of course because I would LOVE to see this in the game. :D
Oh and btw, one other thing, is it possible to make all peds drunk? Like all peds around in your area, because that's another thing I've wanted to see too for awhile. I'm just obsessed with Euphoria and ragdoll physics if you can't tell, that's why I love these types of mods, lmfao.


smokeweed4llDay
Ok thank you, so, can you make a mod to smoke weed? not a big thing, this mod already exists but with cigarettes, it would be too cool! Smoke with Little Jacob :D
That's all, thank you men
first version done: http://gtaxscripting.blogspot.com/2013/05/wip-weed-script.html

CruiserZone
I'm looking to change the sound of the cannon (If you don't mind?), I'm trying to make it sound more like the mini gun of an A-10 Warthog, i found this video of the A-10 in action and have become obsessed with making it sound like the real thing: watch?v=R3fL2atX_-0&t=6m25s ,I changed the minigun file in the jetfiles folder but it still makes the shotgun sound when i fire the cannon, which file makes the cannon sound, can you please help??...Best gta mod ever btw!!


taltigolt
prototype
04/26/13
hi i have another idea i just saw your particle video and i never knew how much blood effects there were
so my suggestion would be overdone blood
hitting someone makes a big splash of blood with a sound effect
running people over makes blood splash everywhere
could also work for the prototype script i suggested
https://www.youtube.com/watch?v=iDxNG_fPwsY
i think you could do hammer fist and claws
the prototype model by ac amir has all different hands as clothing
i also think you can do ground spike just without the spikes
what do you think could you do it?


KokahZ777
If you do a portal gun mod, you are my god
mod being developed by nixolas1


Kovács Péter - Spyke
My idea is a Drag Race mod. Just like as the mod what we could use in san andreas in the past few years  simply theres a track for example the airport's street. Two cars one is the player and one is the ped. And they do a drag race  the one who finishes first wins.

Sophia Wisher
Anyway I am writing to you to ask for the mod MECHS COMBAT :D
It must be boring for you reading such posts but I just need to write....sorry
Here is a thread I made on the GTA IV MODS
http://www.gtagaming.com/forums/showthread.php?t=141207
there is model of GEKKO from MGS4
http://www.mediafire.com/?p7hd4ayhb5p85po
I wonder if you can use it to create a mod of a mech.
I asked few guys to give me their 3d models of mechs
here is the model
http://www.youtube.com/watch?v=D0jxnNm1PVM
here is how it walks
http://www.youtube.com/watch?v=OCcrdQTBkOc
Will you be able to create a mod for the GTA IV based on those Metal Gear Rex or Gekko files? (3d objects)
Based on District 91. Mechs are not supposed to fly (Armored Core does such thing but the whole gameplay will be about flying same like heli) or at least they should have a chance to fly for 3 sec(boost for flying or going forward) to get to the roof then engine should overheat
2. One weapon should be called GRAVITY. You can pull up a guy or a vehicle then aim at your target and throw the thing you were holding.
3. Another weapon should be railgun. Mech takes pose with one arm stretched to the front. Energy, electricity is accumulating. And then it fires. Big laser flies through whole roads. Everything on the roads and pavement is exploding. LONG reloading.It could be fun if during accumulating the weather changes to the rain and there are thunderstorms next to the mechs :DDD Like in Dragon Ball when Goku fought with Freeza hehe
4. Miniguns - routine (just overheat should be attached) Camera shoudl shakes to make gameplay more dramatic.
5. MISSILES :D but mech should stop when using it. We can aim max 10 targets or less in that stopped pose. We press fire. And then there is a view from another camera. We see mech from far (30metres). We look at its front. And missiles are firing from his back.
6.Catapult should be included. When mech dies there is a bloody huge explosion. Like in Air Combat when we drop bombs.
7. Another Missiles which are not able to lock at the target. 1 missile per 2 sec or more so the fight with the enemy won't be too easy.
8. The problem is...when you catapult the Comabt MODE should work so we can steal enemy mech.
9. MEchs should regenerate when kill the enemy.
10. After 10 killed enemies there is a BOSS :D Big huge mech like Metal Gear Rex. 

raghubabu1961
it takes forever to go into menus and choose character and spawn with simple trainer on my laptop.i know many have been experiencing same problem with no numpad keys. can you please make a simple editable script with which we can just input which ped we want to spawn and by press of one button spawn them ? please i have to go through menus and menus to check any ped mods ive been installing.
thank you 

Thursday, April 18, 2013

[TUT] Settings file - Saving and loading .INI config info

Today i wanna show how you can load and save configuration in .INI files, this is very useful to set customizable things in your script like Hotkeys, timeouts, offsets, etc..

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


  • Reading data

Let's start with the basic, the basic is the ScriptHook native Settings object. to read data from the script default INI file we can use the following methods:


       Settings.GetValueBool
        Settings.GetValueFloat
        Settings.GetValueInteger
        Settings.GetValueKey
        Settings.GetValueModel 
        Settings.GetValueNames
        Settings.GetValueString
        Settings.GetValueVector3

As you can see we have different types of return, i generally use GetValueString because its easier to handle.
Those methods require some parameters:










OptionName: Set the name of the option in the INI file
Category: Set the category where the option will be
DefaultValue: Set the default value that will be returned when the option don't exists in the INI file

You can skip the Category parameter, but its not good idea.

Remember that the structure of an INI file is something like:


[CATEGORY]
OPTION1=VALUE1
OPTION2=VALUE2


[CATEGORY2]
OPTION12=VALUE12
OPTION22=VALUE22

So, to read an string from the INI file we can use:






The same idea with Integers, floats, etc..


  • Writing data
We have only one method to write data in the INI file:

        Settings.SetValue

We can use any of the Reading types in this method, the method will detect and write the correct info. The params needed are:






OptionName, Category and the Value that can be one of the types  listed in "Reading data" section of this tutorial.

After writing into the INI file we must use the method Save to save the info in the INI file, if the file don't exists it will be automatically created:

        Settings.Save

The name of the file will be the name of the script file less .net.dll/.vb/.cs part.


In my scripts i always try to maintain all settings available in .INI file without the need of release the mod with the INI file, to do this i always check if the option exists in the INI file, if don't exists i set my default value. to do this i use an method:







This method will try to read an String from the INI, if nothing is found it will set in the INI the default value, then read it again and return the result as String. 

To use i call it like this:




We can use this method to read double and integer values too, we just need to convert the result to the desired type:




To read Key value i use another method that will always return an Key:






using it:


The variable must be an Keys type:




  • Another way to read and write
When i need to read and write INI file with custom names like i do in Air Combat IV where i need to read ini files that are inside folder Jets and the names are custom (armor_jet_name.ini) i use the following methods:

















As you can see we need to import the System.Text to use the StringBuilder object :)
We are using windows API's to read and write data from the INI file.

This method requires that the ini file already exists, so i use this method to confirm the INI file existence before use it:









Also i use an Global string variable (iniFile) to be the INI file name that im using, you can modify the methods to add this as parameter but i prefer to use this way. You must use the entire path to determine the INI file, it can be relative: 

iniFile = ".\Scripts\MyCustomINI.ini"

or absolute:

iniFile = "C:\Program Files\Rockstar Games\Grand Theft Auto IV\Scripts\MyCustomINI.ini"

both works fine :)

Example of use:








Download the script of this tutorial here

Wednesday, April 17, 2013

Iron Man IV script mod - Possible problems and possible solutions :)

In this post i wanna show some possible problems that you can have with Iron Man IV script and some possible solutions.


First of all, if the script don't work, you did something wrong or have wrong or incompatible software (Crack, patch version, ASI loader, scripthook version, etc.), the script works fine if everything is ok, and it's not hard to make it happen, basically a fresh install of the game "patched" to 1.0.4.0 in a computer with .Net framework 4.0 and running the game as administrator will be enough.

Download last version here


Make sure that you have the following packages installed:

http://www.microsoft.com/pt-br/download/details.aspx?id=17851
http://www.microsoft.com/en-us/download/details.aspx?id=5555
and maybe:
http://www.microsoft.com/en-us/download/details.aspx?id=20914

Make sure that you can load .Net Scripthook scripts or you will not be able to run this mod :(


Possible problems


  • Game crash at loading screen.
This can happen if you:

Is using wrong ScriptHook.dll version, the default DLL that goes with script its to be used with GTA with patch 1.0.6.0 or later, or with EFLC, if you wanna run the script in the GTA with patch 1.0.4.0 or lower you  need to copy the DLL from folder "DLL for 1.0.4.0" and overwrite the default one in the GTAIV.exe folder.

Didn't copied file Microsoft.Xna.Framework.dll, this file is loaded by script with xbox 360 control support, so if its missing game will crash at loading screen when script is loaded.


  • Error in script 'Iron Man IV':
Try the command reloadscripts, press " to see the scripthook console window.

This error can happen if you don't copy all files from Scripts folder:


to Scritps folder in GTAIV.exe folder.


This error can happen too if another script mod is deleting one of the Iron Man IV objects, in this case i recommend to remove all other scripts and test only with Iron Man IV to make sure that this is the reason or not.


Sometimes this error can happen randomly at game startup, in this case try using the scripthook console command reloadscripts, press " to see the console window then type the command.


  • Game crash at first screen (black screen):

Some users had this issue and was related to incompatible ScriptHookDotNet.asi file, so they tryed other sources and worked.



Another thing that you can try is use CCleaner to clean windows registry issues, this helped one of the users, game was crashing at loading screen and all was properly installed, so he did this registry clean and the problem was fixed :)



I hope that this info can help you solve your Iron Man IV problems :)

Saturday, April 13, 2013

[Script] Chainsaw for GTA iV

Chainsaw in GTA Vice City was a bad ass weapon, why don't have something similar in GTA IV?

Download: here (mirror)

You will be able to equip an chainsaw and have some GTA Vice City killing style.




Monday, April 8, 2013

[TUT] Cool "3D" target HUD

Today i wanna show how you can use some game features to create an cool "3D" target HUD to use in your scripts, this is an preview of what I'm talking about:



Download the sample script here.

The idea consists in draw checkpoints/coronas around the target, we will use the native function DRAW_CHECKPOINT to draw the checkpoints.

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

We will need the following objects to make this code work:


here we will store the possible targets

this will be the interval of the targets search

this object will give offset positions around the target

this is just an variable to help us create an rotation effect for the target HUD, we will increase it and apply to the Y value of the targetAux object rotation

this will set the actual target so we can kid with it :)


When the script loads we should create the object, choose an model with small volume to avoid collisions with other things, we also set this object to be invisible, without collisions and with freezeposition set to true, the wait(500) it's an single delay to avoid script crash at first start, because when game finishes loading the object creation can fail:


Ok, first let's search for the possible targets, in the tick let's check if the timer variable (timeWaitSearchTargets) it's less than zero, then we will reset it to 300 and search for the targets, so each 300 ms we will update the targets list:


Now we will reset the actual target to nothing and run the targets list to see what vehicle is close enough to the aim, we will do it only if user is pressing Aim key and if the targets list exists:


I'm using this method to find the targets.

Now that we have our target we can draw the checkpoint around it:


How it works:

First we set the targetAux object position to player position, you can use current camera position, but the result its almost the same
Then we set the rotation of this object to be the same of the camera
Now we just need to use the method GetOffsetPosition to detect the position around it and based on this we can define the Offset position around the target:

To get the position above the target:


Bellow target:


on the Left:


on the right Right:



This is an simple idea that works very fine, isn't the best option but works fine :)

You can use lights and coronas too, the result will look better.

Saturday, April 6, 2013

GTA 3 Rage Classic - Junkyard car smasher add-on

Today i was kidding with GTA III Rage Classic and decided to create an junkyard car smash feature:

Download: GTA 4 Mods




Controls:

Numpad 4, 6 - rotate crane
Numpad 8, 5 - change crane pitch
Numpad 0 - toggle magnet on/off
Numpad subtract, add - change magnet height above ground


You can leave an vehicle in an place to trigger the automatic mode:


or go to the control place and control the crane and magnet:


you can pick more than one vehicle:



Actually should work only in the GTA 3 Rage Classic mod, I'm planning to extend this to GTA IV/EFLC, but i need to find some models first.

Wednesday, April 3, 2013

[Update] AC-130 v1.1


This is the new version of my AC-130 script, not big changes, i don't know what more i can do for this script

What i did:

Performance improvement using new methods to find targets and create the night vision effect
Added XBox 360 controller
Added thermal camera effect
Added more effect for .40 and .105 projectiles
Added option to skip resolution auto detect for users that run at 3860x2160 (downsampling method)
Added new target HUD for Air support mode
Fixed EFLC texture issues
Fixed texture stretch issue
Fixed some bugs

Download: GTA 4 Mods

Script will go with two versions:

Default (AC130.net.dll): Requires dll Microsoft.Xna.Framework.dll in GTAIV.exe folder (included)
Non XNA (AC130Files\No XNA\AC130.vb): Without XBox 360 controller support.

Why we have two versions? Because in my tests with San Andreas IV the XNA version don't work :(


Controls: Keyboard + mouse:


F7 - Activate AC130 in remote control mode
in this mode, hotkeys are:

Hold middle mouse button and move mouse Up/Down to zoom in/out (change FOV)
1 - Switch to 105mm
2 - Switch to 40mm
3 - Switch to 20mm
Right click - toggle gun
W - Speed up plane
S - Slow down plane
A - turn left
D - turn right
Left click - Shoot with actual gun
C - Change camera when in 105mm gun mode
N - Switch nightvision mode On/OFf (EFLC will have one extra: thermal vision mode, ON/Thermal/Off)

F8 - Activate AC130 in "Air support" mode

In this mode you stay on the ground, aim at the vehicle, ped or ground to set the target,
then press 1 to fire 105mm, 2 to fire 40mm and 3 to fire 20mm gun (burst fire mode)

Controls: XBox 360 controller:

Hold right Trigger and press left Thumb Stick to activate AC130
Hold right Trigger and press right Thumb Stick to activate Air support mode

A - Shoot actual gun
B - Switch gun
X - Switch Nightvision mode
Y - Switch camera for 105 shoots
Left Thumb Stick - Aim
Left Trigger - Turn left
Right Trigger - Turn right
Left Shoulder - Zoom out
Right Shoulder - Zoom in

In Air support mode: Left Thumb Stick: Walk, Right Thumb Stick: Aim

To deactivate the AC130/Air support press left or right Thumb Stick