All questions currently answered
*questions are in normal text
*answers are in quotes[ANSWERED] What units is muzzleVelocity measured in? Studs per millisecond?
1 torque unit is equal to 2 studs.
A 1x1 plate is 0.5x0.5x0.2 torque units.
and what units is lifetime of a projectile measured in? seconds?
milliseconds
[ANSWERED] Regarding these:
datablock ItemData(GunItem)
datablock ShapeBaseImageData(gunImage)
Is it ok to use GunItem and gunImage in another weapon's server.cs the same way it is used here? Also, what would you call GunItem and gunImage: local variables, objects, strings, idk?
No, doing so will overwrite the gun
They're objects; specifically, datablocks of class ItemData and ShapeBaseImageData
[ANSWERED] I'm not sure if I'm interpreting this script correctly, but the default gun code seems to intentionally have a .15 delay from the time you click to the time it fires (is it in seconds?). Why on earth would you want a delay like that? You'd want it to fire at the same time you click, right? Take a look at the code:
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Smoke";
stateTimeoutValue[2] = 0.14;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
the reason it's there is because you don't want people equipping and dequipping constantly and firing every time, like rapid fire.
[ANSWERED] I'm also wondering what this section of code does (I'm pretty sure it's for some kind of animation, but what exactly does that animation do, and what's with the getDamagePercent line?):
function gunImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);
}
when the gun is fired
if the player firing it is alive
Play the animation that shifts their hand up
Call the generic onFire method
end
It checks damage, similar to health
Instead of a "health" number starting at 100 and going to 0 when you're dead, the game uses a "damage" level which starts at 0 and goes to 100
So a damagePercent of 1 (which is equivalent to 100%) means the player is dead, less than that, they're still alive