Mario Models... Again.

1: WHY was my thread closes? 2: I fixed the damage types, and still got an error. My threads keep getting closed >_<

If there’s already an active thread, please link me and I will stop this madness!


 [ERROR] lua/entities/mariofire/init.lua:18: attempt to call global 'curtime' (a nil value)  1. unknown - lua/entities/mariofire/init.lua:18   2. Spawn - [C]:-1    3. unknown - lua/weapons/mario_fireballs/shared.lua:77
I have yet to investigate, though. I will update the code above. 

AddCSLuaFile( "shared.lua" )include( 'shared.lua' )

/*---------------------------------------------------------   Name: Initialize---------------------------------------------------------*/function ENT:Initialize()
    -- Use the doll model    self.Entity:SetModel( "models/props_c17/doll01.mdl" )    self.Entity:SetMoveType( MOVETYPE_FLYGRAVITY );    self.Entity:SetMoveCollide( MOVECOLLIDE_FLY_CUSTOM );    self.Entity:SetGravity( 0.5 );
    -- Use the model's physics    self.Entity:PhysicsInitSphere(7, metal);    self.CrTime = curtime();    self.LifeLeft = 1;    -- Wake the physics object up. It's time to have babies!    local phys = self.Entity:GetPhysicsObject();    if (phys:IsValid()) then        phys:Wake()    end
end

--------------------------------------------------------------------------------- Purpose:-- Input  : *pOther --------------------------------------------------------------------------------function ENT:Touch( pOther )
    local    tr;    tr = {}    tr.startpos = self.Entity:NearestPoint( pOther:OBBCenter() );    tr.endpos = pOther:NearestPoint( self.Entity:OBBCenter() );    tr.filter = self.Entity;    tr = util.TraceLine( tr );    local    vecNormalizedVel = self.Entity:GetVelocity();
    vecNormalizedVel = VectorNormalize( vecNormalizedVel );
    if( self.Entity:GetOwner() && self.Entity:GetOwner():IsPlayer() ) then        local    dmgInfo = DamageInfo();        dmgInfo:SetInflictor( self.Entity );        dmgInfo:SetAttacker( self.Entity:GetOwner() );        dmgInfo:SetDamage( 25 );        dmgInfo:SetDamageType( DMG_BURN | DMG_PREVENT_PHYSICS_FORCE );        dmgInfo:SetDamagePosition( tr.HitPos );        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );        pOther:Ignite(3, 0)    else        local    dmgInfo = DamageInfo();        dmgInfo:SetInflictor( self.Entity );        dmgInfo:SetAttacker( self.Entity:GetOwner() );        dmgInfo:SetDamage( 0 );        dmgInfo:SetDamageType( DMG_BURN | DMG_PREVENT_PHYSICS_FORCE );        dmgInfo:SetDamagePosition( tr.HitPos );        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );        pOther:Ignite(30, 0)        timer.Simple(30, pOther.Extinguish() )    end
    self.Entity:Remove();
    -- play body "thwack" sound--    self.Entity:EmitSound( "Weapon_Crossbow.BoltHitBody" );    -- Fireballs don't thwack.
    local vForward;
    vForward = self.Entity:GetUp();    vForward = VectorNormalize ( vForward );
    self.Touch = function( ... ) return end;--    self.Think = function( ... ) return end;
    local Pos1 = tr.HitPos + tr.HitNormal    local Pos2 = tr.HitPos - tr.HitNormal--    util.Decal( "Blood", Pos1, Pos2 )    -- Scorch!
end

