How do I refresh existed content in text object ?

  • Dificult to explain but i try

    I have one text object 'quest juornal'

    and few global variables

    -killed

    -picked gold

    When player receive quest to kill 5 creatures i make event

    trigger once append text to quest juornal

    'killed creatures' & killed

    now when i kill each enemy i add 1 to 'killed' but text dont change

    now i need refresh existed text to update counter

    how do that?

  • On enemy killed > append text to quest journal

  • On enemy killed > append text to quest journal

    i think about that but when i create quest store 250 piece of wood

    each piece i should append in juornal? Must be better solution

  • your text should print a variable instead of just a text

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • your text should print a variable instead of just a text

    please give me example

  • Oh right I thought enemyskilled was a variable. When you receive the quest you update the text to something like "You must kill"&quEnemies&"enemies" where quEnemies is a global variable set to 5, the text will then display You must kill 5 enemies. Each time you kill an enemy you subtract 1 from the global variable so it now says You must kill 4 enemies. You set the text to update every tick.

  • plinkie i try this but its not good solution when you have more quests

    1kill 5 enemies

    2store 250 gold

    3 receive 50 wood pieces

    if this is in one text object, you cannot use every tick condition

    will be great to update existed text...

  • I don't know anything about the game. Can you receive all quests at once? You would probably need a global variable for each quest, an amount of gold, wood and enemies. You update the text based on which quest you want to show or which one you are currently on. You could set up a variable for currentquest, if it is 1 then show the enemies quest, if it is 2 then update text for the gold quest. Depends how your game works and how the quests are viewed.

  • You can receve first and third or second and third quest, order of given quest is Your choice

    Each quest will have own variable,

    How it should work:

    Append random quest and Display in text object (number 0 is global variable of the quest)

    Quest 1:0/6 killed objects

    Quest 2: 0/200 picked pieces of wood

    Quest 3: 0/500 gain first 500 xp

    @Ashley its possible to add action 'refresh existed text' to update typed global variables ?

    I don't know anything about the game. Can you receive all quests at once? You would probably need a global variable for each quest, an amount of gold, wood and enemies. You update the text based on which quest you want to show or which one you are currently on. You could set up a variable for currentquest, if it is 1 then show the enemies quest, if it is 2 then update text for the gold quest. Depends how your game works and how the quests are viewed.

  • As mentioned above 'Set Text' is used for refreshing text. Every time you call that it will update with whatever the global variable exists as at that point.

  • plinkie

    i know this action, when you use 'set' you change whole existed content not update.

    If you have right i must see example to understand this

  • Ashley its possible to add action 'refresh existed text' to update typed global variables ?

    It's not really possible, because the text object just gets plain text, it doesn't know where the text came from or how to update it. That's all evaluated in the action parameter before the action runs.

    However you can efficiently just set the text every tick. The text object is optimised so that if you set the same text twice in a row, the second time does nothing. It will only do the text reflow & render when the text actually changes.

  • plinkie thanks for your initiative in your example its possible to display all quest in a row ?

  • I chose to change between which quest is displayed. You can display all quests in one text object if you really want.

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