.:: 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
Re: [CZ] Changing model directory "on the fly"?
Old
  (#31)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: [CZ] Changing model directory "on the fly"? - 10-07-2005

yea sound changing is still possible
8.3.5.155:27015 -highly modded server..

this server dumps all of it's own server's sounds into a folder in the sound folder.

Last edited by sPlOrYgOn; 10-07-2005 at 04:28..
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#32)
Rusty Le Cyborg
Complete Amateur
 
Rusty Le Cyborg's Avatar
 
Status: Offline
Posts: 52
Join Date: May 2005
Default Re: [CZ] Changing model directory "on the fly"? - 10-07-2005

Well I guess whatever works will be good

I'm quite looking forward to this!

<edit>

That server only seems to have custom sounds for "say" commands and "round win", which are usually just different "Terrorist Win" wav files.

It also has skin selection, but this isn't automatic.

http://www.radclan.net/index.php?page=Plugins

Last edited by Rusty Le Cyborg; 10-07-2005 at 11:31..
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#33)
Rusty Le Cyborg
Complete Amateur
 
Rusty Le Cyborg's Avatar
 
Status: Offline
Posts: 52
Join Date: May 2005
Default Re: [CZ] Changing model directory "on the fly"? - 10-07-2005

Quote:
Originally Posted by Lazy
I don't think its possible for sounds since hl will only play whats inside the sound directory and its subdirectories.
So would you still be able to have it as -

MOD ROOT / sound / %s / hostage /

or

MOD ROOT / models / %s / player /

or

MOD ROOT / models / %s /

etc....

PS - If you need any testing doing, just hit me up
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#34)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: [CZ] Changing model directory "on the fly"? - 10-07-2005

I have finished the normal model changing and the sound should be done today.
The player models will require me to research it first since I have never changed them in a server-side plugin.
Also, new player models have to be precached manually so players download them and won't be invisible due to the missing model.

But the playermodel changing shouldn't be too hard, it does seem odd though.
If I change the client's model keyvalue to "models/rock2/player/demo/demo.mdl" the model dissappears.
I know it's been done so it shouldn't be too hard to get it working.
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#35)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: [CZ] Changing model directory "on the fly"? - 12-07-2005

Can anyone confirm that you can change a player's model in cs/cz by changing the "model" keyvalue on the client?
It doesn't work that way in tfc and I'm still downloading CS from steam so I can't test it for myself.

I hope this works out for player models, if it doesn't then I apologize for suggesting it could be done.
Though the gameplay models and sounds will have no problems at all being switched.
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#36)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: [CZ] Changing model directory "on the fly"? - 12-07-2005

yes it seems possible.
as here is some code from VexdUM module for amx
VexdUM.cpp:
Code:
static cell AMX_NATIVE_CALL CS_SetModel(AMX *amx, cell *params) {
  int iIndex = params[1];

  if (check_player(iIndex)) {
    AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
	return 0;
  }

  int iLength;
  char *szModel = GET_AMXSTRING(amx, params[2], 0, iLength);
  edict_t *pPlayer = INDEXENT(iIndex);
  strcpy(PlInfo[iIndex].szModel, szModel);
  PlInfo[iIndex].bModeled = true;
  SET_CLIENT_KEYVALUE(iIndex, GET_INFO_KEYBUFFER(pPlayer), "model", PlInfo[iIndex].szModel);

  return 1;
}
meta_api.cpp:
Code:
// pfnPlayerPostThink, this code is to set the model at a specified time.
// The second part of the code activates the plugin forward functionality.
void PlayerPostThink(edict_t *pEntity) {
  int index = ENTINDEX(pEntity);

  if((PlInfo[index].bModeled) && (PlInfo[index].fModelSet != 0) && (PlInfo[index].fModelSet < gpGlobals->time)) {
    SET_CLIENT_KEYVALUE(index, GET_INFO_KEYBUFFER(pEntity), "model", PlInfo[index].szModel);
  }

  cell iRetVal = 0;

  for(AmxCallList::AmxCall* i = vPostThinkCallList.head; i ; i = i->next ) {
    if(IS_PLUGIN_RUNNING(i->amx)) {
	  AMX_EXEC(i->amx, &iRetVal, i->iFunctionIdx, 1, index);
	  if(iRetVal & (1 || 2)) {
		  RETURN_META(MRES_SUPERCEDE);
	  }
	}
  }
  RETURN_META(MRES_IGNORED);
}
Code:
// Engine message functions.
void MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) {

  static int gmsgResetHUD = GET_USER_MSG_ID(PLID, "ResetHUD", NULL);

  // Reset player model a couple milliseconds after this if they are using an edited model.
  if(msg_type == gmsgResetHUD ) {

    int index = ENTINDEX(ed);

    if(PlInfo[index].bModeled) {
      PlInfo[index].fModelSet = gpGlobals->time + AMS_OFFSET;
    }
  }

  // ...

  RETURN_META(MRES_IGNORED);
}

