Issues with Changing character (Switch to Scene VS Switch to Character)

  • #1, by F_KalTuesday, 12. January 2016, 11:37 5 years ago
    I'm doing another test and I've come across a mind-boggling issue:
    I can't get to activate another character upon changing a scene when using the "switch to scene" action part.

    In my little test, I have two characters: one called "EmptyCharacter" and the other one called "chrFotisWiggling".
    On game-load I initiate the 1st scene with the EmptyCharacter. This scene is actually a short in-engine animation (the content can be seen in the image attached).
    At the end of the Action, I call the "Switch to Scene [theSuperMarket]" action part and set the "Character:" field to "chrFotisWiggling".

    My assumption would be that setting the character here into "chrFotisWiggling", would change the "Current Character" into "chrFotisWiggling" upon loading the new scene. However this is not the case:
    When entering the "theSuperMarket"-scene, "chrFotisWiggling" is visible indeed, but it's clear that he is not set as the current character. (however, if in the VSplayer I press Tab and type CHANGE CHARACTER ChrFotisWiggling, it becomes the current character and I can move him around...)
    a) Is this some bug/unimplemented feature, or some misunderstanding on my part? If "switch to scene" is meant to change only the scene (and not the current character), why does it ask you to manually define a character and his starting point?

    When later, I replaced the "Switch to Scene" action part, with a "Switch to Character" action part, this did work as intended in my scenario.
    b) however I still don't understand how this whole thing works. I can see that "Switch to Character [X]" switches you automatically to the scene where character X is located, as defined by his "Stands at:" property. But this is just one scene, hardcoded in his properties! What if I wanted to enter a 3rd scene, but wanted to use once again this particular character? how would you go about it?

    c)Is there some way to activate a character (set him as "current") without loading a scene again? (lua or action)

    Thank you,
    -Fotis

    Forum Fan

    107 Posts


  • #2, by afrlmeTuesday, 12. January 2016, 12:38 5 years ago
    Change to scene action part automatically teleports the active character into whichever scene you specify.

    Change to scene of a character will automatically change to the scene of the character you specify, but it will not set that as the active character.

    Change character - I've not actually used this action part (not had the need thus far) looks like it changes the active character & goes to whatever scene that character is on (looking at the available input options for the action part).

    Have you tried using Lua to change the active character? I have no idea if it would automatically force a scene change or not as I've not tried, but you could probably even force the other character to swap places & positions with the new active character if you wanted to.
    game.CurrentCharacter = Characters["Tom"] -- swap current character to Tom.
    1
    2

    Imperator

    6842 Posts

  • #3, by F_KalTuesday, 12. January 2016, 23:33 5 years ago
    Thank you again @AFRLme!

    I don't know what got me so confused: Even after you explained the differences between Change Scene, Change to Scene of a Character and Change Character, something didn't make sense to me. Now, I realize it was all my misunderstanding..

    Regarding the lua answer (apparently not necessary for basic adventure-making anymore, since the 3 above actions are all one usually needs).
    game.CurrentCharacter = Characters["Tom"] -- swap current character to Tom.
    1

    Your code snipped works indeed and after testing it, I can report that it also changes the scene to the one where the "Tom" character is... currently parked. Eventually it's the equivalent of the Change Character action part (without the choice of the transition)

    A general observation is that: Apparently the active character has to always be "in the scene". If he is not, the active scene automatically changes to reflect his location.
    I'm sure though, that I read someplace that there is provision for sequences where the camera follows NPCs in other scenes - while the "user-player" stays back in the original one. But I won't press this now - enough for one day wink
    For the sake of completeness (ie "so that others, totally clueless like myself may benefit from my stupidity"), I'm posting my original solution to the problem written in lua (based on your tip).
    Hopefully somebody will find some use in it...

    The following is a rather generic way of teleporting any character in any scene, and setting him as the user-controlled-character.
    Characters["Character0"].CharacterScene=Scenes["theSuperMarket"]
    -- (take Character0 and send him to theSuperMarket scene)
    Characters["Character0"].CharacterPosition=game.CurrentScene.Objects["objStartPoint"].ObjectPosition
    -- (place him at the position of the objStartPoint Object.)
    game.CurrentCharacter = Characters["Character0"]
    -- (set him as the user-controlled-character)
    1
    2
    3
    4
    5
    6
    7


    I keep forgetting that the http://wiki.visionaire-tracker.net/wiki/Data_Structure" target="_blank" title="http://wiki.visionaire-tracker.net/wiki/Data_Structure">data structures section in the wiki, is full of useful stuff!

    Thank you!
    -Fotis

    Forum Fan

    107 Posts

  • #4, by afrlmeTuesday, 12. January 2016, 23:44 5 years ago
    Yes it's possible to have the camera follow another character around the current scene with scene > center scene on character permanently... (if you tick the clear centering box then it disables automatic camera follow instead of following whichever character is selected in the dropdown menu).

    Imperator

    6842 Posts

  • #5, by F_KalWednesday, 13. January 2016, 19:48 5 years ago
    thanks @AFRLme, useful action to have in mind!

    However I was referring to the scenario of the camera following an NPC outside the scene.
    for instance: the protagonist is in a cage in room1 / he makes noise/you see the guard in room 2 sleeping /he stands up/comes to your room/tells you to stop/you see him leaving/entering room2 again/falling to sleep again.
    I remember I had seen someplace on the forum (or was it the wiki?) some way of achieving this but now that I'm googling for it, I can't seem to able to locate it - argh!
    I have a vague impression that it had to do with menus vs scenes though, but may be some arbitrary residual impression I got, from to much thread/wiki skim reading razz

    Forum Fan

    107 Posts

  • #6, by MachtnixWednesday, 13. January 2016, 20:56 5 years ago
    I don't understand your problem in the first thread.
    The two characters in your last cage example are 1. the main charcter and 2. the guard as a NPC. If room 1 (cage) and room 2 is on the same scene it won't be a problem to let the NPC into the first room (walking through a door). It's only a lot of personal animations, of course you can make a NPC walking to your main person. IF prota makes noise, THEN start awakening animation, send NPC to prota, start a dialog. After dialog's ending send the NPC back to sleeping place with an own falling in sleep action. I think, it works without Lua with only editor actions using. If you use a widescreen scene with two roomes it should work.
    But you want to use TWO scenes? The camera should follow the NPC? Sth like that?

    Thread Captain

    1087 Posts

  • #7, by F_KalWednesday, 13. January 2016, 22:28 5 years ago
    tnx @Machtnix!
    Indeed, I wasn't clear enough; the idea (which was merely a thought experiment, not something I was planning to implement anytime soon) was having two separate "rooms" that can not easily laid out as one scene - eg. two (or more) non-adjunct rooms.

    As you say, I was thinking of a series of scenes that the NPC crosses, with the camera following him from scene to scene.

    Another use case would be: same room, but different angles/perspective: you see the guard approaching the hero's cage (3rd person view), and then we see the guard coming closer through the eyes of the protagonist (1st person view).

    I suppose both examples could indirectly be solved by having an invisible user player character in all the "sequence" scenes where he is not supposed to appear, and make sure that the initial scene doesn't unload when starting this follow-the-NPC-sequence-across-the-universe, so it feels snappy.
    But I thought that I had read someplace that there was a more appropriate way of implementing these cases (though I can't remember where I read it)

    Forum Fan

    107 Posts

  • #8, by F_KalWednesday, 13. January 2016, 22:32 5 years ago
    I don't understand your problem in the first thread.

    regarding the first thread question ("switching characters") it was my bad - I couldn't understand how to properly use the action parts Change Scene, Change to Scene of a Character and Change Character but that got shorted out thanks to @AFRLme's patience!

    Forum Fan

    107 Posts

Write post