IPB

Welcome Guest ( Log In | Register )

> no Gravity Gun for bot ?, lost code ?
Salvax
post Feb 23 2007, 04:35 AM
Post #1


Advanced Member
***

Group: Members
Posts: 75
Joined: 14-February 07
Member No.: 1,034



bot can't hold a gravity gun even the bot profile is edited : weapon = weapon_physcannon

lost weapon code in some files of the source? blink.gif

i am doing some thing on checkstuck part of the codes in bot.cpp, trying if bot can use gravity gun to push the objects away, but i find bot can't even hold a gravity gun...*faint*
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
Salvax
post Feb 24 2007, 02:03 PM
Post #2


Advanced Member
***

Group: Members
Posts: 75
Joined: 14-February 07
Member No.: 1,034



"phys_swap" is for switching back to a weapon the bot was holding, and SetActiveWeapon won't switch back, but only give bot a static gun.

this is the sample code for bot to push and pull objects, plz check. seems m_pController->SetActiveWeapon can't be used here directly ?

- bot.cpp -

QUOTE
void CBot :: checkStuck ()
{
static float fTime;

fTime = engine->Time();

if ( m_fLastWaypointVisible == 0 )
{
m_bFailNextMove = false;

if ( !hasSomeConditions(CONDITION_SEE_WAYPOINT) )
m_fLastWaypointVisible = fTime;
}
else
{
if ( hasSomeConditions(CONDITION_SEE_WAYPOINT) )
m_fLastWaypointVisible = 0;
else
{
if ( (m_fLastWaypointVisible + 2.0) < fTime )
{
m_fLastWaypointVisible = 0;
m_bFailNextMove = true;
}
}
}

if ( m_fCheckStuckTime > fTime )
return;

float fVelocity = m_vVelocity.Length2D();
float fIdealSpeed = m_fIdealMoveSpeed;

if ( m_pButtons->holdingButton(IN_DUCK) )
fIdealSpeed /= 2;
if ( fIdealSpeed == 0 )
return; // not stuck
float fPercentMoved = fVelocity/fIdealSpeed;

if ( fPercentMoved < 0.1 )
{
m_pButtons->jump();
m_pButtons->duck(0.25f,0.25f);
m_pController->SetActiveWeapon("weapon_physcannon"); // switch to Gravity Gun by salvax , but how to make this work ? encountered error !!!
m_pButtons->attack() //bot use gravity gun to push by salvax
m_pButtons->attack2() //bot use gravity gun to pull by salvax

m_fCheckStuckTime = fTime + 4.0f;
m_pController->SetActiveWeapon(m_pProfile->getWeapon()); //switch back to the weapon in bot profile by salvax, still have error here!!
}

.
.
.
.



PS : how to let a bot holding a gravity gun switch to the gun he just picked up ? This problem really hurts my head sad.gif
PS2: how to let bot have specified weapon in bot profile and also the bot can pick up weapons ? This is very important, without this function , i can't continue. THX A LOT !
PS3:
i add [void CHLDMBot :: modThink2 ()] into bot_hldm_bot.cpp for switching to gravity gun as i said above in the codes and add [modThink2 ();] into bot_hldm_bot.h under [class CHLDMBot : public CBot]

if i wanna use modThink2(), what should i type? neither CHLDMBot->modThink2(); or m_pBot->modThink2(); works. sad.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st August 2025 - 11:46 PM