After searching for a bit, I couldn't find exactly what i was looking for.
What i want is for two npcs to follow the player character (which i programmed just fine). However, when i leave the room, they don't join me. How do i program something to where the NPCs follow the player character across rooms until further specified?
Use this: Character.FollowCharacter() (http://www.adventuregamestudio.co.uk/manual/Character.FollowCharacter.htm)
that will make them follow the player cross-room indefinitely? Because i already have them following me at the distance i need, they just won't change rooms with me...
Hi
Character.FollowCharacter() will have that NPC change room with the main character though I have found there is a time delay. (Check NPC distance and eagerness values).
I've dealt with this by not only following the main player but by also changing room as well as player. I assume once they've all reached a certain point the room changes?
EXAMPLE:
cEgo.ChangeRoom(3); //NPC
cBert.ChangeRoom(3); //Main Player
If your code fails to work perhaps you should show the code you have used so we can check it out.
barefoot
Quote from: lilinuyasha on Fri 22/07/2011 04:13:00
that will make them follow the player cross-room indefinitely?
No, I just thought it would be funny to post some random command. ;)
Just out of curiosity, could you show us your code?
*edit*
Yeah, there was a bit of a time delay. That's going to be kind of annoying, but we can work with it.
cSweetie: yay.
cEgo.SetAsPlayer();
cScootaloo.FollowCharacter(cEgo,5,1);
cSweetie.FollowCharacter(cScootaloo,5,1);
(dialog functions)
The only thing is, they're not following the character the entire game. I need them to follow the character while they search for something, then stop following them afterwards. I can't seem to get them to come cross room with me though. I'll try setting eagerness as 0. Do i have to make a seperate code for them to enter the room? FOR EVERY SINGLE FREAKING ROOM?
Hi
not sure what cSweetie: Yay is supposed to be ??? unless its:
cSweetie.Say("Yay");
Try:
cScootaloo.FollowCharacter(cEgo,5,96);
cSweetie.FollowCharacter(cEgo,5,96);
This way both NPC will follow Character cEgo.
Adjust numbers accordingly:. 5=distance 96= eagerness (1-100) (1 eagerness means NPC not really eager to follow!)
The more eager a follow character is the quicker he will follow player wherever he goes..
Check out Follow Character in the AGS Help Manual and search forums.
As i previously said, I personally change NPC room as well as player when its time for player to change room to clean up any delay with NPC following player to another room but generally they will change room with player if set up correctly. You only need to use FollowCharacter once.
Quote
The default values are DIST=10 and EAGERNESS=97.
As a special case, setting DIST=0 and EAGERNESS=0 makes CHARID behave as if it is chasing CHARTOFOLLOW - it will try and get there as quickly as possible. Setting EAGERNESS=0 also tells the character not to stop when they reach CHARTOFOLLOW, but instead to randomly wander around the character - useful perhaps for a very energetic dog or something.
You can also stop NPC following by using:
cScootaloo.FollowCharacter(null);
barefoot
I would imagine it to be reasonably obvious that the "cSweetie: yay." bit is in a dialog script. But maybe I'm just being ridiculous or something.
Also, don't you think it's a bit much to explain the entire function that they were already using instead of just explaining the one parameter that presumably should improve the scenario to the desired behaviour?
You don't use the c in dDialog script unless it's indented like Say, as you should know, unless I'm having a mid-life crises.
I tried to explain as much as I could due to the fact that he obviously has little knowledge of the follow character else he would not have posted.
Maybe I did add too much, but no harm done, I'm sure..
:=
I've always used c in my dialog functions unlkess it's player. Maybe that's just me though.
Otherwise, i'll have to deal with the delay. Thanks guys. If there's any way to minimize the delay without making characters change, let me know. Also, if there is a separate code that enables you to let them go to other rooms, (without global function advanced programming mumbo jumbo) let me know.
Quote from: lilinuyasha on Mon 25/07/2011 05:59:01(without global function advanced programming mumbo jumbo)
What's that supposed to mean? Are you asking for help or not? "Cure my bad illness, but skip all that doctor stuff" ::)
Anyway, you can use the on_event function to move both characters to the same room without delay for every room without putting code into each one.
I won't bore you with global function mumbo jumbo though so you'll have to work out the details yourself.
There's actually three characters. I have one following ego, the other following the one following ego.
I guess i'm willing to listen to global functions now. What would be the easiest, most efficient way to have characters follow and change rooms immediately? I'm pretty sure i can put it in an IF function after that.