How a character can follow the player

m4u
16 Dec 2013, 17:40
Hi guys, i tried everything and it's not working, turnscript, flags, attributes. How can I make a dog or friend follow the player to any room the player goes and write a message like "the dog follows you" but without repeating the message in the same room?

jaynabonne
16 Dec 2013, 19:36
Here's a simple example. The heart of it is a turn script:

  <turnscript name="Follower">
<enabled />
<script><![CDATA[
if (dog.parent <> game.pov.parent) {
dog.parent = game.pov.parent
msg ("The dog follows you.")
}
]]></script>
</turnscript>

The full example is here:

<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Follower">
<gameid>5287577f-78af-4165-a6df-90da78b21ccb</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="bedroom">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="dog">
<inherit name="editor_object" />
</object>
<exit alias="east" to="living room">
<inherit name="eastdirection" />
</exit>
</object>
<turnscript name="Follower">
<enabled />
<script><![CDATA[
if (dog.parent <> game.pov.parent) {
dog.parent = game.pov.parent
msg ("The dog follows you.")
}
]]></script>
</turnscript>
<object name="kitchen">
<inherit name="editor_room" />
<exit alias="west" to="living room">
<inherit name="westdirection" />
</exit>
</object>
<object name="den">
<inherit name="editor_room" />
<exit alias="north" to="living room">
<inherit name="northdirection" />
</exit>
</object>
<object name="living room">
<inherit name="editor_room" />
<exit alias="west" to="bedroom">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="kitchen">
<inherit name="eastdirection" />
</exit>
<exit alias="south" to="den">
<inherit name="southdirection" />
</exit>
</object>
</asl>

m4u
16 Dec 2013, 21:22
For some reason is not working in my game. Either repeat the message or doesn't show the message at all. I put the turnscript in the game and then in on room. Is it possible that another turnscript can override this one?

jaynabonne
16 Dec 2013, 22:22
I think I'd have to see it to know for sure what's going on. Is it possible to post some small, complete sample that fails for you?

HegemonKhan
18 Dec 2013, 08:07
this thread has some info~content on Sgreig's "Following~Follower" Code:

viewtopic.php?f=10&t=3908&hilit=following

I think there's one other thread as well, still searching for it...

viewtopic.php?f=10&t=3848&start=15&hilit=sgreig+following+code

viewtopic.php?f=10&t=3666&hilit=sgreig+following+code