War3:Source

Development => Tutorials => Topic started by: kvip on June 01, 2014, 06:16:27 PM

Title: How set custom model for race
Post by: kvip on June 01, 2014, 06:16:27 PM
Hi all.
How set model for race w3s?
Title: Re: How set custom model for race
Post by: Ownz on June 01, 2014, 06:27:30 PM
war3source does not handle models directly, your race needs to manage that
Title: Re: How set custom model for race
Post by: Remy Lebeau on June 02, 2014, 05:30:28 PM
Firstly you need to get custom model files (s-low.net is a good source of them still).

Then you need to upload the model files to the appropriate server/s (depending on whether you run a HS d/l server - which I'd recommend if you're going to use custom models).

Then you need to modify the race you want to have the custom model using code something like the below (of course replacing the paths and filenames):

Code: [Select]
public OnMapStart()
{
    PrecacheModel("models/player/elis/gr/grimreaper.mdl");
    AddFileToDownloadsTable("materials/models/player/elis/gr/gr.vmt");
    AddFileToDownloadsTable("materials/models/player/elis/gr/gr.vtf");
    AddFileToDownloadsTable("materials/models/player/elis/gr/gr_head.vmt");
    AddFileToDownloadsTable("materials/models/player/elis/gr/gr_head.vtf");
    AddFileToDownloadsTable("materials/models/player/elis/gr/gr_head_NORMAL.vtf");
    AddFileToDownloadsTable("materials/models/player/elis/gr/gr_NORMAL.vtf");
    AddFileToDownloadsTable("models/player/elis/gr/grimreaper.dx80.vtx");
    AddFileToDownloadsTable("models/player/elis/gr/grimreaper.dx90.vtx");
    AddFileToDownloadsTable("models/player/elis/gr/grimreaper.mdl");
    AddFileToDownloadsTable("models/player/elis/gr/grimreaper.phy");
    AddFileToDownloadsTable("models/player/elis/gr/grimreaper.sw.vtx");
    AddFileToDownloadsTable("models/player/elis/gr/grimreaper.vvd");

}


public OnWar3EventSpawn( client )
{
    new race = War3_GetRace( client );
    if( race == thisRaceID && ValidPlayer( client, true ))
    {   
        SetEntityModel(client, "models/player/elis/gr/grimreaper.mdl");
        if (GetClientTeam(client) == TEAM_CT)
        {
            W3SetPlayerColor(client,thisRaceID,0,204,255,20,GLOW_SKILL);   
        }
        else
        {
            W3SetPlayerColor(client,thisRaceID,255,51,0,20,GLOW_SKILL);   
        }
    }
}


I'd generally recommend either having two different models for different teams (so people can tell what team you are), or setting the player to glow their team colour (which is what we do with the grimreaper model)