Follow Character still appearing

Started by maraki_ang3l, Thu 11/06/2009 15:13:16

Previous topic - Next topic

maraki_ang3l

I have a character who is following my main character but in some rooms i don't want to follow me.What would you suggest me to do?

I have a glocal variable and if that is 1 then he follows me and i put it in the fuction rep_ex  but even if I don;t put that if in the rooms that i don't want to appear the second character,he appears   :o

Any suggestions?

GuyAwesome

#1
What're you doing with that variable?
If you want to stop a character following your player, just call cNPC.FollowCharacter(null); , as it says in the manual. To restart them following, re-call cNPC.FollowCharacter(player). (With the right name for the other character, obviously...)

If you're going to be doing that a few times, you could probably set up some functions to save you having to repeat the code every time - not that it's really THAT much code.

Trent R

Put the lines Guy has pointed out in the room_leave scripts of the last rooms that are 'followable'.

For example, say a wolf is following Little Red Riding Hood through the woods. Once she gets inside the house, she won't be followed anymore. So in the room outside the house, put cWolf.FollowCharacter(null) in the room_leave script. You may also want to put a cWolf.FollowCharacer(player) in the room_afterfadein so that when you come back to the room.....


If you have to do this with a large number of rooms, I suggest reading up on Custom Properties and the on_event function. It's not hard scripting, but we're here to answer questions you may have about it.



~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

SMF spam blocked by CleanTalk