Changing the player midgame? Player can become another player? Help.

XanMag
OK. Sorry I'm asking another question that I should probably already know the answer to...

In my game, my plan is basically to have two players that can be controlled at different times. When the original player reaches a certain level in the game he has the option of temporarily becoming a secondary player with different skills (mostly accessing rooms the original player cannot get into - all basic commands and directions will be the same between players - I am NOT creating another player with a total different set of commands).

I currently can become the secondary player but when I try to go up (into the ventilation system and the only directional option in the place where the switch can be made) I end up in a "room" that is the parent to the original position of my secondary player, which happens to be my item warehouse with all the objects I need to move and hide during game play. :lol:

I assume to give my secondary player all of the attributes of my original player, I will need to (maybe?) copy the inherited types under the player tab of my primary player over to my secondary player? Or my attributes?

I'm asking before tinkering because I think I could really goober things up here and cause more problems and confusion for myself. What do you think the easiest idiot proof (Xan proof) way to make this happen is? Please consider that I have already worked many hours working on scripts for each character, so the least obtrusive way to make this happen the better!! Thanks for you help!

XanMag

The Pixie
XanMag wrote:I currently can become the secondary player but when I try to go up (into the ventilation system and the only directional option in the place where the switch can be made) I end up in a "room" that is the parent to the original position of my secondary player, which happens to be my item warehouse with all the objects I need to move and hide during game play. :lol:

Sounds like you just need to move the second player to the location
secondary_player.parent = primary_player.parent
game.pov = secondary_player
primary_player.parent = item_warehouse

I assume to give my secondary player all of the attributes of my original player, I will need to (maybe?) copy the inherited types under the player tab of my primary player over to my secondary player? Or my attributes?


You cannot change types; you need to make sure you give the secondarey player all those types from the start (if you really mean types in the Quest sense).

For attributes, you could just check thr value of the attribute on the primary player. Instead of game.pov.strength, which will change when the player changes,just use primary_player.stength, whether this is the prmary player or not. You will have to be careful that you do that consistently across the game.

XanMag
OK. My code lingo fails me again. I know I SHOULD learn it better but my brain just doesn't work that way yet. I created a test game and made three objects that the player can become. I start as Fred and can become Dread and Ned. I created these secondary characters EXACTLY the same way as I did in my main game. I added a game command (If 'Ned' is visible, then change player object to Ned) to switch characters. I switch from Fred to Ned and Dread and everything in between just fine with a simple 'be ned/dread/fred' command. When I go to move a direction with one of these three characters, I have no problem either. So, why do I have a problem if I created my secondary character the SAME WAY in my main game? I tried to find difference in the GUI but cannot find any.

Again, when I move my secondary character in my main game (in any direction) I end up in an inaccessible room I have created for object storage. I have moved the secondary character around to different parent rooms, but it always ends up after his first movement back in the item warehouse.

The idea is... I do not want to move my main character from the room after the switch. He passes out and stays in the room. At that point, my secondary player can take control and, if in the same room as my passed out main character, it can switch back again.

I'm not sure why it works in one instance and not another.

I have posted my game again with this added part so, if you choose, can play through and see what I mean.
http://textadventures.co.uk/games/view/ ... -2-revenge

jaynabonne
I can see two places - one in the Prison Cell and the other in the Janitorial Closet - where you have onexit scripts like this:

Prison Cell:
    <onexit type="script">
LockExit (PrisonCellLock)
SetObjectFlagOff (Blerk, "blerkable")
MoveObject (Blerk, Item Warehouse 1)
</onexit>


Janitorial Closet:
   <onexit type="script">
SetObjectFlagOff (Blerk, "blerkable")
MoveObject (Blerk, Item Warehouse 1)
</onexit>

In both these cases, as soon as you try to leave the room, Blerk gets put in Item Warehouse 1. If you're Blerk at the time, well... there you are.

Is that what's happening? (Are you in one of those two rooms?)

jaynabonne
Another issue, not related to this but I noticed it...

You have this code (in "use" for whistle1):


if (game.pov.parent = Blerk) {
msg ("Blerk responds to the whistle and inches a bit closer to you. It seems to be wagging its tail a bit at the sound of the whistle.")
}

and this (in "blow" for whistle1):


if (game.pov.parent = Blerk) {
msg ("Blerk responds to the whistle and inches a bit closer to you. It seems to be wagging its tail a bit at the sound of the whistle.")
}

I think you mean:

if (game.pov.parent = Blerk.parent)


unless you plan on putting the player inside the dog. :)

XanMag
Hmmm. As for your first post... The intent there was... That if the player was controlling the main character and chose to leave the room instead of controlling the secondary player, then the secondary player would disappear from the room, thus requiring the main player to summon Blerk again using the whistle. So, can I not make my secondary player disappear after he has appeared the first time? If I make Blerk invisible instead of moving him, would that work? Then of course make him visible after the whistle blows again? Anyhow, at least I know know why that happens! It'll give me something to tinker with again.

That second command is supposed to be in response to summoning Blerk with the whistle if Blerk is already in the room and if Player object is currently Xanadu! After the first bit of immature restroom humor, I think I'll avoid the challenge of writing the troubles of passing through Blerks intestinal system! Thanks again!

jaynabonne
I think what you have is fine, except you should add an "if" to make sure you're not Blerk before moving him to the warehouse room.

   <onexit type="script">
LockExit (PrisonCellLock)
SetObjectFlagOff (Blerk, "blerkable")
if (not game.pov = Blerk) {
MoveObject (Blerk, Item Warehouse 1)
}
</onexit>

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums