.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 1 SDK (http://forums.bots-united.com/forumdisplay.php?f=33)
-   -   SET_MODEL() thingy... (http://forums.bots-united.com/showthread.php?t=2145)

Akz 29-06-2004 21:39

SET_MODEL() thingy...
 
Well... I have been making a little mod for some time to waste my time and to get some modding skills, and now I have ran into a problem:
In my mod, I'm using a some sort of a class system. Every class has a different model. In CBasePlayer::Spawn() I'm setting the model like this:
Code:

        switch (player_class)
        {
                case CLASS_BADGUY1:
                        SET_MODEL(ENT(pev), "models/player/badguy1/badguy1.mdl");
                        g_ulModelIndexPlayer = pev->modelindex;
                        pev->sequence = LookupActivity( ACT_IDLE );
                        break;
 
                case CLASS_BADGUY2:
                        SET_MODEL(ENT(pev), "models/player/badguy2/badguy2.mdl");
                        g_ulModelIndexPlayer = pev->modelindex;
                        pev->sequence = LookupActivity( ACT_IDLE );
                        break;
        }

It works, but when I try to choose the team and class again (i.e. after restarting the map), it changes the team and class, but the model doesn't change. What's the problem?

Akz 30-06-2004 08:23

Re: SET_MODEL() thingy...
 
Ok, It works now. There's no need to use SET_MODEL for every model.
Code:

        switch (player_class)
        {
                case CLASS_BADGUY1:
                    g_engfuncs.pfnSetClientKeyValue( entindex(), g_engfuncs.pfnGetInfoKeyBuffer( edict() ), "model", "badguy1");
                        break;
 
                case CLASS_BADGUY2:
                    g_engfuncs.pfnSetClientKeyValue( entindex(), g_engfuncs.pfnGetInfoKeyBuffer( edict() ), "model", "badguy2");
                        break;
        }
 
        SET_MODEL( ENT(pev), "models/player.mdl");
        g_ulModelIndexPlayer = pev->modelindex;
        pev->sequence = LookupActivity( ACT_IDLE );


stefanhendriks 30-06-2004 08:55

Re: SET_MODEL() thingy...
 
actually i wonder what you're doing. Although i am not a sdk guru, i find this sound weird:

Code:

g_engfuncs.pfnSetClientKeyValue( entindex(), g_engfuncs.pfnGetInfoKeyBuffer( edict() ), "model", "badguy2");
followed by:

Code:

SET_MODEL( ENT(pev), "models/player.mdl");
Ie, it looks like you first set it via an engine message, using the 'correct' model (badguy2). Then you call SET_MODEL , and that uses 'player.mdl'.

You said it works, but i wonder what SET_MODEL does then? :)

Just askin 8)

Akz 30-06-2004 09:18

Re: SET_MODEL() thingy...
 
Quote:

Originally Posted by stefanhendriks
Ie, it looks like you first set it via an engine message, using the 'correct' model (badguy2). Then you call SET_MODEL , and that uses 'player.mdl'.

You said it works, but i wonder what SET_MODEL does then? :)

Just askin 8)

I don't actually know :). It doesn't work if you don't have that line... Half-Life MP is doing it that way too. You can set your model with the "model" command, but in Spawn(), it's always:
SET_MODEL( ENT(pev), "models/player.mdl");

Pierre-Marie Baty 30-06-2004 12:17

Re: SET_MODEL() thingy...
 
it's normal, Akz does it the right way.

Try pmtools on the players in Counter-Strike, you'll see that ALL players, no matter what team/class they are, have "models/player.mdl" in pEdict->v.model

The skin is given into the client's infobuffer (which is something different)

That's normal, because the server doesn't *need* to know what skin the players have. For the server, all players play with the models/player.mdl model. This way, it's much faster, and the bounding boxes are the same anyway. The infobuffer is just a client thingy, so that the client is able to display each player with the right skin... but from the server's point of view, this is just cosmetics. The game could as well run with only gordon freeman's shooting at each other, it wouldn't give a shit :P

You need to feel BOTH the client's infobuffer AND the player edict's model field. The first one is for all the clients, the last one is for the server only.


All times are GMT +2. The time now is 13:19.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.