![]() |
HELP! Code snippet needed
Hi,
I've been working on the latest release of podbot_mm (r2b46d) and changed some of the things. This is not on a par with the official releases of course, but rather a personal flavour ;) I can post the s-code and files here if anyone wants it. Coming to my question: I want to add a code segment to the following section of bot.cpp in the BotThink function // Planting the Bomb right now case TASK_PLANTBOMB: pBot->iAimFlags |= AIM_DEST; //************************************************** *********** //------------------NEW CODE WILL GO HERE---------------------- //************************************************** *********** // We're still in the planting time and got the c4 ? if (pBot->b_bomb_blinking && (pEdict->v.weapons & (1 << CS_WEAPON_C4))) { if (pBot->current_weapon.iId == CS_WEAPON_C4) { bMoveToGoal = FALSE; pBot->bCheckTerrain = FALSE; pBot->f_wpt_timeset = gpGlobals->time; pEdict->v.button |= IN_ATTACK; pEdict->v.button |= IN_DUCK; pBot->f_move_speed = 0; pBot->f_sidemove_speed = 0; } else if (pBot->current_weapon.iId != CS_WEAPON_INSWITCH) { bMoveToGoal = FALSE; pBot->bCheckTerrain = FALSE; pBot->f_wpt_timeset = gpGlobals->time; pEdict->v.button |= IN_DUCK; pBot->f_move_speed = 0; pBot->f_sidemove_speed = 0; SelectWeaponByName (pBot, "weapon_c4"); } } What I plan to implement there is a code segment that checks whether the round time left is enough for the bomb to explode. I've actually managed to create that part: if ((g_fTimeRoundEnd - gpGlobals->time) <= (CVAR_GET_FLOAT("mp_c4timer") + 5.0)) { //Your code will be } So, let's say that C4 has an explosion time set for 45 seconds. Add another 5 seconds for the actual planting, and now we see that totally 50 seconds is needed if the bomb planted should ever be useful. The actual code snippet I ask for should - make the bot carrying the c4 think planting the bomb is futile - if the bot is a psycho, search for the nearest enemy and push a task on to stack to hunt him down I know I can spend hours and maybe days to get it right, but to just ask an expert of podbot seemed more rational to me :) Thanx for any help... |
Re: HELP! Code snippet needed
in CS 1.6 when you plant bomb the round time count down stops.
so he should only hurry up fi he has over 5 sec till round end. |
Re: HELP! Code snippet needed
Oops, forgot to mention this is for CS1.5 ... :)
|
Re: HELP! Code snippet needed
ah, that changes everything
|
All times are GMT +2. The time now is 14:49. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.