How do I set text to the outcome of a "choose(1,2,3)"?

Get help using Construct 2

Post » Sat Jan 23, 2016 12:58 pm

Making a damage system where the amount of damage done to an enemy taken shows up in text. When you attack said enemy, the amount of damage done is randomized (16,17,18,19). How do I get the outcome of

On Left Button clicked on "Hit" (attacking, basically)
--->Subtract choose(16,17,18,19) from "Enemy_HP"

to set the text to?
B
5
S
1
Posts: 73
Reputation: 521

Post » Sat Jan 23, 2016 1:17 pm

Use a variable to store the result of choose(...) and then you can subtract the variable from enemy hp and set text to variable.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,630

Post » Sat Jan 23, 2016 2:50 pm

ramones wrote:Use a variable to store the result of choose(...) and then you can subtract the variable from enemy hp and set text to variable.


Yeah, that's my issue. I don't know how to store the result.
B
5
S
1
Posts: 73
Reputation: 521

Post » Sat Jan 23, 2016 2:56 pm

Press 'v' to add a variable. Use the 'System: Set value' action to set it.
Image
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,630

Post » Sat Jan 23, 2016 7:17 pm

The above technique is the correct way of doing it... But if you want a shortcut and don't want to use variables for this, then just show "Text" first, and then subtract whatever value it chose and showed. Example:

Set Damage.text to: Choose(16, 17, 18, 19)
Subtract int(Damage.text) from "Enemy_HP"
B
10
S
2
Posts: 107
Reputation: 978


Return to How do I....?

Who is online

Users browsing this forum: el3um4s, marcoscodas, TylerJS, Yahoo [Bot] and 9 guests