How can i create a "battle log"

Get help using Construct 2

Post » Wed Feb 03, 2016 5:05 am

Hello guys, i really need your help; the thing is: i am making a sort of RPG, and i need to create a "battle log", for example:

"You lose 39 hitpoints due to an attack by a dragon"
"A dragon loses 40 hitpoints due to your attack"

This kind of log is implemented in games like Tibia, etc.

Right now, i can adapt a spritefont to set the text with specific variables: "A Enemy.Name loses Sword.Damage hitpoints due to your attack"

My problem is when the text changes, when you attack other enemy; i dont know how to save the previous text in a kind of text box and keep the log updating...Any ideas?

Should i use an array or something rare like that?

Here is a screenshot of what i want...
Image

I really appreciate any kind of help.
B
5
Posts: 2
Reputation: 229

Post » Wed Feb 03, 2016 7:20 am

Lets imagine that every time you press "G" you gain 5 gold and you get "You gain 5 gold!" in your log ok? Do this:

1st you create a "Text Box" of the size you want, go to the properties of the text_box and where it says "Read-only" you choose "yes". And "type" to "text-area".
2nd, go to the event_sheet and create a global variable with the type "Text", name it "log".
3rd, go to the event_sheet and create a global variable with the type "Number", name it "gold".

Now you make the condition and the add 5 to the gold variable.
The second effect: System> add to variable > "log" > and you write ""You gained 5 gold!" & newline"

This is how it should look like:

Code: Select all
https://www.dropbox.com/s/a6pjvu7fvy27q3a/screen_01.png?dl=0


I hope I was able to explain my self
B
10
S
1
G
1
Posts: 21
Reputation: 1,011

Post » Fri Feb 05, 2016 1:23 am

Olgoth wrote:Lets imagine that every time you press "G" you gain 5 gold and you get "You gain 5 gold!" in your log ok? Do this:

1st you create a "Text Box" of the size you want, go to the properties of the text_box and where it says "Read-only" you choose "yes". And "type" to "text-area".
2nd, go to the event_sheet and create a global variable with the type "Text", name it "log".
3rd, go to the event_sheet and create a global variable with the type "Number", name it "gold".

Now you make the condition and the add 5 to the gold variable.
The second effect: System> add to variable > "log" > and you write ""You gained 5 gold!" & newline"

This is how it should look like:

Code: Select all
https://www.dropbox.com/s/a6pjvu7fvy27q3a/screen_01.png?dl=0


I hope I was able to explain my self


Hi, first of all THANK YOU, this seems to be the solution. I learned something about CSS and how to stylize my text box to integrate it to my game (in the visual aspect); right now i have some problems, like the order of the text lines (i want a bottom-to-top text (the most recent text line on the top of the textbox));but.. i think i will solve this later. And again, let me thank you, you helped me a lot.
B
5
Posts: 2
Reputation: 229

Post » Sat Feb 06, 2016 2:40 am

No problem, I would like yo help you more but textboxes are not really my thing (atleast right now). But there has to be a way! So good luck!
B
10
S
1
G
1
Posts: 21
Reputation: 1,011


Return to How do I....?

Who is online

Users browsing this forum: CJacobsSA, SneakyHands and 4 guests