Last edited by sPlOrYgOn; 12-07-2005 at 07:09..
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#37)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: [CZ] Changing model directory "on the fly"? - 12-07-2005

Thanks alot, I'll get around to finishing this once I get a test server set up.

[Update]
I have it partially working, though it will only load models if it has its own directory under models/player.
What this means is that models/player/cs_assault/blah will not work, what will work is if you make the "blah" directory in your models/player folder.

I have tried to get it to work the other way but it _really_ screws up the path, something like "models/player/cs_assault/onos/onos.mdl/cs_as".
I'm guessing config files will be needed for each map but for player models only, it will also setup precaching so that all clients have the new models.

Last edited by Lazy; 12-07-2005 at 09:04..
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#38)
Rusty Le Cyborg
Complete Amateur
 
Rusty Le Cyborg's Avatar
 
Status: Offline
Posts: 52
Join Date: May 2005
Default Re: [CZ] Changing model directory "on the fly"? - 12-07-2005

So, if I understand this properly -

If CS/CZ wants to load the leet.mdl for instance, it will now try to load -

mod root/models/player/mapname/leet/leet.mdl ?

If that's correct, what will the path be to the other models and the sounds directory?

Would it even be easier to just have a config frile for each map so you don't need to make global changes? If there is no config, then standard models apply etc...
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#39)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: [CZ] Changing model directory "on the fly"? - 12-07-2005

The way CS works is the "model" value on the client specifies a directory and model name in the "models/player" folder.
Unfortunately this means that you cannot just create a "mapname" subdirectory and redirect model paths to use it since the path gets messed up somehow.

So if you want to change a model you need to do this:
NOTE: This is only for player models! Normal ones are automatic!

- Create the "modchange_cfgs" directory in the mod root ( ie. "cstrike" )
- For each map you want to switch the models on create a new file called "mapname".txt
- Make a new directory in your models/player folder with a name you can remember ( ie. "cs_assault_onos" )
- Copy your replacement model into that folder and rename it to the folder name

The format of the config file is very simple, all it is is this - original_model=new_model.
Example:
Code:
 
leet=onos
gsg9=onos
That will change both the leet and gsg9 models from cs into the alien onos from NS.
All the replacement models in the config will be precached to make sure they download to all the clients.

Still working on it now, will have a screenshot soon.
  
Reply With Quote
Re: [CZ] Changing model directory "on the fly"?
Old
  (#40)
Rusty Le Cyborg
Complete Amateur
 
Rusty Le Cyborg's Avatar
 
Status: Offline
Posts: 52
Join Date: May 2005
Default Re: [CZ] Changing model directory "on the fly"? - 12-07-2005

Okay, so that is a bit clearer

Just to recap (in CZ terms!)

I will have a folder in my czero directory named "modchange_cfgs" or something a little easier to remember

In that folder I will have various .txt files named after each map I want to alter.

In, for example, de_piranesi_cz.txt I will need to type something like -

sas=ct
gign=ct
gsg9=ct
urban=ct
spetsnaz=ct
leet=t
terror=t
guerilla=t
militia=t
arctic=t

Then in my models/player directory I need two directories called -

models/player/de_piranesi_cz_ct and
models/player/de_piranesi_cz_t

with models in them called -

de_piranesi_cz_ct.mdl and
de_piranesi_cz_t.mdl

PHEW!!

(I've made a CZ map an example as they have the most confusing mapnames yet! If I can understand that, then I am set!)

....or am I a bit tired from being in the sun too long? 8D

<edit>

Oh yes, and will the other models and sounds take the same structure?

Last edited by Rusty Le Cyborg; 12-07-2005 at 21:02..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 3 (0 members and 3 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