Pages

Monday, November 25, 2013

[TUT] Particle effects

Nowadays let's play with particle effects, it is easy and give an great look to the script effects.

Download the project here.

As you almost certainly know an particle impact (PTFX) in GTA IV is the impact of bullet impacts, water splash, explosions, fire, water fountain, weapons muzzle, sparks, and so forth.. They are almost everywhere in the game.

In this video i show some exciting particle effects, take a appear :)

To get in touch with this effects we can use the following strategies:


Begin_PTFX
Start_PTFX_ON_OBJ
Start off_PTFX_ON_OBJ_BONE
Begin_PTFX_ON_PED
Start off_PTFX_ON_PED_BONE
Commence_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 varieties of approach, Start off and TRIGGER, the distinction is that Start will return an Particle Effect ID, and with this ID we have some control over the PTFX, we can cease the effect when we want for example, or change the particle impact Offset as well.

The TRIGGER will only get in touch with the particle effect and do not will return any ID, not all particle effects can be used with trigger, some only operate with start technique.
We use trigger in particle effects that will finish automatically, for instance to simulate an shoot we can trigger the muz_pistol to make the muzzle effect, i use this impact in Iron Man script to simulate the effect in his boots and hands when he is flying.

Crucial: If you want restart an PTFX satrted employing Begin method, usually stop the preceding, otherwise  you can develop an "bug" in the game and the particle effects never will operate any longer for your script till you reopen the game :(

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


Yet another interesting point about particle effects is that some particle effects has sounds and interact with game physics and pedestrians/autos, for example, the ambient_fire_generic will burn any ped that touches it,  the fire_chopper_tail will make fire sound :)

Let's start off with the more basic TRIGGER method:


What occurs here is that when i press quantity i will get an position in front of player then call the TRIGGER_PTFX strategy using that position.

The parameters are:


Easy no? Now let's use 1 far more sophisticated: TRIGGER_PTFX_ON_PED_BONE:


We are producing the player bleed with the PTFX blood_gun_entry_arterial

The parameters are comparable:


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

Now let's use an Begin approach, i wanna be capable to control when it will end:


The PTFX water_carwash_drips never ends.

Right here I am storing the ID returned by Start_PTFX_ON_PED_BONE into tmpID variable, an int32 sort. As you can see the parameters are just the identical sort utilized in TRIGGER_PTFX_ON_PED_BONE.
Following 10 seconds i will use the technique Stop_PTFX to stop the effect, as parameter we need the ID returned by the start approach.

Also we can eliminate the effect using:

Remove_PTFX_FROM_PED
Eliminate_PTFX_FROM_OBJECT
Remove_PTFX_FROM_Vehicle

These approaches will get rid of all PTFX from the ped/object/vehicle.


The EVOLVE_PTFX method will make some adjustments in the PTFX, i by no means utilized this but i can demonstrate the functionality primarily based on SCOCL files :)


Right here we get in touch with the EVOLVE_PTFX technique and use the param "fade" and an float quantity to minimize the opacity of the smoke effect, = full opacity ~1.eight = no opacity.

The parameters are:

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

This is the original code from SCOCL:


Simple to study? In no way ^^, but extremely valuable.


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


Parameters:

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

With this strategy we can make an spinning PTFX altering a single of the last 3 parameters :)



[TUT] Particle effects
9out of 10 based on 10 ratings. 9 user reviews.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.