.:: 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 > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Bot Creation Help (AMXx)
Old
  (#1)
twistedeuphoria
Member
 
Status: Offline
Posts: 2
Join Date: Aug 2005
Default Bot Creation Help (AMXx) - 31-08-2005

Hello, I've been trying for a few days to create fakeclients/bots through AMX Mod X for CS. I've attempted to use the creation code for RealBot (adapted to AMXx, of course) but have only succeeded in getting the bot to join the server (not join a team, etc). Also, for some reason "bot<id><BOT><> entered the game" is not called until the next round after I have used the command to create the bot. Here is what I have so far (with the corresponding lines from RB above each line). I have been assured that each command is correct (and yes the general syntax is correct), both by BAILOPAN and a small amount of testing of my own. I'm hoping I missed something essential, because otherwise I'm stuck.

Code:
		//BotEnt = (*g_engfuncs.pfnCreateFakeClient) (c_name);
		new bot = engfunc(EngFunc_CreateFakeClient,name)
	
		//BotEnt->v.frags = 0;
		entity_set_float(bot,EV_FL_frags,0.0)

		// CALL_GAME_ENTITY (PLID, "player", VARS (BotEnt));
		dllfunc(MetaFunc_CallGameEntity,"player",bot)
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "model", "gina");
		engfunc(EngFunc_SetClientKeyValue,bot,"model","gina")
		
	    //(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "rate",  "3500.000000");
		engfunc(EngFunc_SetClientKeyValue,bot,"rate","3500.000000")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "cl_updaterate", "20");
		engfunc(EngFunc_SetClientKeyValue,bot,"cl_updaterate","20")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "cl_lw",  "1");
		engfunc(EngFunc_SetClientKeyValue,bot,"cl_lw","1")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "cl_lc",  "1");
		engfunc(EngFunc_SetClientKeyValue,bot,"cl_lc","1")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "tracker",  "0");
		engfunc(EngFunc_SetClientKeyValue,bot,"tracker","0")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "cl_dlmax", "128");
		engfunc(EngFunc_SetClientKeyValue,bot,"cl_dlmax","128")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "lefthand", "1");
		engfunc(EngFunc_SetClientKeyValue,bot,"lefthand","1")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "friends", "0");
		engfunc(EngFunc_SetClientKeyValue,bot,"friends","0")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "dm", "0");
		engfunc(EngFunc_SetClientKeyValue,bot,"dm","0")
		
		//(*g_engfuncs.pfnSetClientKeyValue) (clientIndex, infobuffer, "ah", "1");
		engfunc(EngFunc_SetClientKeyValue,bot,"_ah","0")
		
		//From the PB MM fix for the new Steam update
		engfunc(EngFunc_SetClientKeyValue,bot,"_vgui_menus","0")
		
		//MDLL_ClientConnect (BotEnt, c_name, "127.0.0.1", ptr);
		new error[129]
		dllfunc(DLLFunc_ClientConnect,bot,name,"127.0.0.1",error,128)
		
		//MDLL_ClientPutInServer (BotEnt);
		dllfunc(DLLFunc_ClientPutInServer,bot)
		
		//BotEnt->v.flags |= FL_THIRDPARTYBOT;
		new flags = entity_get_int(bot,EV_INT_flags)
		flags |= FL_FAKECLIENT
		entity_set_int(bot,EV_INT_flags,flags)		
		
		// pBot->iTeam = atoi (arg1);
		entity_set_int(bot,EV_INT_team,1)
Yes, I know it doesn't have the menu catch and execute command set, however, I did hook it with another function and no menu was ever called for the bot.

Thanks in advance!
  
Reply With Quote
Re: Bot Creation Help (AMXx)
Old
  (#2)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Bot Creation Help (AMXx) - 31-08-2005

Is there more to your code then that?
Because bots need pfnRunPlayerMove to work correctly even if not doing anything.
Well, that was my experience when getting a bot to join a team in NS.

Someone here could probably tell you for sure, but just beware that running a bot in a VM like the amx engine will be alot slower than writing it in a language that produces native code.
  
Reply With Quote
Re: Bot Creation Help (AMXx)
Old
  (#3)
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: Bot Creation Help (AMXx) - 31-08-2005

Yes, you need an update function like RunPlayerMove to validate all of the bot's actions each frame. Including connecting.



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
Re: Bot Creation Help (AMXx)
Old
  (#4)
twistedeuphoria
Member
 
Status: Offline
Posts: 2
Join Date: Aug 2005
Default Re: Bot Creation Help (AMXx) - 01-09-2005

Thanks! I'll try that and get back to you.
  
Reply With Quote
Reply


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

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