.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
SET_MODEL() thingy...
Old
  (#1)
Akz
Creator of GrogBot
 
Akz's Avatar
 
Status: Offline
Posts: 91
Join Date: Jan 2004
Default SET_MODEL() thingy... - 29-06-2004

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?


GrogBot - A bot for Pirates, Vikings and Knights HL modification.

http://grogbot.bots-united.com
  
Reply With Quote
Re: SET_MODEL() thingy...
Old
  (#2)
Akz
Creator of GrogBot
 
Akz's Avatar
 
Status: Offline
Posts: 91
Join Date: Jan 2004
Default Re: SET_MODEL() thingy... - 30-06-2004

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 );


GrogBot - A bot for Pirates, Vikings and Knights HL modification.

http://grogbot.bots-united.com
  
Reply With Quote
Re: SET_MODEL() thingy...
Old
  (#3)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: SET_MODEL() thingy... - 30-06-2004

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


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: SET_MODEL() thingy...
Old
  (#4)
Akz
Creator of GrogBot
 
Akz's Avatar
 
Status: Offline
Posts: 91
Join Date: Jan 2004
Default Re: SET_MODEL() thingy... - 30-06-2004

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
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");


GrogBot - A bot for Pirates, Vikings and Knights HL modification.

http://grogbot.bots-united.com

Last edited by Akz; 30-06-2004 at 09:21..
  
Reply With Quote
Re: SET_MODEL() thingy...
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: SET_MODEL() thingy... - 30-06-2004

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

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.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com