playMaker

Author Topic: Combat Log  (Read 637 times)

Wolfe

  • Playmaker Newbie
  • *
  • Posts: 4
Combat Log
« on: August 01, 2020, 02:02:25 AM »
Hello all,

I'm working with a turn based combat system and would like to create a decent combat log that breaks down what happens on both the player's and AI's turn.

I already have a system that adds both basic lines of string together from each turn as one larger string that's displayed on the screen, but I feel like it could be done better.

The idea I have ruminating in my head is to create some sort of layout group that adds each turn's actions into the layout group. At the same time I wanted to change some parts of the log to reflect dynamic variables such as damage amount and which enemy is attacking, but I think that's done with a [Format String] action yet I'm wondering if those formatted parts can have their text color changed to further reflect what's going during those turns.

OR, would it be better to stick with a [Build String] action that I already have and just update that?

IE.

What I have just uses a [Build String] action.

Element 0 = <Attacker Name Variable>
Element 1 = attacks
Element 2 = <Target Name Variable>
Element 3 = for
Element 4 = <Damage Variable>
Element 5 = damage!

And then it just adds that string with a new line to the combat log text and displays it.

What I'm thinking is something like the following

Format String = "{0} attacks and deals {1} damage" (But to spice it up it would instead pull a string from an array with different ways to describe the combat yet still use the same kind of format)
{0} would be who's attacking but I'd like it to be blue for the player and red for the enemy
{1} would be the amount of damage being done, and it would change its color based on the type of damage being done.

But also needs to be added to the layout group as a new textmeshpro field/box/element, that way I can easily adjust spacing and whatnot.

If anyone could help me out I'd appreciate it, or maybe I'm over thinking things and someone knows how to do what I need much more efficiently. Either way, do have yourselves a good day!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Combat Log
« Reply #1 on: August 01, 2020, 05:24:50 AM »
Hi.
so you can easily change the value color.
With text mesh it is possible to have different color parts of a text. but you would need to rebuild the string each time you would want to change color or size.

on the text mesh component turn on rich text so you can use things like <color>
i believe you need to do something like this :

This color is <size=18pt><color = red>Red</color></size>  but best to check the text mesh documentation.
E1 : This color is
E2 : <color =
E3 : red
E4 : >
E5 Red
E6 </color>

So to change color you can change E3 (you could use a variable there to change more easy)

Now if you would also be able to change size of it you can add that as well :
This color is <size=18pt><color=red>Red</color></size>

E1 : This color is
E2 : <size=
E3 : 18pt
E4 : >
E5 : <color=
E6 : red
E6 : >
E7 : Red
E8 : </color>
E9 : </size>

E3 you can set different color and E6 different size

Again check the Textmesh documentation if that is the correct format.


Wolfe

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Combat Log
« Reply #2 on: August 01, 2020, 08:48:29 AM »
djay,

Yeah that seems to work for my color needs! Thank you kindly!