FAQ  •  Register  •  Login

easy mapper placed waypoints monster follow?

Moderator: Inside3D Admins

<<

ceriux

User avatar

Posts: 1856

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Thu Mar 15, 2012 3:52 am

easy mapper placed waypoints monster follow?

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?
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!
<<

metlslime

Posts: 310

Joined: Tue Feb 05, 2008 11:03 pm

Post Fri Mar 16, 2012 1:17 am

Re: easy mapper placed waypoints monster follow?

path_corner works for monsters as well as func_trains
<<

ceriux

User avatar

Posts: 1856

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Fri Mar 16, 2012 1:38 am

Re: easy mapper placed waypoints monster follow?

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?
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!
<<

frag.machine

User avatar

Posts: 1486

Joined: Sat Nov 25, 2006 1:49 pm

Post Fri Mar 16, 2012 4:16 am

Re: easy mapper placed waypoints monster follow?

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)
<<

ceriux

User avatar

Posts: 1856

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Fri Mar 16, 2012 4:38 am

Re: easy mapper placed waypoints monster follow?

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:
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;
};
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!
<<

ceriux

User avatar

Posts: 1856

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Tue Mar 20, 2012 6:54 am

Re: easy mapper placed waypoints monster follow?

okay... so iv set the bots target as "path" // ------------------------------------------------
  Code:
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?
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!
<<

ceriux

User avatar

Posts: 1856

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Wed Mar 21, 2012 1:40 am

Re: easy mapper placed waypoints monster follow?

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.. -.-
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!
<<

ceriux

User avatar

Posts: 1856

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Wed Mar 21, 2012 5:47 am

Re: easy mapper placed waypoints monster follow?

figured this out too with out the lazy approach thanks guys!
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Icons provided by Aha Soft