i am trying to make my own game, and i want to make a wolf follow the player, she is going to be a healer.... but i dont know how to make her follow the player around. code is very new to me, so can i get some help/advice please?
I'm a newbie myself, but I would guess you can put a script under Objects->game: Script when entering a room
wolf.parent = player.parent
(Assuming your wolf is represented by an object called 'wolf'. :-) )
Or instead of the line I gave above try this one:
MoveObjectHere (Wolf)
I actually tested this one, works fine.
yes well i want her to only follow the player when ask to.... not when the game starts....
oh... well heres the thing she is in a forest and the player has to ask her if she wants to go on a grand adventuer.... but i will try figure this out... this is confusing to at the very least.....
Make a boolean attribute on the Wolf object, say Wolf.hasAgreed, default False. Once the Wolf agrees set that o True. Expand the script I mentioned above to:
if (Wolf.hasAgreed){
MoveObjectHere (Wolf)
}
If you haven't done so so far, you should work through the tutorial, beginners and intermediate parts. WIthout that it might be hard to understand anything anyone says to help you. :-)
From one newbie to another, there is a page on the subject. In that example, it has a on object called "boss" that follows the player. I'd suggest that you use the example, and adapt it for your wolf.
http://docs.textadventures.co.uk/quest/guides/following.html
I would assign two verbs to the wolf, one to tell it to follow, and one to tell it to stay. If you tell it to follow, the wolf will be flagged and then follow you with each turn. When you tell it to stay, it will then be unflagged and then stay in whatever room it is currently in. And if you need it to magically appear when you suddenly need it, but it's in another room, I would set up a command that would move the wolf to my current location.
how do i make the command only work after you talk to her?
edit- nevermind i think i got this
What I would do is set up the first verb
Now, it's time to set up the second verb.
Now, you need a script to run each turn.
if (GetBoolean(wolf, "following")) {
wolf.parent = player.parent
}
At that point, you are ready to run the game, with the wolf to follow you whenever you say "lead wolf" while playing the game. If you say "stop wolf," the wolf will remain at its current location.
just a quick explanation of the concept of the 'parent' Object Attribute:
the default new game is this:
the 'player' Object is contained within the 'room' Object:
<object name="room">
<object name="player">
</object>
</object>
well, this is the exact same thing:
<object name="room">
</object>
<object name="player">
<attr name="parent" type="object">room</attr>
</object>
and this too is the exact same thing:
<game name="xxx">
<attr name="start" type="script">
player.parent = room
</attr>
</game>
<object name="room">
</object>
<object name="player">
</object>
so, the concept:
player.parent = room
wolf.parent = room
'player' and 'wolf' are both inside (contained within) 'room'
player.parent = room
wolf.parent = room2
'player' and 'wolf' are inside different rooms: 'room' vs 'room2'
so, by doing this:
wolf.parent = player.parent
we're setting the 'wolf' to be inside of the same room as the 'player'
conceptually:
wolf.parent = (player.parent = room) -> wolf.parent = room
or
wolf.parent = (player.parent = room2) -> wolf.parent = room2
or
wolf.parent = (player.parent = room99) -> wolf.parent = room99
and if we want the 'player' to be following the 'wolf' (the reverse):
player.parent = wolf.parent
conceptually:
player.parent = (wolf.parent = room) -> player.parent = room