How do I refresh existed content in text object ?

Get help using Construct 2

Post » Mon Nov 21, 2016 6:40 pm

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?
Last edited by IGDev on Tue Nov 22, 2016 4:10 pm, edited 2 times in total.
B
25
S
8
Posts: 219
Reputation: 2,181

Post » Mon Nov 21, 2016 7:10 pm

On enemy killed > append text to quest journal
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Mon Nov 21, 2016 8:55 pm

plinkie wrote: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
B
25
S
8
Posts: 219
Reputation: 2,181

Post » Mon Nov 21, 2016 11:15 pm

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

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Tue Nov 22, 2016 7:34 am

IJCT wrote:your text should print a variable instead of just a text

please give me example
B
25
S
8
Posts: 219
Reputation: 2,181

Post » Tue Nov 22, 2016 8:42 am

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.
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Tue Nov 22, 2016 12:38 pm

@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...
B
25
S
8
Posts: 219
Reputation: 2,181

Post » Tue Nov 22, 2016 1:11 pm

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.
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Tue Nov 22, 2016 3:07 pm

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 ?




plinkie wrote: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.
B
25
S
8
Posts: 219
Reputation: 2,181

Post » Tue Nov 22, 2016 3:12 pm

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.
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests