Follow Character for slow "sheep" (follower:P)

Started by Sektor 13, Mon 17/10/2005 18:40:53

Previous topic - Next topic

Sektor 13

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?

Pumaman

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?

Kweepa

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).
Still waiting for Purity of the Surf II

Sektor 13

Hey Steve, it was an great idea, but it doesn't work, it is the same....

Kweepa

Just to waste your time further, how about...?

Code: ags

// 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.
Still waiting for Purity of the Surf II

Sektor 13

nope it doesn't work... i tried something similliar with SetTimer andstuff too, no results

monkey0506

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?

Sektor 13

Yep, i don't actually use those names i just used an example... real names are cJack and cMechano ...

SMF spam blocked by CleanTalk