Author Topic: Making a bot run away *solved untill further notice*  (Read 1186 times)

I want to make bots run away from a specific player, Ive tried a few things but it just ends up in awkward zigzag running patterns among other things, so I need a bit of help. Any ideas?



Thanks for any help in advance.

NVM, found a way(incase someone has this problem or if I'm "doing it wrong!!!1!"):
Code: [Select]
%curx=getword(%bot.getposition(),0);
%cury=getword(%bot.getposition(),1);
%newx=0;
%newy=0;
%alx=getword(%bot.run.getposition(),0);
%aly=getword(%bot.run.getposition(),1);
%newx+=(%curx-%alx)*3;
%newy+=(%cury-%aly)*3;
%loc = vectorAdd(%bot.getTransform(),%newx SPC %newy SPC 0);
Then move to %loc.
« Last Edit: March 05, 2008, 06:48:56 PM by rkynick »

Looks awful. A bot needs to randomly decide which direction it will run from the player, otherwise the player can very easily force it to trap itself in a corner.

I think this is more than you can handle.

Trader you dont even know what I'm making beyond the fact that it has bots and includes running away.
And I'll add that Ephi, thanks.

looks great but sorry i can't help.

Oh honestly, why would you even do that. Why post in a dead topic to say you can't help out? Thats ridiculous.

Untested:

Code: [Select]
function AIPlayer::runAwayFrom(%bot, %obj) {
   %pos = %obj.getPosition();
   %offset = %pi = 3.1415926;
   %offset += getRandom(%pi/-2, %pi/2);
   %bot.setAimLocation(%pos);

   %trans = %bot.getTransform();
   %bot_rotation = getWord(%trans, 6);
   %bot_position = getWords(%trans, 0, 2);
   %bot.setTransform(%bot_position SPC "0 0 1" SPC (%bot_rotation + %offset));
}

It doesn't make them start walking though.
If you wanted you could use setMoveDestination() on a position in front of them to make them start walking, then for the onReachDestination(), make them run away again which will form a loop.
« Last Edit: March 15, 2008, 11:30:42 AM by exidyne »