Phantom Player Glitch (FIXED)

Finch
21 Jul 2016, 01:41

Right. So I wrote out a game a while back. It's actually mostly finished, and all ready to be published and everything. It's just that there's this glitch that keeps happening, that at a certain point seems to separate the player from the "player" object and removes their items from their inventory, essentially rendering the game unwinnable. I'm going to really try and get the sequence of events in order, to see if there isn't something I'm missing:

So the first step is that the player uses a bed, has himself a dream sequence (here the player object changes from the player to an alternate version of the player, with a separate inventory). The player does a few things while in this dream sequence and then, after flags are set, the game is arranged so that he's supposed to be sent right back to the original room and switched over to the original player the moment he passes from one room to another. What winds up happening instead is that they're sent back to the original room, their inventory is missing, and there's a new object called "player" in the room (which, incidentally, is not the name given to either of the player objects) which I can only assume is where all the items have gone to.

Naturally, I've tried changing around the order in which actions are performed when the player passes through the doorway, on the off chance that fixes things, but it doesn't. Furthermore, I can't do anything with this "player" object since, in the editor, it doesn't even exist; it's this bizarre artifact of the glitch where the game just seems to generate it out of thin air. At least, I'm assuming it's a glitch, and I haven't done some astronomically bone-headed oversight. Any kind of suggestions on what to try or where my attention should be would be pretty greatly appreciated.


XanMag
21 Jul 2016, 02:09

In X2, I have a creature that the player can change back and forth between and never had any serious issues like that.

I'm sure you've done this but...

  1. In the search box at the top of the tree of stuff, search for 'player'. See if something turns up.
  2. Save your game. Switch to code view. Ctrl + F and search for 'player'. Make note of where 'player' is found in the code. Don't save any changes when you close this. Don't fiddle with code unless you are 100% certain you know what you're doing.
  3. Double check your change player script and make sure it is set to the name (not alias) of your beginning player.
  4. When you add objects to the player inventory, do you use add to inventory script or move object to object (player name)? If you use the latter, double check that objects are moved properly.
  5. If this did not help, it might be helpful to post the code section here where things go wrong - seems to be switching back to the original player object.

If all the above fail, fee free to send me your .aslx file via email. Or, if you want to bypass 1-5, I'll be happy to take a look at it and see if I can find the problem. If you ask, I'll post my email here.

Good luck!


The Pixie
21 Jul 2016, 07:10

I think the game will create a player object if there is not one set at the start of the game, so that could b the (or a) source of the problem. Go to the Player tab of the game object and check what is set there.

If you are editing off line, use "Debugger" at the top to track where things are (the "parent" attribute is the location of an object). You can use that to determine what happens to the player inventory. Note that it does not update automatically; look at a different thing to get attributes to update.


Finch
22 Jul 2016, 01:14

Okay, so The Pixie's advice seems to have worked. Once I set the Player to my main character, it seems like the game figured out to make the main character the player, and so now the glitch is fixed. Mostly. Now, there seems to be another, smaller glitch going on. The game now opens up with the following phrase at the bottom of all the intro text:

Error running script: Error compiling expression 'player': Unknown object or variable 'player'

I'm confused by this. It doesn't seem to have negatively affected the game in any way, it's just there.


XanMag
22 Jul 2016, 03:32

It sounds like you have a script that tries to identify the object 'player' that isn't there. I assume your actual player character does not have the name 'player', but is rather an object you created with a given name. When you switched the 'player' object to your created player, any script you have referring the original player cannot be completed as the code is searching for object 'player'. You'll want to check that stuff as weird bugs will appear if you ever run into a reference that no longer exists.

Example: if I begin with an object I label as 'dog' and run scripts referencing object 'dog', all is good. But if I go back and decide to change the name of object 'dog' to 'Fido', all scripts referencing dog will result an an error like the one you're seeing. What I would do (take that with a grain of salt), is search in code view for 'player' and identify the scripts where this object name is referenced.

I'm guessing this is where you encounter the error if I understand you correctly. I've been plenty wrong before though. Lol

Good luck.


Finch
23 Jul 2016, 20:56

I managed to fix the problem, in kind of a quick and dirty way. I couldn't find any script that referenced a player object, and certainly didn't remember writing any script to that effect, so I just made a player object and changed the player over to the real protagonist. Inelegant, true, but at least there's no more error script.

Thank you guys so much for your help. I finally managed to get my game published, now that it's not falling apart all crazy like.


hegemonkhan
24 Jul 2016, 09:21

did you use 'game.pov' at all? As this is a reference to (what/who-ever is) your CURRENTLY CONTROLLED Player Object. This can cause issues, if you're not careful with it (usually in regards to applying stat changes to one or many of your Player Objects, which you don't want to happen, as you only wanted it to happen to a single specific Player Object or only to a group of certain/specific Player Objects)

also... check all of your 'players' names for possible accidental spaces (whitespaces):

(space)player
~OR~
player(space)

lastly, quest is upper and lower case sensitive


last idea, just came to me, lol:

maybe you never returned to a Player Object, and so quest creates a Player Object for you, instead of having the game crash (as there must at all times be a Player Object that is being currently controlled, as otherwise, with quest's design, you couldn't play it, lol).


P.S.

if you provide your entire game code (if you don't want to publically, when the site mods have the time, they can look through your game code, or if you know of a user you can trust and who is a good programmer and knows quest well, you can use them obviously too --- I'm still not very good at trouble shooting others' code and don't have the time either, sighs), we can look at see if you got a mistake in it that's causing the problems. However, if you've changed any of the underlying built-in code... that can be more difficult to troubleshoot unless there's files created of/for the altered underlying code we can look at.