Forum

easy mapper placed waypoints monster follow?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

easy mapper placed waypoints monster follow?

Postby ceriux » Thu Mar 15, 2012 3:52 am

is there an easy way to make waypoints that monsters will follow? iv been looking through some bot tutorials and the only ones iv found seem to place waypoints for the bots then have them follow them. id like to place my own that my monsters follow. is there an easy way to go about this?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: easy mapper placed waypoints monster follow?

Postby metlslime » Fri Mar 16, 2012 1:17 am

path_corner works for monsters as well as func_trains
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Re: easy mapper placed waypoints monster follow?

Postby ceriux » Fri Mar 16, 2012 1:38 am

metlslime wrote:path_corner works for monsters as well as func_trains



they automatically follow them? or would i use the ai code to direct them towards them?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: easy mapper placed waypoints monster follow?

Postby frag.machine » Fri Mar 16, 2012 4:16 am

ceriux wrote:
metlslime wrote:path_corner works for monsters as well as func_trains

they automatically follow them? or would i use the ai code to direct them towards them?


It's as simple as setting target = "path1" in your monster, where targetname = "path1" in path_corner.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Re: easy mapper placed waypoints monster follow?

Postby ceriux » Fri Mar 16, 2012 4:38 am

nice, thanks ill be checking into that now. i cant sent target via worldcraft and the ai says basically if there is no player visible then the monsters target is "path_corner" so.. i shouldnt have to set a target... (the reason i cant choose a target is because im not using a monster_army to spawn my monsters)

Code: Select all
void() walkmonster_start_go =
{
local string   stemp;
local entity   etemp;

   self.origin_z = self.origin_z + 1;   // raise off floor a bit
   droptofloor();
   
   if (!walkmove(0,0))
   {
      dprint ("walkmonster in wall at: ");
      dprint (vtos(self.origin));
      dprint ("\n");
   }
   
   self.takedamage = DAMAGE_AIM;

   self.ideal_yaw = self.angles * '0 1 0';
   if (!self.yaw_speed)
      self.yaw_speed = 20;
   self.view_ofs = '0 0 25';
   self.use = monster_use;
   
   self.flags = self.flags | FL_MONSTER;
   
   if (self.target)
   {
      self.goalentity = self.movetarget = find(world, targetname, self.target);
      self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
      if (!self.movetarget)
      {
         dprint ("Monster can't find target at ");
         dprint (vtos(self.origin));
         dprint ("\n");
      }
// this used to be an objerror
      if (self.movetarget.classname == "path_corner")
         self.th_walk ();
      else
         self.pausetime = 99999999;
         self.th_stand ();
   }
   else
   {
      self.pausetime = 99999999;
      self.th_stand ();
   }

// spread think times so they don't all happen at same time
   self.nextthink = self.nextthink + random()*0.5;
};
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: easy mapper placed waypoints monster follow?

Postby ceriux » Tue Mar 20, 2012 6:54 am

okay... so iv set the bots target as "path" // ------------------------------------------------
Code: Select all
void() create_armybot =
// ------------------------------------------------
{

local entity bot, spawn_spot;

// start entity and place it in world
   bot = spawn();
   spawn_spot = MonsterSpawnPoint ();
   
   bot.target = "path"; // my target is "path"
   bot.origin = spawn_spot.origin + '0 0 1';
   bot.angles = spawn_spot.angles;
   bot.fixangle = TRUE;   
   soldiers = soldiers + 1;
   spawn_tfog (bot.origin);
   spawn_tdeath (bot.origin, bot);
   

// set size and shape
   setsize (bot, VEC_HULL2_MIN, VEC_HULL2_MAX);
   bot.solid = SOLID_SLIDEBOX;
   bot.movetype = MOVETYPE_STEP;
   setmodel(bot, "progs/soldier.mdl");
   bot.flags = bot.flags | FL_MONSTER;
   bot.takedamage = DAMAGE_AIM;

// define his animation
   bot.th_stand = army_stand1;
   bot.th_walk = army_walk1;
   bot.th_run = army_run1;
   bot.th_die = army_die;
   //bot.th_melee = ogre_melee;
   bot.th_missile = army_atk1;
   bot.th_pain = army_pain;
   bot.health = 30;

// polish him up
   bot.classname = "monster";
   bot.ideal_yaw = bot.angles * '0 1 0';
   bot.yaw_speed = 120;
   bot.view_ofs = '0 0 22';
   //bprint("an ogre joins the game\n");

// begin his thinking
   bot.nextthink = time + 0.1 + random();
   bot.think = bot.th_walk;
   



};


in worldcraft i placed a "path" of path_corners with the name "path" my monster still just guards where he spawns?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: easy mapper placed waypoints monster follow?

Postby ceriux » Wed Mar 21, 2012 1:40 am

i fixed my problem by editing the function in ai.qc to return TRUE instead of FALSE for when the players behind a wall. this way the monster always knows where the players at and attempts to attack him.
kinda cheap way, but works so far. (sometimes the monsters are like derp... ima run at this for a min) i fixed this by speeding up the monster_army by removing every 3rd frame except the last one (seems to make him run a bit faster) making the game seem to have a tad bit more action and sped up the process in which he was able to navigate to me (even when stuck on a wall.) i wasnt able to get the monsters to follow waypoints/path_corners. but this seems to have given me what i wanted either way.

edit: actually... it just seems that i was lucky they were walking through.. -.-
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: easy mapper placed waypoints monster follow?

Postby ceriux » Wed Mar 21, 2012 5:47 am

figured this out too with out the lazy approach thanks guys!
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest