• Porting the NaziZombies gamemode to gmod 13
    3 replies, posted
I'm attempting to port the nazizombies gamemode: [url]http://www.garrysmod.org/downloads/?a=view&id=132399[/url] to gmod 13. I believe I've really done all I can, and most of these errors just don't make sense to me. It's calling nil value on functions still included in gmod's lua or on functions that exist within the lua files. I've checked over it all extensively. Really the only way to see for yourself would to be reading over all of the code. Feel free to do so if you can tell me why _R is returning nil value. Edit: isValid is coming up as a null value in cl_legs.lua [CODE]local PlaybackRate = 1; local Sequence = nil; local Velocity = 0; local OldWeapon = nil; local HoldType = nil; local RenderAngle = nil; local BiaisAngle = nil; local RadAngle = nil; local RenderPos = nil; local RenderColor = {}; local ClipVector = vector_up * -1; local ForwardOffset = -24; local entLegs; function ShouldDrawLegs() return isValid(entLegs) and LocalPlayer():Alive() and GetViewEntity() == LocalPlayer() and not LocalPlayer():ShouldDrawLocalPlayer() and not LocalPlayer():GetObserverTarget(); end local fixedModelNames = { ["models/humans/group01/female_06.mdl"] = "models/player/group01/female_06.mdl", ["models/humans/group01/female_01.mdl"] = "models/player/group01/female_01.mdl", ["models/alyx.mdl"] = "models/player/alyx.mdl", ["models/humans/group01/female_07.mdl"] = "models/player/group01/female_07.mdl", ["models/charple01.mdl"] = "models/player/charple01.mdl", ["models/humans/group01/female_04.mdl"] = "models/player/group01/female_04.mdl", ["models/humans/group03/female_06.mdl"] = "models/player/group03/female_06.mdl", ["models/gasmask.mdl"] = "models/player/gasmask.mdl", ["models/humans/group01/female_02.mdl"] = "models/player/group01/female_02.mdl", ["models/gman_high.mdl"] = "models/player/gman_high.mdl", ["models/humans/group03/male_07.mdl"] = "models/player/group03/male_07.mdl", ["models/humans/group03/female_03.mdl"] = "models/player/group03/female_03.mdl", ["models/police.mdl"] = "models/player/police.mdl", ["models/breen.mdl"] = "models/player/breen.mdl", ["models/humans/group01/male_01.mdl"] = "models/player/group01/male_01.mdl", ["models/zombie_soldier.mdl"] = "models/player/zombie_soldier.mdl", ["models/humans/group01/male_03.mdl"] = "models/player/group01/male_03.mdl", ["models/humans/group03/female_04.mdl"] = "models/player/group03/female_04.mdl", ["models/humans/group01/male_02.mdl"] = "models/player/group01/male_02.mdl", ["models/kleiner.mdl"] = "models/player/kleiner.mdl", ["models/humans/group03/female_01.mdl"] = "models/player/group03/female_01.mdl", ["models/humans/group01/male_09.mdl"] = "models/player/group01/male_09.mdl", ["models/humans/group03/male_04.mdl"] = "models/player/group03/male_04.mdl", ["models/player/urban.mbl"] = "models/player/urban.mdl", -- It fucking returns the file type wrong as "mbl" D: ["models/humans/group03/male_01.mdl"] = "models/player/group03/male_01.mdl", ["models/mossman.mdl"] = "models/player/mossman.mdl", ["models/humans/group01/male_06.mdl"] = "models/player/group01/male_06.mdl", ["models/humans/group03/female_02.mdl"] = "models/player/group03/female_02.mdl", ["models/humans/group01/male_07.mdl"] = "models/player/group01/male_07.mdl", ["models/humans/group01/female_03.mdl"] = "models/player/group01/female_03.mdl", ["models/humans/group01/male_08.mdl"] = "models/player/group01/male_08.mdl", ["models/humans/group01/male_04.mdl"] = "models/player/group01/male_04.mdl", ["models/humans/group03/female_07.mdl"] = "models/player/group03/female_07.mdl", ["models/humans/group03/male_02.mdl"] = "models/player/group03/male_02.mdl", ["models/humans/group03/male_06.mdl"] = "models/player/group03/male_06.mdl", ["models/barney.mdl"] = "models/player/barney.mdl", ["models/humans/group03/male_03.mdl"] = "models/player/group03/male_03.mdl", ["models/humans/group03/male_05.mdl"] = "models/player/group03/male_05.mdl", ["models/odessa.mdl"] = "models/player/odessa.mdl", ["models/humans/group03/male_09.mdl"] = "models/player/group03/male_09.mdl", ["models/humans/group01/male_05.mdl"] = "models/player/group01/male_05.mdl", ["models/humans/group03/male_08.mdl"] = "models/player/group03/male_08.mdl", } local function FixModelName( mdl ) mdl = mdl:lower() for k,v in pairs( fixedModelNames ) do -- Better fix if k == mdl then return v end end return mdl end local hide = { "ValveBiped.Bip01_Head1", "ValveBiped.Bip01_Neck1", "ValveBiped.Bip01_Spine4", "ValveBiped.Bip01_Spine2", "ValveBiped.Bip01_L_Hand", "ValveBiped.Bip01_L_Forearm", "ValveBiped.Bip01_L_Upperarm", "ValveBiped.Bip01_L_Clavicle", "ValveBiped.Bip01_R_Hand", "ValveBiped.Bip01_R_Forearm", "ValveBiped.Bip01_R_Upperarm", "ValveBiped.Bip01_R_Clavicle"} local function legSetUp() -- Creates our legs entLegs= ClientsideModel(LocalPlayer():GetModel(), RENDERGROUP_OPAQUE); entLegs:SetNoDraw( true ) entLegs:SetSkin( LocalPlayer():GetSkin() ) entLegs:SetMaterial( LocalPlayer():GetMaterial() ) entLegs.LastTick = 0 function entLegs:BuildBonePositions() for k,v in pairs(hide)do local id = self:LookupBone(v); local bMat = self:GetBoneMatrix(id); if bMat then bMat:Scale(Vector(0,0,0)); self:SetBoneMatrix(id,bMat); end end end end -- Temporary values BreathScale = 0.5 NextBreath = 0 hook.Add( "UpdateAnimation", "NaziLegsUpdateAnimation", function( ply, velocity, maxseqgroundspeed ) if ply == LocalPlayer() then if IsValid( entLegs ) then --if LocalPlayer():GetActiveWeapon() != OldWeapon then -- Player switched weapons, change the bones for new weapon -- OldWeapon = LocalPlayer():GetActiveWeapon() -- WeaponChanged( OldWeapon ) --end if entLegs:GetModel() != FixModelName( LocalPlayer():GetModel() ) then --Player changed model without spawning? entLegs:SetModel( FixModelName( LocalPlayer():GetModel() ) ) end entLegs:SetMaterial( LocalPlayer():GetMaterial() ) entLegs:SetSkin( LocalPlayer():GetSkin() ) Velocity = LocalPlayer():GetVelocity():Length2D() PlaybackRate = 1 if Velocity > 0.5 then -- Taken from the SDK, gets the proper play back rate if maxseqgroundspeed < 0.001 then PlaybackRate = 0.01 else PlaybackRate = Velocity / maxseqgroundspeed PlaybackRate = math.Clamp( PlaybackRate, 0.01, 10 ) end end entLegs:SetPlaybackRate( PlaybackRate ) -- Change the rate of playback. This is for when you walk faster/slower Sequence = LocalPlayer():GetSequence() if ( entLegs.Anim != Sequence ) then -- If the player changes sequences, change the legs too entLegs.Anim = Sequence entLegs:ResetSequence( Sequence ) end entLegs:FrameAdvance( CurTime() - entLegs.LastTick ) -- Advance the amount of frames we need entLegs.LastTick = CurTime() BreathScale = sharpeye and sharpeye.GetStamina and math.Clamp( math.floor( sharpeye.GetStamina() * 5 * 10 ) / 10, 0.5, 5 ) or 0.5 -- More compatability for sharpeye. This changes the models breathing paramaters to go off of sharpeyes stamina system if NextBreath <= CurTime() then -- Only update every cycle, should stop MOST of the jittering NextBreath = CurTime() + 1.95 / BreathScale entLegs:SetPoseParameter( "breathing", BreathScale ) end entLegs:SetPoseParameter( "move_yaw", ( LocalPlayer():GetPoseParameter( "move_yaw" ) * 360 ) - 180 ) -- Translate the walk direction entLegs:SetPoseParameter( "body_yaw", ( LocalPlayer():GetPoseParameter( "body_yaw" ) * 180 ) - 90 ) -- Translate the body yaw entLegs:SetPoseParameter( "spine_yaw",( LocalPlayer():GetPoseParameter( "spine_yaw" ) * 180 ) - 90 ) -- Translate the spine yaw else legSetUp() end end end ) hook.Add( "RenderScreenspaceEffects", "NaziRenderLegs", function() cam.Start3D( EyePos(), EyeAngles() ) if ShouldDrawLegs() then -- Render check RenderPos = LocalPlayer():GetPos() BiaisAngles = sharpeye_focus and sharpeye_focus.GetBiaisViewAngles and sharpeye_focus
Can you post the code you converted?
_R is no longer a valid way to get all metatables. You're going to have to replace all _R tables with the appropriate metatable
Do I replace that with FindMetaTable? That's what my research has told me, although, it doesn't make much sense to me. Edit: I declared local Player = FindMetaTable("Player") and got rid of all the _R.
Sorry, you need to Log In to post a reply to this thread.