.:: Bots United ::.

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

dead bwoy 10-06-2004 12:30

Precaching
 
Is it at all possible to disallow a file from being precached?
czero precaches every custom model listed in the BotProfile.db
I'm hoping to remove BotProfile.db from the precaching and precache different player models for each map. I've tried messing around with the \reslists\Condition Zero\precache.lst and exclude.lst, de_dust_cz.lst, Condition Zero precache list.lst, preloads.lst, etc. Altering these files seems to make no difference in precaching.
I need to precache different models for different maps.
ie: Desert camo models for de_dust and arctic camo for fy_iceworld.
Any ideas? When exactly does precaching occur between map changes? Can a hook alter the precaching in the way I want?
Thanks for any help/ideas!

Pierre-Marie Baty 10-06-2004 18:28

Re: Precaching
 
Yes, a metamod plugin could do what you want. You would have to hook on pfnPrecacheModel() and check if it is precaching a player model, in which case make it precache the one you want. But then, don't forget to also prevent the player to try to use the model that has not been precached.

dead bwoy 10-06-2004 21:27

Re: Precaching
 
Would I need to add code only to this section?
Code:

int pfnPrecacheModel(char* s)
{
  return (*g_engfuncs.pfnPrecacheModel)(s);
}

How would I tie the precaching to specific maps?
Something like this from Splorygon's code from the cfg loading dll he made for me?
Code:

  char server_cmd[256];
  sprintf (server_cmd, "exec %s.cfg\n", STRING (gpGlobals->mapname));
  SERVER_COMMAND (server_cmd);

Or should I use Botman's Stripper2 source?
Code:

void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) {
  int index;
  nullname[0] = 0;
  // precache all the needed items...
  for (index = 0; index < num_precache_items; index++)
  {
          switch(precache_item_type[index])
          {
                case 0:  // model
                        if (dllapi_log->value)
                          LOG_MESSAGE(PLID, "PRECACHING MODEL %s", precache_item_name[index]);
                        PRECACHE_MODEL(precache_item_name[index]);
                        break;
                case 1:  // sound
                        if (dllapi_log->value)
                          LOG_MESSAGE(PLID, "PRECACHING SOUND %s", precache_item_name[index]);
                        PRECACHE_SOUND(precache_item_name[index]);
                        break;
                case 2:  // sprite
                        if (dllapi_log->value)
                          LOG_MESSAGE(PLID, "PRECACHING SPRITE %s", precache_item_name[index]);
                        PRECACHE_MODEL(precache_item_name[index]);
                        break;
          }
  }

If I put this in server activate, will this only work for the first map or every mapchange? Say I put all my desert camo models in czero\models\player\desert\*.* Can I precache every model in that folder? Maybe if I used a similar file structure to the PAF Hostitron (which changes hosti models on mapchange, wish it was open source...).
I know I'm a wankin' n00bified code editor (not a code stealer), but any help would be greatly appreciated!

dead bwoy 30-06-2004 02:11

Re: Precaching
 
***bump***

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

Re: Precaching
 
ServerActivate() is called after each map change and even at server start. It is called each time the server is about to accept connections again.

Use STRING (gpGlobals->mapname) to get the name of the map

then precache the models you want...


All times are GMT +2. The time now is 09:16.

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