/*---------------------------------------------------------   Name: PhysicsCollide---------------------------------------------------------*/function ENT:PhysicsCollide( data, physobj )
    -- Shoot some blood--    local effectdata = EffectData();--    effectdata:SetOrigin( self.Entity:GetPos() );--    util.Effect( "BloodImpact", effectdata );
    local Pos1 = data.HitPos + data.HitNormal    local Pos2 = data.HitPos - data.HitNormal        if( self.Entity:GetOwner() && self.Entity:GetOwner():IsPlayer() ) then        local    dmgInfo = DamageInfo();        dmgInfo:SetInflictor( self.Entity );        dmgInfo:SetAttacker( self.Entity:GetOwner() );        dmgInfo:SetDamage( 25 );        dmgInfo:SetDamageType(bit.bor(DMG_BURN , DMG_PREVENT_PHYSICS_FORCE ));        dmgInfo:SetDamagePosition( tr.HitPos );        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );        pOther:Ignite(3, 0)    -- Ignite for a little while, will do no noticable damage.    else        local    dmgInfo = DamageInfo();        dmgInfo:SetInflictor( self.Entity );        dmgInfo:SetAttacker( self.Entity:GetOwner() );        dmgInfo:SetDamage( 0 );        dmgInfo:SetDamageType(bit.bor(DMG_BURN , DMG_PREVENT_PHYSICS_FORCE ));        dmgInfo:SetDamagePosition( tr.HitPos );        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );        pOther:Ignite(30, 0)        timer.Simple(30, pOther.Extinguish() )    end    --    util.Decal( "Blood", Pos1, Pos2 )    -- Scorch
    -- Play sound on death--[[    if (data.Speed > 80 && data.DeltaTime > 0.2 ) then        self.Entity:EmitSound( "Weapon_Crossbow.BoltHitBody" );    end]]
    SafeRemoveEntityDelayed( self.Entity, 0.1 );
end
function ENT:Think()    self.LifeLeft = 3-self.CrTime    if self.LifeLeft <= 0 then self:Remove() endend
/*---------------------------------------------------------   Name: OnTakeDamage---------------------------------------------------------*/function ENT:OnTakeDamage( dmginfo )
    -- React physically when shot/getting blown    self.Entity:TakePhysicsDamage( dmginfo )
end





AddCSLuaFile( "shared.lua" )include( 'shared.lua' )




/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()


    -- Use the doll model
    self.Entity:SetModel( "models/props_c17/doll01.mdl" )
    self.Entity:SetMoveType( MOVETYPE_FLYGRAVITY );
    self.Entity:SetMoveCollide( MOVECOLLIDE_FLY_CUSTOM );
    self.Entity:SetGravity( 0.5 );


    -- Use the model's physics
    self.Entity:PhysicsInitSphere(7, metal);
    self.CrTime = curtime();
    self.LifeLeft = 1;
    -- Wake the physics object up. It's time to have babies!
    local phys = self.Entity:GetPhysicsObject();
    if (phys:IsValid()) then
        phys:Wake()
    end


end




-------------------------------------------------------------------------------
-- Purpose:
-- Input  : *pOther -
-------------------------------------------------------------------------------
function ENT:Touch( pOther )


    local    tr;
    tr = {}
    tr.startpos = self.Entity:NearestPoint( pOther:OBBCenter() );
    tr.endpos = pOther:NearestPoint( self.Entity:OBBCenter() );
    tr.filter = self.Entity;
    tr = util.TraceLine( tr );
    local    vecNormalizedVel = self.Entity:GetVelocity();


    vecNormalizedVel = VectorNormalize( vecNormalizedVel );


    if( self.Entity:GetOwner() && self.Entity:GetOwner():IsPlayer() ) then
        local    dmgInfo = DamageInfo();
        dmgInfo:SetInflictor( self.Entity );
        dmgInfo:SetAttacker( self.Entity:GetOwner() );
        dmgInfo:SetDamage( 25 );
        dmgInfo:SetDamageType( DMG_BURN | DMG_PREVENT_PHYSICS_FORCE );
        dmgInfo:SetDamagePosition( tr.HitPos );
        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );
        pOther:Ignite(3, 0)
    else
        local    dmgInfo = DamageInfo();
        dmgInfo:SetInflictor( self.Entity );
        dmgInfo:SetAttacker( self.Entity:GetOwner() );
        dmgInfo:SetDamage( 0 );
        dmgInfo:SetDamageType( DMG_BURN | DMG_PREVENT_PHYSICS_FORCE );
        dmgInfo:SetDamagePosition( tr.HitPos );
        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );
        pOther:Ignite(30, 0)
        timer.Simple(30, pOther.Extinguish() )
    end


    self.Entity:Remove();


    -- play body "thwack" sound
--    self.Entity:EmitSound( "Weapon_Crossbow.BoltHitBody" );    -- Fireballs don't thwack.


    local vForward;


    vForward = self.Entity:GetUp();
    vForward = VectorNormalize ( vForward );


    self.Touch = function( ... ) return end;
--    self.Think = function( ... ) return end;


    local Pos1 = tr.HitPos + tr.HitNormal
    local Pos2 = tr.HitPos - tr.HitNormal
--    util.Decal( "Blood", Pos1, Pos2 )    -- Scorch!


end




/*---------------------------------------------------------
   Name: PhysicsCollide
---------------------------------------------------------*/
function ENT:PhysicsCollide( data, physobj )


    -- Shoot some blood
--    local effectdata = EffectData();
--    effectdata:SetOrigin( self.Entity:GetPos() );
--    util.Effect( "BloodImpact", effectdata );


    local Pos1 = data.HitPos + data.HitNormal
    local Pos2 = data.HitPos - data.HitNormal
    
    if( self.Entity:GetOwner() && self.Entity:GetOwner():IsPlayer() ) then
        local    dmgInfo = DamageInfo();
        dmgInfo:SetInflictor( self.Entity );
        dmgInfo:SetAttacker( self.Entity:GetOwner() );
        dmgInfo:SetDamage( 25 );
        dmgInfo:SetDamageType(bit.bor(DMG_BURN , DMG_PREVENT_PHYSICS_FORCE ));
        dmgInfo:SetDamagePosition( tr.HitPos );
        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );
        pOther:Ignite(3, 0)    -- Ignite for a little while, will do no noticable damage.
    else
        local    dmgInfo = DamageInfo();
        dmgInfo:SetInflictor( self.Entity );
        dmgInfo:SetAttacker( self.Entity:GetOwner() );
        dmgInfo:SetDamage( 0 );
        dmgInfo:SetDamageType(bit.bor(DMG_BURN , DMG_PREVENT_PHYSICS_FORCE ));
        dmgInfo:SetDamagePosition( tr.HitPos );
        pOther:DispatchTraceAttack( dmgInfo, vecNormalizedVel, tr.HitPos );
        pOther:Ignite(30, 0)
        timer.Simple(30, pOther.Extinguish() )
    end
    
--    util.Decal( "Blood", Pos1, Pos2 )    -- Scorch


    -- Play sound on death
--[[    if (data.Speed > 80 && data.DeltaTime > 0.2 ) then
        self.Entity:EmitSound( "Weapon_Crossbow.BoltHitBody" );
    end]]


    SafeRemoveEntityDelayed( self.Entity, 0.1 );


end


function ENT:Think()
    self.LifeLeft = 3-self.CrTime
    if self.LifeLeft <= 0 then self:Remove() end
end


/*---------------------------------------------------------
   Name: OnTakeDamage
---------------------------------------------------------*/
function ENT:OnTakeDamage( dmginfo )


    -- React physically when shot/getting blown
    self.Entity:TakePhysicsDamage( dmginfo )


end










It wasn’t doing damage, but that’s likely because of the new error.


[ERROR] lua/entities/mariofire/init.lua:50: ')' expected near '|'  1. unknown - lua/entities/mariofire/init.lua:0

^ Fixed…


dmgInfo:SetDamageType( bit.bor( DMG_BURN, DMG_PREVENT_PHYSICS_FORCE ) )

… Next error:


[ERROR] lua/entities/mariofire/init.lua:18: attempt to call global 'curtime' (a nil value)  1. unknown - lua/entities/mariofire/init.lua:18
   2. Spawn - [C]:-1
    3. unknown - lua/weapons/mario_fireballs/shared.lua:77




[ERROR] lua/entities/mariofire/init.lua:132: attempt to perform arithmetic on field 'CrTime' (a nil value)
  1. unknown - lua/entities/mariofire/init.lua:132




[ERROR] lua/entities/mariofire/init.lua:105: attempt to index global 'tr' (a nil value)
  1. unknown - lua/entities/mariofire/init.lua:105


[editline]12th December 2012[/editline]

Okay… Wrong name. >_<

It was closed because it was a “crap thread.” What does that mean? Who knows! That is what garry likes to close threads as and it isn’t very descriptive… with the amount of threads he locks I suppose it would be a waste of his time to describe exactly what the reason was.

I still don’t get what threads he deciedes to lock and what threads he deciedes to let live. Apparently he doesn’t like yours and I would be carefull about starting multiple new threads like you have done. You might get banned.

And to fix your error with curtime… It is CurTime()

CurTime has been done. http://forum.facepunch.com/showthread.php?t=1232897&p=38851037#post38851037

And I have been banned before… But I really want help with this, so Garry can suck my ass.