I have tried a lot of codefor example ne of my bot's variable is level.2nd_ranger with targetname "Ranger force"level.2nd_ranger has the instruction : level.2nd_ranger runto level.playerIf i use the code
if( level.2nd_ranger canmoveto level.player ) // level.player is variable for all the players, being : level.player = parm.other
{
// Axis players get targetname $g_man, Allied players get targetname $a_man
huddraw_virtualsize 203 1
huddraw_alpha 203 1
huddraw_font 203 "verdana-12"
huddraw_color 203 1.0 1.0 1.0
huddraw_rect 203 300 200 625 480
huddraw_string 203 ("MOVE TO PLAYER IS OK")
} else {
huddraw_virtualsize 203 1
huddraw_alpha 203 1
huddraw_font 203 "verdana-12"
huddraw_color 203 1.0 1.0 1.0
huddraw_rect 203 300 200 625 480
huddraw_string 203 ("NO MOVE")
}
I also tried instead of else which is the same :
if!( level.2nd_ranger canmoveto level.player ) {
huddraw_virtualsize 203 1
huddraw_alpha 203 1
huddraw_font 203 "verdana-12"
huddraw_color 203 1.0 1.0 1.0
huddraw_rect 203 300 200 625 480
huddraw_string 203 ("NO MOVE")
}
it always prints NO MOVE even when i'm in a place near botnodes, so that the bot can run to me.If i'm standing on a spot near enough to the botnodes, he runs to me,but when i go in noclip mode and stand on a roof or any place where I am too far from the bot nodes the bot stops running.
This is what i'm reading in the qconsole.log when this happens :
Code:
^~^~^ Path not found in 'Actor::MoveToPatrolCurrentNode' for (entnum 149, radnum -1, targetname 'Ranger force') from (1297.759766 -884.967957 0.125000) to (2771.064697 -405.039368 8.125002)
Reason: couldn't find end node
Found in attack.scr :
i experimented with this code a lot.Changing the values after local.movepos = to anything I could find or think of to no avail
local.movepos = ( level.2nd_ranger.forwardvector * local.checkdist ) + self.origin // local.checkdist holds the value self.dist_walkforward which has the value of 110
self.collideresult = 0
local.movetoresult = self canmoveto local.movepos
if( local.movetoresult == 1 ) {
huddraw_virtualsize 203 1
huddraw_alpha 203 1
huddraw_font 203 "verdana-12"
huddraw_color 203 1.0 1.0 1.0
huddraw_rect 203 300 200 625 480
huddraw_string 203 ("MOVE TO PLAYER IS OK")
} else {
huddraw_virtualsize 203 1
huddraw_alpha 203 1
huddraw_font 203 "verdana-12"
huddraw_color 203 1.0 1.0 1.0
huddraw_rect 203 300 200 625 480
huddraw_string 203 ("NO MOVE")
}
or
if( local.movetoresult != 1 ) {
huddraw_virtualsize 203 1
huddraw_alpha 203 1
huddraw_font 203 "verdana-12"
huddraw_color 203 1.0 1.0 1.0
huddraw_rect 203 300 200 625 480
huddraw_string 203 ("NO MOVE")
}
This always prints the same NO MOVE whether I have contact with the bot nodes or not.I tried everything I could think of,but canmoveto did not solve the problem.
It always prints NO MOVE whatever the situation.
This has a huge impact on the code.I wrote code so that the bots can pick up health packs when they need one.But when the healt packs fall in a place where they have no contact with the bot nodes,the bot cannot navigate to them.This also has impact on other code i wrote,If you save a bot from an enemy, you often get a thank you or I owe you one response.
Depending on the situation, one instruction takes precedence over another,but when bots cannot navigate to a health pack, some code will be executed too early or not at all.
This is also due to a bug in MOHAA where the default code behavior is not followed.In certain maps, the bots fall under the map.Since there are no paths or botnodes there, they stand still and no longer participate in the game.In that case it would be interesting to be able to check if a bot is still in contact with the botnodes or not,and if not, spawn the bot again somewhere on the botnode.If a Bot drops a health pack when killed,it would also be interesting to check if that health pack has contact with the bot nodes so that bots can navigate to it,and if they can't, set the health pack to NULL, so that it no longer exists.
EDIT BY PurpleElephant. Tried to clean up the code abit.