How do I change instance variable of sprite when this sprite is in another layout?

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • How can i change variable of Sprite when this sprite is not on another layout?

    Example player start on Layout 1

    Sprite is in Layout 2

    what can i do in event sheet when to make changes in instance variables of Sprite that is in another Layout?

  • It's not possible.

    Why do you need to do this?

    You can use a global variable to store data between layouts. So when you switch to the second layout, check the value in the global variable and update the sprite if needed.

  • It's not possible.

    Why do you need to do this?

    You can use a global variable to store data between layouts. So when you switch to the second layout, check the value in the global variable and update the sprite if needed.

    For example: Im start in Layout called 'Town' in this map you can't have interaction with Town governor NPC, because his instance variable 'Dialogue' is 0 at start (should be 1 to take action)

    When i leave this map, to other Layout map called 'Village' here i can have interaction with other NPC, after that interaction - NPC Governor should have changed instance variable 'Dialogue' to 1 and now posibility to talk/ do action

    I know i can make with Global variable, but for all NPC's in future ? ;/

    i already have lot Global variables in game ( its RPG game, so lot of statistics)

    Is there no other option than setting everything in Global variable?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you have a complex system of NPCs and dialogues, you might need to store the progress in some data object, I recommend JSON.

    For example, there may be a record in JSON for each NPC, where you can track if the player has talked to that NPC, how many times, their friendship status etc.

    {
    "NPC": "Governor",
    "DialogueCount": 2,
    "Location": "Town",
    "Attitude": "friendly"
    }
    
  • If you have a complex system of NPCs and dialogues, you might need to store the progress in some data object, I recommend JSON.

    For example, there may be a record in JSON for each NPC, where you can track if the player has talked to that NPC, how many times, their friendship status etc.

    > {
    "NPC": "Governor",
    "DialogueCount": 2,
    "Location": "Town",
    "Attitude": "friendly"
    }
    

    Thanks, i think this will be good reason to start learning JSON

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)