Ulysses

General => Developers Corner => Topic started by: Sophersky on August 17, 2014, 11:00:28 AM

Title: Adding models from different games?
Post 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?
Title: Re: Adding models from different games?
Post by: UnderYouFive on August 17, 2014, 11:40:42 AM
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.
Code: [Select]
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
Title: Re: Adding models from different games?
Post by: Sophersky on August 17, 2014, 11:55:33 AM
I mean is it possible to extract a model like tf2_misc_dir.vpk/models/lilchewchew/lilchewchew.mdl and allow pointshop to use it?
Title: Re: Adding models from different games?
Post by: Neku on August 17, 2014, 12:05:35 PM
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.
Title: Re: Adding models from different games?
Post by: Decicus on August 17, 2014, 12:08:31 PM
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.
Title: Re: Adding models from different games?
Post by: Sophersky on August 17, 2014, 12:13:49 PM
So something like models/lilchewchew/lilchewchew.mdl would work?
Title: Re: Adding models from different games?
Post by: Decicus on August 17, 2014, 12:19:18 PM
If it's mounted and the directory from the root dir (TF2/GMod) would be that, then yes, that should in theory work.
Title: Re: Adding models from different games?
Post by: Sophersky on August 17, 2014, 01:03:06 PM
So the tf2 folder has to be located in the same file where the gmod vpks are?

Edit: This worked, thanks!