What makes a weapon function? -
Infamous - 16.04.2015
More of a GTA question I guess but i'm curious what elements actually come into play when you fire an M4 for example? I guess you have the weapon model and the particle effect but what creates the bullets? and makes them fire from the players position etc?
Re: What makes a weapon function? -
JaydenJason - 16.04.2015
Quote:
Originally Posted by Infamous
More of a GTA question I guess but i'm curious what elements actually come into play when you fire an M4 for example? I guess you have the weapon model and the particle effect but what creates the bullets? and makes them fire from the players position etc?
|
I suppose get player offsets, add a little number to Z to match the height of the player, whether crouched/standing
get aiming offsets, and check if a weapon has been shot before for the recoil/bullets to twirl in your crosshair so the bullets look like the top ones in the pictures, not from the bottom ones. (left to right, deagle mp5 m4, both top n bottom)
Get the most far end available with object detection so bullets won't go through objects to shoot players (except some gates)
Call some function to check if there's a player is aligned with the aiming offsets, along with the recoil
If player = aligned with the aiming offsets then play animation of the getting shot, depending on what position the shooter is, add a blood particle, and remove health
(just a lil info)
Re: What makes a weapon function? -
Infamous - 16.04.2015
Thanks for the detailed reply, it would be good if we had access to the internal functions used so we could create our own systems etc.
Re: What makes a weapon function? -
JaydenJason - 16.04.2015
It would, all I want to be added is a function to make weapons invisible, so I can for example put the colt in the hands of a deagle without resizing and stuff, or add a load of objects to cover up the deagle to find out that people also use mods for weapons..
And yeah, you can always try making your own weapon function, I tried and succeeded at making a smith&wesson of a deagle using some variables, pvars, weapon detection and a little 3dtextlabel to show which weapon is being held
Re: What makes a weapon function? -
Crayder - 17.04.2015
Quote:
Originally Posted by JaydenJason
It would, all I want to be added is a function to make weapons invisible, so I can for example put the colt in the hands of a deagle without resizing and stuff
|
AFAIK, not possible in GTA. Therefore, not possible in SA-MP.
Re: What makes a weapon function? -
RebeloX - 17.04.2015
From what I learn and has you said, you have the weapon model and particle effects, but you also have another thing and this thing is what makes the shot. I'm not sure if GTA is based on this but as far has I know when you want to "shoot" something you make a RayCast.
A RayCast it's a ray that has a starting point and continues infinitely in some direction, mathematically speaking. The Raycast will intersect any object within the ray and it will return information about the objects intersected, like how far are they, what type are they, etc..
You can check
Pottus Plugin to see an implementation of the RayCast.
Re: What makes a weapon function? -
Infamous - 17.04.2015
Thanks BlueX, with the info provided i'm sure it is recreatable now.
Re: What makes a weapon function? -
JaydenJason - 18.04.2015
Quote:
Originally Posted by Crayder
AFAIK, not possible in GTA. Therefore, not possible in SA-MP.
|
Try holding a weapon and go inside the barber shop, and stand infront of the mirror
The mirror makes the weapon disappear, so there must be a way to.
Re: What makes a weapon function? -
Crayder - 18.04.2015
Quote:
Originally Posted by JaydenJason
Try holding a weapon and go inside the barber shop, and stand infront of the mirror
The mirror makes the weapon disappear, so there must be a way to.
|
Lol. The 'mirror' (CULL zone), does not reflect weapons.