Jibble

Author Topic: [SOLVED] Character won't go away  (Read 492 times)

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
[SOLVED] Character won't go away
« on: 18 Dec 2018, 23:29 »
Once again a dumb issue that will be fixed in two seconds by someone.

- I have a room (room 6)  that is NOT the starting room of character cChar
- cChar is NOt the player character
- At some point, I do "player.ChangeRoom(6)" in order to go to that room.
- Just to be sure, in Room_Load of room 6, I do "cChar.ChangeRoom(7); Wait(1);" to force-remove cChar.

...And yet after the fade-in, cChar is here in room 6, in all his glory.
I can't make the damned character f**k off.

what am I missing?
« Last Edit: 21 Dec 2018, 02:11 by Monsieur OUXX »
 

Re: Character won't go away
« Reply #1 on: 18 Dec 2018, 23:37 »
Hmm, since you tried in Room_Load and it still there after fade-in, that may mean either:
- Room_Load is not executed (not linked on events pane);
- It actually gets there after that again; this I cannot tell because I don't know under which conditions you move it there in the first place.
« Last Edit: 19 Dec 2018, 00:31 by Crimson Wizard »

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
Re: Character won't go away
« Reply #2 on: 18 Dec 2018, 23:55 »
Make sure it's the character you think it is. Press Ctrl+D to see a list of characters.

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Character won't go away
« Reply #3 on: 19 Dec 2018, 00:01 »
I've double-checked, triple-checked both your suggestions.

When I press Ctrl+D it tells me that Player is in this room and I see that the view is the correct view cChar has another very recogniazable view).

In AfterFadeIn I executed this verification code :
Code: Adventure Game Studio
  1. function room_AfterFadeIn()
  2. {
  3.     cChar.SayAt(0, 10,  150,  "It's me");
  4.     cChar.ChangeRoom(7, 160, 100); //send him away
  5.     Wait(1);
  6.     //cChar.Walk(200,  50, eNoBlock); //This makes the game crash with the message "this character is NOT in this room"
  7.     cChar.SayAt(0, 10,  150,  "It's still me");
  8.    
  9.     for (int i=0; i<Game.CharacterCount; i++) {
  10.         if (character[i].Room == player.Room) {
  11.             Display("Character %s is in this room", character[i].Name); //cChar still gets listed here
  12.         }
  13.     }
  14.  

Now the really, REALLy odd thing is that the commented line makes the engine tell you that cChar is not in this room.
HOWEVER the loop underneath DOES display cChar as being in this room, additionally to the player character.

I'm super duper confused.
 

Re: Character won't go away
« Reply #4 on: 19 Dec 2018, 00:04 »
HOWEVER the loop underneath DOES display cChar as being in this room, additionally to the player character.

Earlier you said this is room 6, but you are testing to room 13 in that loop? :/

To avoid confusion better test as:
Code: Adventure Game Studio
  1. if (character[i].Room == player.Room)

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Character won't go away
« Reply #5 on: 19 Dec 2018, 00:10 »
To avoid confusion better test as:
Code: Adventure Game Studio
  1. if (character[i].Room == player.Room)

Haha you're too quick, I've edited my post instantly but you still picked it up. ;)
In my description it's room 6, in real life it's room 13.

Anyways I think I've found the issue. In room 6 I have some code that forcefully swaps the player character in case I'm in debug mode and I arrived there with the wrong character. I suspect that this code is mlessed up and brings in the unwanted character at the same time.

I'll keep looking. thanks, gentlemen (and ladies who might have been silently reading).
« Last Edit: 19 Dec 2018, 00:16 by Monsieur OUXX »
 

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Character won't go away
« Reply #6 on: 19 Dec 2018, 00:16 »
I just can't find it, it's driving me mad. May I send you guys a PM with the game sources?
 

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
Re: Character won't go away
« Reply #7 on: 19 Dec 2018, 09:23 »
Sure, send away.

dayowlron

  • been programming computers since 1981
    • I can help with AGS tutoring
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
Re: Character won't go away
« Reply #8 on: 19 Dec 2018, 17:13 »
Is SayAt a blocking command? could it be that the script is not proceeding to the change room until after the SayAt has completed?
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Character won't go away
« Reply #9 on: 19 Dec 2018, 19:46 »
Is SayAt a blocking command? could it be that the script is not proceeding to the change room until after the SayAt has completed?
Hmmm, could be. But even after the SayAt, the character stays. That motherspriter. OK Khris I'll zip it up and send you a PM. thanks a lot.
 

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
Re: Character won't go away
« Reply #10 on: 19 Dec 2018, 20:39 »
I assumed the character was actually visibly appearing in the room. Turns out they aren't :P

Character.Say() will always show the message, even if the character isn't actually present in the current room. My guess is that this was decided to allow narrator speech without having to make sure the narrator character is constantly moved to the current room.

Re: Character won't go away
« Reply #11 on: 19 Dec 2018, 21:07 »
I assumed the character was actually visibly appearing in the room. Turns out they aren't :P

Erm what.... I assumed the same.

What about the loop displaying that character cChar is still in the current room?

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
Re: Character won't go away
« Reply #12 on: 19 Dec 2018, 21:24 »
The loop confirms that the stubborn character isn't in the room.
Doesn't matter if the ChangeRoom line is commented out or not; for me the loop never shows the motherspritin' character misbehaving, because they aren't in the room to begin with.
« Last Edit: 19 Dec 2018, 21:46 by Khris »

Re: Character won't go away
« Reply #13 on: 20 Dec 2018, 20:16 »
Yeah, I like that feature. In my current game I have a character behind a locked door and I didn't need to hide him behind the door to have him say something and have his text appear in the right spot.

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Character won't go away
« Reply #14 on: 21 Dec 2018, 01:29 »
The loop confirms that the stubborn character isn't in the room.
Doesn't matter if the ChangeRoom line is commented out or not; for me the loop never shows the motherspritin' character misbehaving, because they aren't in the room to begin with.

OK but do you see the character dressed in city clothes appearing right in the middle of the room?
- If not, then I might have given bad directions to reproduce the issue.
- If yes, then I want this character to go away, no matter the reason. I don't understand why it appears there.

EDIT: I have indeed given you bad directions to reproduce the issue. I'll update with proper directions asap.
« Last Edit: 21 Dec 2018, 01:32 by Monsieur OUXX »
 

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Character won't go away
« Reply #15 on: 21 Dec 2018, 02:10 »
OK so the issue is resolved.

It was a real mess of confusing characters (because Character.Say works even if the character is not here), having the player character invisible, having custom code swapping characters (to be able to revert to previous character when chaging room) and more custom code changing the character's view automatically (to apply some sort of costume).

Long things short: I had no idead what character was where displayed with what view  (roll)

Thanks thanks thanks so much to people who tried to look into it.


Also, Khris, enjoy the sneak peek to this little game that should be released with two weeks ;)