Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Sektor 13 on Mon 17/10/2005 18:40:53

Title: Follow Character for slow "sheep" (follower:P)
Post by: Sektor 13 on Mon 17/10/2005 18:40:53
So, I am using some chasing, but main characters speed is 3 and other character (who wants to kill player) is set to 1 as he is limping. Ok, so let say there is a big room. So main character is on the left side and killer on the right. Killer starts to follow, so if i move main character to the right side (towards the killer) but a bit lower so he is not collinding with the killer, then the killer would walk a few seconds (about 3 to 5) towards the left side, and it doesn't look like he is chaseing player. This effect happens if killer is much slower that the player. I used cKiller.FollowCharacter(cPlayer,0,0) (and tried different settings too) as it says in the manual to use it for chaseings.... ? Any ideas?
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: Pumaman on Mon 17/10/2005 18:54:51
This is because the following character doesn't re-evaluate their route very often (because it could really slow the game down if they did).

However, perhaps if the followed character moves more than a certain distance from their original position, it should re-calculate the route.

Anyone else have any thoughts on this?
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: Kweepa on Mon 17/10/2005 19:03:59
Sounds like a plan.
Is there some way to parameterize it? Recalc if the followed character moves X pixels, or Y game frames elapses.
In the meantime, what happens if you call FollowCharacter again? If it recalculates, Sektor13 could use that with some delay (say once a second).
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: Sektor 13 on Mon 17/10/2005 20:53:52
Hey Steve, it was an great idea, but it doesn't work, it is the same....
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: Kweepa on Mon 17/10/2005 21:43:50
Just to waste your time further, how about...?


// global
int followTimeOut = 0;

// repex
followTimeOut--;
if (followTimeOut < 0)
{
  followTimeOut = GetGameSpeed();
  cKiller.FollowCharacter(NULL);
  cKiller.FollowCharacter(cPlayer, 0, 0);
}


This will, I think, force a recalculate.
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: Sektor 13 on Tue 18/10/2005 21:14:48
nope it doesn't work... i tried something similliar with SetTimer andstuff too, no results
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: monkey0506 on Tue 18/10/2005 22:19:20
Just for the record, you do know you can type player to access the player character at any point instead of having to name your main character PLAYER?
Title: Re: Follow Character for slow "sheep" (follower:P)
Post by: Sektor 13 on Wed 19/10/2005 14:36:45
Yep, i don't actually use those names i just used an example... real names are cJack and cMechano ...