my bot wont do what i tell it to

This is the development community to discuss tribes mod coding or to ask questions.

Moderator: Moderators

1 Tue Dec 18, 2012 3:13 pm

ok so im making bots that are supposed to move toward the player and make contact, the only problem is, i cant get the bot to stop running when i try and get close to it. the bot is supposed to target me and then run up on my player but he is scared for some reason.


question #1: how do i clear ALL of the AI's directives?

question #2: how do i get the bot to stop running away from me? it keeps a distance at all times even when following me -_-


here are the bot's directives and other stuff:

Code: Select all
   %group = nameToID("MissionCleanup");
         createAI(%aiName, %group, RandomItems(2,larmor,lfemale), %aiName);
         %aiId = AI::getId(%aiName);
   %aiPl = Client::getOwnedObject(%aiId);

         GameBase::setTeam(%aiId,1);
   GameBase::setPosition(%aiPl,%pos);
   GameBase::startFadeIn(%aiPl);
   GameBase::setAutoRepairRate(%aiPl,-0.05); // eventually they die off, eating heals

   AI::DirectiveRemove(%aiName); //dont trip about this i know its wrong
      AI::SetVar(%aiName, triggerPct, 0.03 );
      AI::setVar(%aiName, iq, 100 );
         AI::setVar(%aiName, pathType, 1);
         AI::setVar(%aiName, attackMode, -1);
         AI::setVar(%aiName, spotDist, 100);
   AI::SetAutomaticTargets(%aiName);
bawb
Commander
Commander
 
Posts: 1203

2 Wed Dec 19, 2012 5:55 am

the bot attacks you (because he has automatic targets set), and the default attack mode is
to keep a constant distance from you while firing at you, just like in base training.
Changing the attacktype should fix it.

Actually I am surprised why -1 didn't fix it (make him just stand there). Maybe the variable name is incorrect..
User avatar
C--
Sorry....
 
Posts: 3299

3 Wed Dec 19, 2012 11:41 am

i think you are right about the attackmode, but i also think that the bot is spawning with a few directives that i dont want it to automatically when i actually do have the right mode set.



i guess ill just find a way to remove the directives and go from there... i used AI::DirectivesList on my bot and it came back with like 5 waypoints and another couple directives (without me even setting any...)
bawb
Commander
Commander
 
Posts: 1203

4 Wed Dec 19, 2012 11:46 am

i wish they had made more functions for the AI -_-


why couldnt they have made a clearDirectives or something lol

Code: Select all
//AI::ActionResult();
//AI::Attack();  *** Doesn't work
//AI::CallbackDied();
//AI::CallbackPeriodic();
//AI::CallWithId();
//AI::Delete();
//AI::DirectiveCallback1();
//AI::DirectiveCallback2();
//AI::DirectiveCallback3();
//AI::DirectiveCallback4();
//AI::DirectiveFollow();
//AI::DirectiveList();
//AI::DirectiveRemove();
//AI::DirectiveTarget();
//AI::DirectiveTargetLaser();
//AI::DirectiveTargetPoint();
//AI::DirectiveWaypoint();
//AI::GetCount();
//AI::GetId();
//AI::GetObject();
//AI::GetTarget();
//AI::List();
//AI::SetAutomaticTargets();
//AI::SetScriptedTargets();   *** Doesn't work
//AI::SetVar();
//AI::Spawn();
//AI::CallbackBored()
//
// iq
//attackMode
//pathType
//spotDist
//seekOff
//triggerWindup
//triggerPct
//smartGuyWeaponRange
//dumbGuyWeaponRange
//smartGuyMinAccuracy
//
bawb
Commander
Commander
 
Posts: 1203

5 Wed Dec 19, 2012 5:00 pm

you have some function to delete directives...
Also the bot spawns with no directives. There must be some code that runs and sets them.

Bug: If you set move directives and then remove all of them, your bot will stop walking forever.
This is why you need to keep one move directive always.
It was a pain to discover.
User avatar
C--
Sorry....
 
Posts: 3299

6 Thu Dec 20, 2012 12:24 am

If I remember correctly, there is a ::oncreate that sets basic values.
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

7 Thu Dec 20, 2012 9:43 am

I figured it out yesterday and didn't post.. plas is right i shouldn't be using createAi. ai::spawn is what createAi itself uses actually. my zombies are in full swarm
bawb
Commander
Commander
 
Posts: 1203

8 Tue Jan 22, 2013 5:02 pm

where can we play with them?

Is it true that after you kill 127 bots the server will crash?
SAND
Commander
Commander
 
Posts: 1059

9 Tue Jan 22, 2013 6:12 pm

No you can kill as many as you want as long as they are cleaned up properly. I can't host my mod, nor is really playable as a game (yet) but i can show you what i have in place so far. The concept requires a few functional systems to be set in place, so im focusing on those before i start focusing on the in-game world. I will be aiming to impress with this mod though
bawb
Commander
Commander
 
Posts: 1203

10 Wed Jan 23, 2013 2:34 am

After you have more than 127 clients in a server at the same time the game crashes.
Bots have a fake, but a client id.
User avatar
C--
Sorry....
 
Posts: 3299

11 Thu Jan 24, 2013 2:46 pm

I wonder what the limit in 1.40.655 is?
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

12 Thu Jan 24, 2013 3:36 pm

I still have yet to open that baby back up
bawb
Commander
Commander
 
Posts: 1203

13 Thu Jan 24, 2013 4:36 pm

plas do we have a working 1.40 anni server yet?
SAND
Commander
Commander
 
Posts: 1059

14 Thu Jan 24, 2013 5:00 pm

Yeah, somewhat.
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

15 Thu Jan 24, 2013 6:07 pm

Some what?
bawb
Commander
Commander
 
Posts: 1203

16 Fri Jan 25, 2013 2:11 pm

I can host my dev version of annihilation with some changes, but it's not ideal.
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

17 Fri Jan 25, 2013 4:01 pm

What problems are you having?
bawb
Commander
Commander
 
Posts: 1203

18 Sun Jan 27, 2013 11:10 pm

The script base in 1.40.655 sucks arse for modding. Needs to be cleaned up first.
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

19 Sun Jan 27, 2013 11:18 pm

Lol i will do it sooner or later... if you help us revive tribes you will probably be able to convince me to make it a main priority :p
bawb
Commander
Commander
 
Posts: 1203


Return to Coder's Hangout

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron