1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

(cwnewvegas) Melee Weapons

Discussion in 'Discussion' started by zaccat, Mar 2, 2013.

  1. I have found that when i get a melee weapon i equip it and i hit someone they dont get damage and this is in the console
    [ERROR] gamemodes/cwnewvegas/schema/entities/weapons/cw_sledgehammer/shared.lua:106: attempt to perform arithmetic on local 'normal' (a nil value)
    1. unknown - gamemodes/cwnewvegas/schema/entities/weapons/cw_sledgehammer/shared.lua:106

    This happens with all of the melee weapons


    Do you know how to fix it ?
     
  2. Look at line 106 of the said script.
    I dont have the script myself, but I'm pretty sure it's just a value bug.
     
  3. Post line 106 and I'll try and find what's wrong with it.
     
  4. -- Called when the player attempts to primary fire.
    function SWEP:primaryAttack()
    self:SetNextPrimaryFire(CurTime() + self.Primary.Delay);
    self:SetNextSecondaryFire(CurTime() + self.Primary.Delay);

    self:DoAnimations(); self:DoHitEffects();

    if (SERVER) then
    if (self.Owner.LagCompensation) then
    self.Owner:LagCompensation(true);
    end;

    local trace = self.Owner:GetEyeTraceNoCursor();

    if (self.Owner:GetShootPos():Distance(trace.HitPos) <= 64) then
    if ( IsValid(trace.Entity) ) then
    local player = Clockwork.entity:GetPlayer(trace.Entity);

    if ( trace.Entity:IsPlayer() or trace.Entity:IsNPC() ) then
    local normal = ( trace.Entity:GetPos() - self.Owner:GetPos() ):Normalize();
    local push = 128* normal;

    trace.Entity:SetVelocity(push);

    timer.Simple(FrameTime() * 0.5, function()
    if ( IsValid(trace.Entity) ) then
    trace.Entity:TakeDamageInfo( Clockwork.kernel:FakeDamageInfo(self.Primary.Damage, self, self, trace.HitPos, DMG_CLUB, 2) );
    end;
    end);
    else
     
  5. Not the entire function, just that one line.

    :p
     
  6. 106: local push = 128* normal;
     
  7. Arbiter329

    Arbiter329 Owner of Arc-Factory Roleplay

    Replace line 105 with this:

    Code:
    local normal = ( trace.Entity:GetPos() - self.Owner:GetPos() ):GetNormal();
     

Previous Readers (Total: 0)