Ulysses
General => Developers Corner => Topic started by: Sophersky on August 17, 2014, 11:00:28 AM
-
I was wondering if there was a way to import a model from, say, TF2, into Gmod and use it in Pointshop. Is this possible?
-
Yes it is, you need to find an addon like this http://steamcommunity.com/sharedfiles/filedetails/?id=292523019&searchtext=tf2+player+model (http://steamcommunity.com/sharedfiles/filedetails/?id=292523019&searchtext=tf2+player+model) then you need this code.
ITEM.Name = 'You name here'
ITEM.Price = 250
ITEM.Model = 'models/player/Yourmodelnamehere.mdl'
function ITEM:CanPlayerEquip(ply)
return ply:Team() ~= TEAM_UNDEAD
end
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
timer.Simple(1, function() ply:SetModel(self.Model) end)
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end
function ITEM:PlayerSetModel(ply)
ply:SetModel(self.Model)
end
-
I mean is it possible to extract a model like tf2_misc_dir.vpk/models/lilchewchew/lilchewchew.mdl and allow pointshop to use it?
-
I don't know how TF2 handles their models, but it looks to be the same as HL2.
Go ahead and give it a shot.
-
I'm pretty sure that if you have Team Fortress 2 mounted on a Gmod server (http://wiki.garrysmod.com/page/Mounting_Content_on_a_DS), then you can use it as a normal "models/tf2_model_directory/modelname.mdl" in the pointshop, although I have no experience myself with a pointshop.
-
So something like models/lilchewchew/lilchewchew.mdl would work?
-
If it's mounted and the directory from the root dir (TF2/GMod) would be that, then yes, that should in theory work.
-
So the tf2 folder has to be located in the same file where the gmod vpks are?
Edit: This worked, thanks!