.:: 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 ::. > Cyborg Factory > POD-Bot mm > Releases, Installers, Docs & Coding
Releases, Installers, Docs & Coding Where the official development happens

Closed Thread
 
Thread Tools
HELP! Code snippet needed
Old
  (#1)
VenoM UT
Member
 
VenoM UT's Avatar
 
Status: Offline
Posts: 7
Join Date: Aug 2006
Question HELP! Code snippet needed - 17-08-2006

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
Old
  (#2)
[NvT]_KaszpiR_
Member
 
[NvT]_KaszpiR_'s Avatar
 
Status: Offline
Posts: 322
Join Date: Apr 2004
Default Re: HELP! Code snippet needed - 17-08-2006

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
Old
  (#3)
VenoM UT
Member
 
VenoM UT's Avatar
 
Status: Offline
Posts: 7
Join Date: Aug 2006
Default Re: HELP! Code snippet needed - 17-08-2006

Oops, forgot to mention this is for CS1.5 ...
  
Re: HELP! Code snippet needed
Old
  (#4)
[NvT]_KaszpiR_
Member
 
[NvT]_KaszpiR_'s Avatar
 
Status: Offline
Posts: 322
Join Date: Apr 2004
Default Re: HELP! Code snippet needed - 18-08-2006

ah, that changes everything
  
Closed Thread


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