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

Post Reply
bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

my bot wont do what i tell it to

Post by bawb » 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);

User avatar
C--
Sorry....
Posts: 3299
Joined: Thu Apr 06, 2006 2:32 pm

Re: my bot wont do what i tell it to

Post by C-- » 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..

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » 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
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » 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
//

User avatar
C--
Sorry....
Posts: 3299
Joined: Thu Apr 06, 2006 2:32 pm

Re: my bot wont do what i tell it to

Post by C-- » 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
Plasmatic
Lead Developer
Lead Developer
Posts: 8376
Joined: Mon Apr 29, 2002 11:00 pm
Location: 4th State of matter.
Contact:

Re: my bot wont do what i tell it to

Post by Plasmatic » Thu Dec 20, 2012 12:24 am

If I remember correctly, there is a ::oncreate that sets basic values.

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » 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

SAND
Commander
Commander
Posts: 1059
Joined: Sun Apr 20, 2003 11:00 pm
Location: USA.gif
Contact:

Re: my bot wont do what i tell it to

Post by SAND » 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?

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » 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

User avatar
C--
Sorry....
Posts: 3299
Joined: Thu Apr 06, 2006 2:32 pm

Re: my bot wont do what i tell it to

Post by C-- » 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
Plasmatic
Lead Developer
Lead Developer
Posts: 8376
Joined: Mon Apr 29, 2002 11:00 pm
Location: 4th State of matter.
Contact:

Re: my bot wont do what i tell it to

Post by Plasmatic » Thu Jan 24, 2013 2:46 pm

I wonder what the limit in 1.40.655 is?

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » Thu Jan 24, 2013 3:36 pm

I still have yet to open that baby back up

SAND
Commander
Commander
Posts: 1059
Joined: Sun Apr 20, 2003 11:00 pm
Location: USA.gif
Contact:

Re: my bot wont do what i tell it to

Post by SAND » Thu Jan 24, 2013 4:36 pm

plas do we have a working 1.40 anni server yet?

User avatar
Plasmatic
Lead Developer
Lead Developer
Posts: 8376
Joined: Mon Apr 29, 2002 11:00 pm
Location: 4th State of matter.
Contact:

Re: my bot wont do what i tell it to

Post by Plasmatic » Thu Jan 24, 2013 5:00 pm

Yeah, somewhat.

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » Thu Jan 24, 2013 6:07 pm

Some what?

User avatar
Plasmatic
Lead Developer
Lead Developer
Posts: 8376
Joined: Mon Apr 29, 2002 11:00 pm
Location: 4th State of matter.
Contact:

Re: my bot wont do what i tell it to

Post by Plasmatic » Fri Jan 25, 2013 2:11 pm

I can host my dev version of annihilation with some changes, but it's not ideal.

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » Fri Jan 25, 2013 4:01 pm

What problems are you having?

User avatar
Plasmatic
Lead Developer
Lead Developer
Posts: 8376
Joined: Mon Apr 29, 2002 11:00 pm
Location: 4th State of matter.
Contact:

Re: my bot wont do what i tell it to

Post by Plasmatic » Sun Jan 27, 2013 11:10 pm

The script base in 1.40.655 sucks arse for modding. Needs to be cleaned up first.

bawb
Commander
Commander
Posts: 1203
Joined: Thu Apr 09, 2009 10:55 am

Re: my bot wont do what i tell it to

Post by bawb » 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

Post Reply