FireBullet: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 14: Line 14:
FireBullet(26, GetMyPos().x, GetMyPos().y, GetMyPos().z+0.5 );
FireBullet(26, GetMyPos().x, GetMyPos().y, GetMyPos().z+0.5 );
</source>|
</source>|
retvals=The function always returns null.
note=It has been found on testing that when the posx, posy and posz are invalid, (0,0,0) for example then the npc shoots correctly according to value in aimdir. This solves problem like bullet firing above gun or below gun and timings of fire.
<source lang=lua>FireBullet(weaponid, 0, 0, 0 )</source>
In above code, subsequent calls to FireBullet may not be required. npc fires as long as onfoot-sync data is send.
|
retvals=The function always returns null.|
relfuncs=
*[[FireSniperRifle]]
*[[FireSniperRifleEx]]
}}
}}

Latest revision as of 10:20, 23 October 2024

This function was added in v1.8 beta 4 and will not work in previous versions.


Description:
This will send a bullet-fired packet to server.


Parameters:

( weaponid, posx, posy, posz)

weaponid: The ID of the weapon whose bullet is fired
posx : The x co-ordinate of bullet-origin position
posy : The y co-ordinate of bullet-origin position
posz : The z co-ordinate of bullet-origin position
The posx, posy are approximately same as that of npc's position. However posz when given must be slightly greater (+0.5) than npc's z-coordinate.


Return Values:
The function always returns null.

Important Note:
It has been found on testing that when the posx, posy and posz are invalid, (0,0,0) for example then the npc shoots correctly according to value in aimdir. This solves problem like bullet firing above gun or below gun and timings of fire.

FireBullet(weaponid, 0, 0, 0 )

In above code, subsequent calls to FireBullet may not be required. npc fires as long as onfoot-sync data is send.

Example

FireBullet(26, GetMyPos().x, GetMyPos().y, GetMyPos().z+0.5 );

Related Functions

The following functions may be helpful as they relate to this function in one way or another.