How can i create a "battle log"

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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...

    I really appreciate any kind of help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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:

    https://www.dropbox.com/s/a6pjvu7fvy27q3a/screen_01.png?dl=0[/code:93idcvr4]
    
    I hope I was able to explain my self
  • 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:

    https://www.dropbox.com/s/a6pjvu7fvy27q3a/screen_01.png?dl=0[/code:25vfpzf3]
    
    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.

  • 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!

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