Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Question regarding AI Cafe tutorial ('pet' monsters)

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
rj Joined: 03 Jul 2008 Posts: 5 |

Posted: Thu Jul 03, 2008 9:40 pm Post subject: Question regarding AI Cafe tutorial ('pet' monsters) |

hi all. i've recently been trying to develop my own basic co-op bot for use in a Q1SP episode i'm creating. i'm more of a mapper than a coder at heart so it's not been easy, but i'm getting there slowly. basically i'd like someone who knows what they're doing with QC to take a look at this tutorial from AI Cafe: http://minion.planetquake.gamespy.com/tutorial/tutor8.htm
i've completed it in full (replacing monster_demon1 with my own helper_bot entity) and it kind of works. i say kind of, as when my helper bot finds & kills a monster, he just stands & looks at the corpse rather than reverting back to escort mode.
i get that it makes sense for him to do this, as there is nothing in the code to change his goal back once FindTarget has been returned true. and i'm guessing the following code needs to be added again at some point:

Code:
if (self.classname == "helper_bot") { self.goalentity = client; self.attack_state = ESCORTING; self.th_walk();
return TRUE;
}

..or something similar. but i can't for the life of me work out where to put it. what part of the code is checked when the monster has defeated its target?
any help appreciated, this one has been giving me a headache for ages!

Back to top |

Electro Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia |

Posted: Thu Jul 03, 2008 11:15 pm Post subject: |

Haven't done the tutorial myself, but after having a quick look at the code... this this: Before beast = findradius(self.origin, 1500); in FindMonster, put self.enemy = world;
This will make sure the enemy entity is cleared, so each time when he's looking to find a monster, if he doesn't find anything, it WILL actually return FALSE and never do FoundTarget. Currently I'm guessing it's doing FoundTarget quite a lot, even when you don't want it to.
Of course this could be completely wrong but we'll find out eh?
_________________
Unit reporting!
http://www.bendarling.net/

Back to top |

rj Joined: 03 Jul 2008 Posts: 5 |

Posted: Fri Jul 04, 2008 1:27 am Post subject: |

many thanks for the suggestion but unfortunately it didn't work. same result

Back to top |

rj Joined: 03 Jul 2008 Posts: 5 |

Posted: Fri Jul 04, 2008 2:00 am Post subject: |

erm. i think i kinda just worked out the answer just noticed in this part:

Code:
if (self.attack_state == ESCORTING) return FALSE; if (self.classname == "helper_bot") { self.goalentity = client;
self.attack_state = ESCORTING;
self.th_walk();
return TRUE;
}

it returns true the first time but false every time after that since the bot remains 'escorting' even when attacking other monsters. i figured if the attack state was changed to something else in FindMonster, it would pass the first argument above and allow itself to be changed again. that *seems* to work.. though if anyone has a tidier way of doing it...
/edit - agh, problem with this method... the bot can't attack one monster after the other, unless it sees the player in between

Back to top |

Electro Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia |

Posted: Fri Jul 04, 2008 4:25 am Post subject: |

Well seeing as there's only 2 states (escorting and attacking) if they're not attacking, then it's safe to assume they're escorting? If they can't find a target they should just escort, and in the escort state they would be searching for another monster to fight, as well as following the player.
_________________
Unit reporting!
http://www.bendarling.net/

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT
Page 1 of 1

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group