• suit model change
    15 replies, posted
  • Avatar of n0mi
  • yeah sorry for that, what i need is like if you press on "E" on a suitcase then you change model from like "models/player/breen.mdl" to models/player/combine_soldier_prisonguard.mdl so it just change you model and if you can make it so when you die it stay with that i mean is if you die with the suitcase on you like used it so you got the model models/player/combine_soldier_prisonguard.mdl so it don't change back to models/player/breen.mdl, hope you understand myold post:[url]http://facepunch.com/threads/1077524?highlight=[/url] my second old post:[url]http://facepunch.com/threads/1180262?highlight=[/url] wonder if someone can put this togheter
  • Avatar of brandonj4
  • Do you want the suitcase to be a SENT? What do you mean by having the suitcase "on"?
  • Avatar of n0mi
  • yes i want it as en sent i was meaning when you wear the suit it change your model when you spawn the sent and press on it you change model
  • Avatar of brandonj4
  • Are you familiar with SENTS? Let me try something because I bet you know your english isn't the greatest but i'll give it a go. You want a SENT to change your model to a different model. It will only change to the other model if your model is the model previous to the change. When you die it stays as is? Is this what you are asking specifically?
  • Avatar of n0mi
  • [QUOTE=brandonj4;35760138]Are you familiar with SENTS? Let me try something because I bet you know your english isn't the greatest but i'll give it a go. You want a SENT to change your model to a different model. It will only change to the other model if your model is the model previous to the change. When you die it stays as is? Is this what you are asking specifically?[/QUOTE] yeah if you mean it stay as the model you changed to
  • Avatar of brandonj4
  • Alright I am testing what I made at the moment won't be long till I send you the code. [editline]29th April 2012[/editline] Serverside code lua/autorun/server [lua] local use_model = false hook.Add("PlayerDeath", "DeathOfPlayers", function(victim, weapon, killer) victim.model = victim:GetModel() if victim.model == "models/player/combine_soldier_prisonguard.mdl" then use_model = true else use_model = false end end) hook.Add("PlayerSpawn", "CheckModel", function(ply) // Use GM for gamemodes it wouldn't override for me but I tested it and it worked if use_model == true then ply:SetModel("models/player/combine_soldier_prisonguard.mdl") end end) [/lua] This is the SENT: cl_init.lua [lua] include("shared.lua") function ENT:Initialize() end function ENT:Draw() if !LocalPlayer():Alive() then return end self.Entity:DrawModel() end function ENT:Think() end [/lua] init.lua [lua] AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self.Entity:SetModel("models/props_c17/SuitCase_Passenger_Physics.mdl") self.Entity:PhysicsInit(SOLID_VPHYSICS) self.Entity:SetMoveType(MOVETYPE_VPHYSICS) self.Entity:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) local phys = self.Entity:GetPhysicsObject() self.nodupe = true self.ShareGravgun = true if phys and phys:IsValid() then phys:Wake() end self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS) end function ENT:Use(activator, caller) if activator:IsPlayer() and activator:Alive() then activator:SetModel("models/player/combine_soldier_prisonguard.mdl") end //self:Remove() remove if you wish end [/lua] shared.lua [lua] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "SuitCase" ENT.Author = "Inferno, Eh?" ENT.Spawnable = false ENT.AdminSpawnable = true [/lua] Enjoy :)
  • Avatar of n0mi
  • [QUOTE=brandonj4;35760592]Alright I am testing what I made at the moment won't be long till I send you the code. [editline]29th April 2012[/editline] Serverside code lua/autorun/server [lua] local use_model = false hook.Add("PlayerDeath", "DeathOfPlayers", function(victim, weapon, killer) victim.model = victim:GetModel() if victim.model == "models/player/combine_soldier_prisonguard.mdl" then use_model = true else use_model = false end end) hook.Add("PlayerSpawn", "CheckModel", function(ply) // Use GM for gamemodes it wouldn't override for me but I tested it and it worked if use_model == true then ply:SetModel("models/player/combine_soldier_prisonguard.mdl") end end) [/lua] This is the SENT: cl_init.lua [lua] include("shared.lua") function ENT:Initialize() end function ENT:Draw() if !LocalPlayer():Alive() then return end self.Entity:DrawModel() end function ENT:Think() end [/lua] init.lua [lua] AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self.Entity:SetModel("models/props_c17/SuitCase_Passenger_Physics.mdl") self.Entity:PhysicsInit(SOLID_VPHYSICS) self.Entity:SetMoveType(MOVETYPE_VPHYSICS) self.Entity:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) local phys = self.Entity:GetPhysicsObject() self.nodupe = true self.ShareGravgun = true if phys and phys:IsValid() then phys:Wake() end self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS) end function ENT:Use(activator, caller) if activator:IsPlayer() and activator:Alive() then activator:SetModel("models/player/combine_soldier_prisonguard.mdl") end //self:Remove() remove if you wish end [/lua] shared.lua [lua] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "SuitCase" ENT.Author = "Inferno, Eh?" ENT.Spawnable = false ENT.AdminSpawnable = true [/lua] Enjoy :)[/QUOTE] doest seems it works for me i put in first code to lua/autorun/server and the other 3 to 3 lua files in to a foldercalled suit in lua/entities i found it in entities in gmod but can't spawn it
  • Avatar of brandonj4
  • Change this to true if you want non-admins to spawn it: [lua]ENT.Spawnable = false[/lua] The model saving i'm not sure how to keep it unless you place directly inside of the gamemode's PlayerSpawn Hook which you would have to do yourself. Are you using this in sandbox?
  • Avatar of n0mi
  • [QUOTE=brandonj4;35770030]Change this to true if you want non-admins to spawn it: [lua]ENT.Spawnable = false[/lua] The model saving i'm not sure how to keep it unless you place directly inside of the gamemode's PlayerSpawn Hook which you would have to do yourself. Are you using this in sandbox?[/QUOTE] i mean that its a icon on entities of that you upload but when you press on it(spawn it ) it never spawns on the map
  • Avatar of n0mi
  • [QUOTE=brandonj4;35773935]I'm not sure. You can always spawn it with ent_create "name" in console.[/QUOTE] did you test this self on your gmod, if this worked for you upload it to mediafire. P.S are this for gmod 12?
  • Avatar of brandonj4
  • I did test it myself and it doesn't spawn from the spawn menu. I don't know how to fix it because I don't usually make addons for others. Sorry but I can't help you any further than that.
  • Avatar of n0mi
  • [QUOTE=brandonj4;35775099]I did test it myself and it doesn't spawn from the spawn menu. I don't know how to fix it because I don't usually make addons for others. Sorry but I can't help you any further than that.[/QUOTE] found this maybe you can just make this perment so it stay when you dies as the model you change to Shared.lua [code] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "model_alyx" ENT.Author = "darkrp" ENT.Spawnable = false ENT.AdminSpawnable = true [/code] cl_init.lua [code] include('shared.lua') function ENT:Initialize() end function ENT:Draw() if !LocalPlayer():Alive() then return end self.Entity:DrawModel() end function ENT:Think() end [/code] init.lua [code] AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include('shared.lua') function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "clothes_combine" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() self.Entity:SetModel( "models/props/de_tides/Vending_tshirt.mdl") self.Entity:PhysicsInit(SOLID_VPHYSICS) self.Entity:SetMoveType(MOVETYPE_VPHYSICS) self.Entity:SetSolid(SOLID_VPHYSICS) local phys = self.Entity:GetPhysicsObject() if(phys:IsValid()) then phys:Wake() end end function ENT:OnTakeDamage(dmg) self.Entity:EmitSound("/player/goprone.wav") self.Entity:Remove() end function ENT:Think() end function ENT:Use(ply) if ply:Team() == TEAM_CHIEF then return false end if ply:Team() == TEAM_POLICE then return false end if ply:Team() == TEAM_MAYOR then return false end if ply:Team() == TEAM_SWAT then return false end ply:SetModel("models/player/alyx.mdl") self.Entity:TakeDamage() end [/code]
  • Avatar of brandonj4
  • [lua] function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "classname" ) -- Edit the classname to the Sent folder name ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end [/lua] Just use this for the spawning for the SENT in the init.lua. You should have told me this was for DarkRP. Just wondering but is english your first language?
  • Avatar of n0mi
  • [QUOTE=brandonj4;35784771][lua] function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "classname" ) -- Edit the classname to the Sent folder name ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end [/lua] Just use this for the spawning for the SENT in the init.lua. You should have told me this was for DarkRP. Just wondering but is english your first language?[/QUOTE] no my first language are swedish
  • Avatar of brandonj4
  • Well try using that function I gave you tell me if it works. If not I will try this out later :) Here we GOOOOOOOOOOOOOO :D [lua] function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local ent = ents.Create( self.Classname ) ent:SetPos( tr.HitPos + tr.HitNormal * 16 ) ent:Spawn() ent:Activate() return ent end [/lua] Copy and paste that inside of the entities init.lua folder and you should be all set! Happy suit changing!