[SOLVED] Character won't go away

Started by Monsieur OUXX, Tue 18/12/2018 23:29:33

Previous topic - Next topic

Monsieur OUXX

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?
 

Crimson Wizard

#1
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.

Khris

Make sure it's the character you think it is. Press Ctrl+D to see a list of characters.

Monsieur OUXX

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: ags

function room_AfterFadeIn()
{
    cChar.SayAt(0, 10,  150,  "It's me");
    cChar.ChangeRoom(7, 160, 100); //send him away
    Wait(1);
    //cChar.Walk(200,  50, eNoBlock); //This makes the game crash with the message "this character is NOT in this room"
    cChar.SayAt(0, 10,  150,  "It's still me");
    
    for (int i=0; i<Game.CharacterCount; i++) {
        if (character[i].Room == player.Room) {
            Display("Character %s is in this room", character[i].Name); //cChar still gets listed here
        }
    }


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.
 

Crimson Wizard

Quote from: Monsieur OUXX on Wed 19/12/2018 00:01:07
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: ags
if (character[i].Room == player.Room)

Monsieur OUXX

#5
Quote from: Crimson Wizard on Wed 19/12/2018 00:04:35
To avoid confusion better test as:
Code: ags
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).
 

Monsieur OUXX

I just can't find it, it's driving me mad. May I send you guys a PM with the game sources?
 

Khris


dayowlron

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

Quote from: dayowlron on Wed 19/12/2018 17:13:47
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

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.

Crimson Wizard

Quote from: Khris on Wed 19/12/2018 20:39:24
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

#12
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.

ManicMatt

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

#14
Quote from: Khris on Wed 19/12/2018 21:24:23
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.
 

Monsieur OUXX

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 ;)

 

SMF spam blocked by CleanTalk