Usage
Syntax: shoot(float x, float y, float z, float angle, float zangle, float power, string ani, string aniparams);
Explanation
Shoots a projectile (TProjectile) that flies through the air until it hits the ground or a blocking object.
x, y, and z is the projectile's starting position in level coordinates.
angle is the direction of the projectile on the x/y plane. It's in radian units and ranges from 0 to pi*2.
zangle is the angle between the ground and the starting path of the projectile. It's in radian units and ranges from 0 to pi/2, where pi/2 fires the projectile straight upwards. If zangle is 0, it will behave like a shootarrow arrow. In this state, the power parameter will not do anything.
power determines initial speed.
The global variable gravity determines the falling acceleration of all projectiles.
When the projectile hits something, it will trigger onActionProjectile or onActionProjectile2.
Use setshootparams to pass parameters to these event functions.
onPlayerShoots is triggered when shoot is used.
Example
//#CLIENTSIDE function onWeaponFired() { temp.angle = getangle(vecx(player.dir), vecy(player.dir)); temp.zangle = pi / 4; temp.power = 1.5; shoot(player.x, player.y, player.z, temp.angle, temp.zangle, temp.power, "arrow", "barrow0.png"); }
... shoots an arrow when the player uses the weapon.
//#CLIENTSIDE function onWeaponFired() { gravity = 0.1; temp.angle = getangle(vecx(player.dir), vecy(player.dir)); temp.zangle = 0.01; temp.power = 2; shoot(player.x, player.y, player.z, temp.angle, temp.zangle, temp.power, "arrow", "barrow0.png"); }
... shoots an arrow at a low zangle and gravity to simulate a bullet.
Categories
CategoryFunctionClientside
CategoryFunctionServerside
There are no comments on this page. [Add comment]