Give certain players custom models?

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
MapTheGame
CJ Wannabe
CJ Wannabe
Posts: 10
Joined: October 10th, 2012, 8:39 pm

Give certain players custom models?

Post by MapTheGame » October 11th, 2012, 12:17 am

I want to make it in my map, so that if this certain person joins their character is a custom model I have imported for my map. is this possible?

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Give certain players custom models?

Post by F |Madness| U » October 11th, 2012, 3:16 pm

Yes it is possible, if you just run a check on each player when they connect or spawn to see if they have a matching xuid, you can change their model with

Code: Select all

player setModel("model_name");
I think.
-

MapTheGame
CJ Wannabe
CJ Wannabe
Posts: 10
Joined: October 10th, 2012, 8:39 pm

Re: Give certain players custom models?

Post by MapTheGame » October 17th, 2012, 8:29 pm

F |Madness| U wrote:Yes it is possible, if you just run a check on each player when they connect or spawn to see if they have a matching xuid, you can change their model with

Code: Select all

player setModel("model_name");
I think.
Sorry, where would I add the GUID and the code? (I'm a beginner scripter)

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Give certain players custom models?

Post by F |Madness| U » October 19th, 2012, 4:58 pm

You would add code similar to this, in the maps.gsc file.

Code: Select all

init()
{
        level thread onPlayerConnect();
}
 
onPlayerConnect()
{
        for(;;)
        {
                level waittill( "connected", player );
                player thread xuid_check();
                player thread onPlayerSpawned();
        }
}
 
xuid_check()
{
        if(self getxuid() == "xuid here" || self getxuid() == "another xuid here")//<-- different people having same model
        {
                self.custommodel = "custom model 1 here";
        }
        else if(self getxuid() == "player requiring different model xuid")
        {
                self.custommodel = "custom model 2";
        }
        else
}
 
onPlayerSpawned()
{
        self endon("disconnect");
 
        for(;;)
        {
                self waittill("spawned_player");
                self setModel(self.custommodel);
        }
}
I am not entirely sure if self setModel() works instantly, or if it has to be done before they spawn (or spawn and then die).
-

MapTheGame
CJ Wannabe
CJ Wannabe
Posts: 10
Joined: October 10th, 2012, 8:39 pm

Re: Give certain players custom models?

Post by MapTheGame » October 19th, 2012, 10:23 pm

F |Madness| U wrote:You would add code similar to this, in the maps.gsc file.

Code: Select all

init()
{
        level thread onPlayerConnect();
}
 
onPlayerConnect()
{
        for(;;)
        {
                level waittill( "connected", player );
                player thread xuid_check();
                player thread onPlayerSpawned();
        }
}
 
xuid_check()
{
        if(self getxuid() == "xuid here" || self getxuid() == "another xuid here")//<-- different people having same model
        {
                self.custommodel = "custom model 1 here";
        }
        else if(self getxuid() == "player requiring different model xuid")
        {
                self.custommodel = "custom model 2";
        }
        else
}
 
onPlayerSpawned()
{
        self endon("disconnect");
 
        for(;;)
        {
                self waittill("spawned_player");
                self setModel(self.custommodel);
        }
}
I am not entirely sure if self setModel() works instantly, or if it has to be done before they spawn (or spawn and then die).

Can you add me on xfire? I may need a little more help my xfire is, dynamicivjoel

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Give certain players custom models?

Post by F |Madness| U » October 20th, 2012, 12:34 am

Apparently I'm already friends with you- I will be happy to help when I'm available, but atm I tend to be pretty busy with university work.
-

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests