FxAddBlood: Difference between revisions
Jump to navigation
Jump to search
m (Added language) |
(add oop syntax) |
||
Line 8: | Line 8: | ||
bool fxAddBlood ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [int count=1, float brightness=1.0] ) | bool fxAddBlood ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [int count=1, float brightness=1.0] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Effect]].addBlood}} | |||
===Required Arguments=== | ===Required Arguments=== |
Revision as of 20:55, 2 January 2015
Creates a blood splatter particle effect.
Syntax
bool fxAddBlood ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [int count=1, float brightness=1.0] )
OOP Syntax Help! I don't understand this!
- Method: Effect.addBlood(...)
Required Arguments
- posX, posY, posZ: the world coordinates where the effect originates.
- dirX, dirY, dirZ: a direction vector indicating where the blood flies to.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- count: the number of flying droplets to create.
- brightness: the brightness. Ranges from 0 (almost black) to 1 (normal color).
Example
Click to collapse [-]
ClientThis example creates blood effects when a player gets shot.
local rootElement = getRootElement() local healthvalue = 25 function BloodonDamage( attacker, weapon, bodypart, loss ) if loss > healthvalue then -- if the player loses more than 25 hp, then... local x, y, z = getElementPosition( source ) -- get player's position for adding blood local randombloodamount = math.random( 1, 3 ) -- random blood amount 1-3 fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, randombloodamount, 1 ) -- this adds blood to player's current position end end addEventHandler( "onClientPlayerDamage", rootElement, BloodonDamage ) -- calls the function when a player loses hp