![]() |
YaPB 1.0.0.0 modification problem
I tried to change the weapon prefs configuration from the standart cfg file to a executable cvar, so that the bot could have different weapon prefs for each map, using the amx mod x feature to execute map specific cvars.
First, I deleted in the botweapons.cfg everything after "# Weapon Priorities for a Normal Standard Bot" and in server.cfg I added the following lines with default weapon prefs for maps that dont have any specific prefs set Code:
yapb_norwepprefs "0,2,1,5,6,3,4,25,19,18,20,21,8,10,12,7,11,13,9,22,24,23,14,16,17,15" after the Code:
cvar_t g_cvarBotBuy = {"yapb_botbuy", "1"}; Code:
cvar_t g_cvarNWP = {"yapb_norwepprefs", "0,2,1,5,6,3,4,25,19,18,20,21,8,10,12,7,11,13,9,22,24,23,14,16,17,15"}; Code:
CVAR_REGISTER(&g_cvarBotBuy); Code:
CVAR_REGISTER(&g_cvarNWP); Code:
else Code:
pszStart = (char *)CVAR_GET_STRING(g_cvarNWP.name); So, if someone can help, please do :helpsmilie: |
Re: YaPB 1.0.0.0 modification problem
looks like the cvar is set AFTER the prefs are read into the arrays.
a better way may be changing the buy code to use the cvars instead of the arrays. |
Re: YaPB 1.0.0.0 modification problem
Ok, but, even if this is possible, I cant quite get it right.
In function "void CBaseBot::BuyStuff()" that is in bot_ai.cpp after the line Code:
int* ptrWeaponTab = ptrWeaponPrefs[m_ucPersonality] + NUM_WEAPONS; Code:
int i; |
Re: YaPB 1.0.0.0 modification problem
try adding "ptrWeaponTab = ptrWeaponPrefs[m_ucPersonality] + NUM_WEAPONS;" after the stuff you added, as your code changed the ptrWeaponTab pointer which will be used later.
|
Re: YaPB 1.0.0.0 modification problem
It doesnt work, I still get the runtime error when bots try to buy. Looks like I might have to scrap this idea and try to make it read the weapon prefs for the different maps from the botweapons.cfg file, but for that Ill need to find a function in the hlsdk that returns the current map name, and it also won't be nicer than the cvar idea.
|
All times are GMT +2. The time now is 09:02. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.