Ah, well I'm finally back home from England! Thanks Zoey, I'd gladly accept as much help as you can give me mainly because a few of these things I'm having problems with; plus I have actually never scripted a weapon before (Other than just editing data for the weapons that derive from bases.).
Heh... wasn't referring to just that one post. :P
SeveredSkull, when can we see a proof-of-concept? I'm really excited to see where this is going!
Unfortunately my friend, there isn't much to look at right now. Like I said earlier, the models on the view models haven't been written yet - I'm having some issues putting the menu to switch clips onto the base rather than on a hook in a autorun file (My first mistake was to write that in there in the first place... >.>), - And I haven't really come up with a clear way to give clips to the player. I haven't done this for one main reason: Whats the best way to make it work well with almost any gamemode?
One thing I can do for you, is post the Damage system which is nearly finished. I started to get a little advanced and make combo bonuses for different bullet combinations, but I decided to hold out on that. You will most likely find that section if you read it.
I don't remember if I stated this, but I asked my father for input on most of this stuff. He was in the military (retired) and he has been deployed, so I asked him about all the different types of ammo, bullet points, and effectiveness of all the different types of rounds. On top of this, I spent a few days of researching on my own to find some actually statistics about the power of the gunpowder, the trajectory of different bullets, etc. The result... is the script below:
/* 1 foot = 16 Units
1 yard = 48 Units
100 Meters = 328 feet
half mile = 1,320 feet
Use The Clip System for bullets :D
HITGROUP_GENERIC = 0
HITGROUP_HEAD = 1
HITGROUP_CHEST = 2
HITGROUP_STOMACH = 3
HITGROUP_LEFTARM = 4
HITGROUP_RIGHTARM = 5
HITGROUP_LEFTLEG = 6
HITGROUP_RIGHTLEG = 7
HITGROUP_GEAR = 10
*/
APRate = 1 // 1 + AP Damage. We will ad this in later. would be like a .5 addition or so. This is a constant for the bonus rating AP Rounds have vs Armor.
ACRate = 1 // This is the Armor Class Type. Will be a INT on the player table
effectives = {}
effectives.pistol = {}
effectives.rifle = {}
effectives.pistol[6] = 1920 //SniperPenetratedRound
effectives.pistol[7] = 3360 //AlyxGun = 3360
effectives.rifle[1] = 2880 //CombineCannon = 2880
effectives.rifle[2] = 10496 //AirboatGun = 10496
effectives.rifle[3] = 10496 //StriderMinigun = 10496
effectives.rifle[4] = 7872 //Gravity = 7872
effectives.rifle[5] = 2400 //Battery = 2400
effectives.rifle[6] = 2400 //SniperPenetratedRound = 2400
effectives.rifle[7] = 21120 //SniperRound = 21120
effectives.rifle[8] = 6560 //AlyxGun = 6560
function ScaleKombatDamage( ply, hitgroup, dmginfo )
DebugDamage = dmginfo:GetDamage()
/*
--Don't modify data if its falling or explosive data
if (dmginfo:IsFallDamage() || dmginfo:IsExplosiveDamage()) then
return
end*/
if dmginfo:IsBulletDamage() then
--DEFINES
DoDamage = dmginfo:GetDamage()
attacker = dmginfo:GetInflictor()
victim = ply:GetPos()
-- More damage if we're shot in the head
if ( hitgroup == HITGROUP_HEAD ) then
DoDamage = dmginfo:GetDamage()
end
-- Normal Damage if we're shot anywhere else
if ( hitgroup == HITGROUP_LEFTARM || hitgroup == HITGROUP_RIGHTARM ||
hitgroup == HITGROUP_LEFTLEG || hitgroup == HITGROUP_RIGHTLEG ||
hitgroup == HITGROUP_CHEST || hitgroup == HITGROUP_STOMACH) then
--Shared Properties:
HPofHitgroup = ply.BodyArmor[hitgroup] //This SHOULD work... The system is set up using the indexes... so if it works we will just convert it.
EffectiveRange = effectives[ply:GetActiveWeapon().GunType][ply:GetActiveWeapon().ClipSlot]
--Bullet Data
BulletPoint = attacker.Clips[attacker:GetActiveWeapon().ClipSlot][attacker:GetActiveWeapon().CurrentClip.Clip].Point
BulletMaterial = attacker.Clips[attacker:GetActiveWeapon().ClipSlot][attacker:GetActiveWeapon().CurrentClip.Clip].Material
BulletJacket = attacker.Clips[attacker:GetActiveWeapon().ClipSlot][attacker:GetActiveWeapon().CurrentClip.Clip].Jacketed
BulletPropulsion = attacker.Clips[attacker:GetActiveWeapon().ClipSlot][attacker:GetActiveWeapon().CurrentClip.Clip].Propulsion
/*---------------------------------------------------------------
Bullet Combo
---------------------------------------------------------------*/
/*
-- We Arent Ready For This Yet! Ill add it in later once I add all the other features in.
if (BulletMaterial == "DU") then
if (BulletPoint == "Sptz" || BulletPoint == "Bal") then
APRate = 5
else
APRate = 4
end
end
if (BulletMaterial == "Lead") then
if (BulletPropulsion == "NC") then
// Bullet is disintegrated upon firing...
else
//Anything Else we need to add?
end
end
*/
--If our attacker is further than double the range then half the damage.
if (attacker:Distance(victim) >= EffectiveRange*2) then
DoDamage = DoDamage - (DoDamage / 2)
end
/*---------------------------------------------------------------
Armor Modification
---------------------------------------------------------------*/
ArmorTypeModifier = 1
BodyArmorDamage = ((force * 1.5)*(APRate / ACRate)) / HPofHitgroup //Do more damage! ACRate might screw me over.
//Deal Damage to Armor then Player:
ply.BodyArmor[hitgroup] = HPofHitgroup - BodyArmorDamage
DoDamage = DoDamage - (DoDamage * (HPofHitgroup / 100))
/*---------------------------------------------------------------
HP/SP Modification
---------------------------------------------------------------*/
--Dad says they wont penetrate body armor ususally... but it packs a hell of a punch on unarmored targets.
if (BulletPoint == "HP" || BulletPoint == "SP" || BulletPoint == "Ballistic") then
if (HPofHitgroup <= 25) then
DoDamage = DoDamage + (DoDamage / 4)
else
DoDamage = DoDamage - (DoDamage / 4)
end
end
end
--Change the damage accordingly.
dmginfo:SetDamage(DoDamage)
end
print("Armor took "..BodyArmorDamage.." at "..hitgroup)
print("Armor should now be at "..HPofHitgroup)
print("You took "..DoDamage.." of "..DebugDamage.." damage.")
end
hook.Add("ScalePlayerDamage","ScaleKombatDamage",ScaleKombatDamage)
I have yet to be able to test this part, but I'm pretty sure it will work. I just got home and I am exhausted, so no testing today. Plus registration for college...