PDA

View Full Version : making bots use a force


NathanRahl
03-20-2003, 05:01 AM
I need to make the bots use certain forces under certain conditions. What I tried was

[code]
level.clients[bs->client].ps.fd.forcePowerSelected=MY_FORCE;
useTheForce=1;
[\code]

in the StandardBotAI() function. Well, it doesn't seem to work, the bot does not use the force I want him to... Anyone have an idea?

Azymn
03-20-2003, 04:16 PM
Did you put that before/inside/after the big if statement for bot force select?

NathanRahl
03-20-2003, 06:28 PM
I put a new if statement around the existing force-selection-if, so if my condition is met I choose the force - else the old code is used...

Azymn
03-20-2003, 07:01 PM
Perhaps if you posted the beginning of your statement, along with the beginning of the original statement as found in your current code thenwe could examine why it's not working.

NathanRahl
03-21-2003, 03:36 AM
Basically it looks liek this:


...
if (MyCondition)
{
level.clients[bs->client].ps.fd.forcePowerSelected=MyForce;
useTheForce=1;
if (ChosenForceIsHostile)
{
forceHostile=1;
}
}
else
{
[Standard if-else clauses]
}

if (useTheForce && forceHostile)
{
...
}


This all seem logical to me - the only thing I can imagine is that the condition for using a force are not good enough and the bot simply cannot use MyForce... Or what else could be it?

Azymn
03-21-2003, 08:32 AM
Are you setting MyForce before it sets their forcePowerSelected?

NathanRahl
03-25-2003, 08:48 AM
Yes, MyForce is set... I even checked the variables (useTheForce, forcePowerSelected) at the end of the function - they are correct. The bot just doesn't seem to use it...

Azymn
03-25-2003, 02:11 PM
Well, i don't know if this helps, but i modified the same bit of code and the bots did use different force powers.
Now, they certainly didn't use them with the sort of frequency i'd hoped, but they used them...

One problem could be if you're telling bots to use powers they don't have - that won't work in this function.