.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Bot Creation Help (AMXx) (http://forums.bots-united.com/showthread.php?t=4414)

twistedeuphoria 31-08-2005 01:26

Bot Creation Help (AMXx)
 
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!

Lazy 31-08-2005 03:27

Re: Bot Creation Help (AMXx)
 
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.

Pierre-Marie Baty 31-08-2005 13:37

Re: Bot Creation Help (AMXx)
 
Yes, you need an update function like RunPlayerMove to validate all of the bot's actions each frame. Including connecting.

twistedeuphoria 01-09-2005 04:49

Re: Bot Creation Help (AMXx)
 
Thanks! I'll try that and get back to you.


All times are GMT +2. The time now is 18:07.

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