Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2016
journeyman
OP Offline
journeyman
Joined: Sep 2016
So I'm trying to include detailed combat log messages as part of my armor-based saving throws mod. Here's what I'm working with, basically:

Quote
// If saving throw succeeds, remove status, turn deflect percentage (.00 - 1.00) into an int (1-100) and return save message:

IF "c1"
IsRandom(_DeflectTally)
THEN
ListAdd(_RemoveList, _Status)
Set(_Status,null)
Multiply(_DeflectTally, 100)
Cast(_DeflectChance, _DeflectTally)
Print(_Text, "Physical effect failed ([1]% deflect chance)", _DeflectChance)
Cast(_CombatText, _Text)
CombatLogText(_Character, _CombatText, 0, 1)


With _Text as a string and _CombatText as a fixed string. So this gives me a very basic message in the combat log, no matter who saves against what skill. I'd like to get more specific, to recreate the specificity of the messages you get when players are dealt damage or given status effects.

My initial attempt at revising the Print call looked something like:

Quote
Print(_Text, "[1]'s magic armor deflected [2] ([1]% deflect chance)", _Character, _Status, _DeflectChance)


Which gives me this when the Red Prince saves against Chicken Form:

Quote
S_Player_RedPrince's magic armor deflected CHICKEN (50% deflect chance)


So, closer, but not yet where I need it to be. I can get the status CHICKEN to return its display name by doing the following:

Quote
Print(_String, "[1]_DisplayName", _Status)
Cast(_FixedString, _String)
CombatLogText(_Character, _FixedString, 0, 1)


That will give me part of what I want: a message with the proper translated string for any given status. In this case it takes CHICKEN_DisplayName and returns "Chicken Form". But though I can call that as a fixed string, and get a single line in the combat log reading "Chicken Form," I can't output that fixed string as part of another fixed string. For example:

Quote
Print(_String, "[1]_DisplayName", _Status)
Cast(_FixedString, _String)
Print(_Text, "[1]'s magic armor deflected [2] ([1]% deflect chance)", _Character, _FixedString, _DeflectChance)


As you might guess, this will yield the following combat message:

Quote
S_Player_RedPrince's magic armor deflected CHICKEN_DisplayName (50% deflect chance)


Does anyone have any ideas for what I might try, here? To grab a character's name, the name of a status, and output them as part of another message in the combat log? If anyone can show me how the base game populates damage and status messages in the combat log so I might make use of some of those tricks, my subscribers and I would greatly appreciate it.

Last edited by smarmbot; 06/10/17 03:37 AM.
Joined: Dec 2016
Location: United States
member
Offline
member
Joined: Dec 2016
Location: United States
As we had briefly discussed before, I believe you're going to need to hook into story code to fetch the character's proper display name.

As for using TranslatedFixedString data as a string param for Print... We'll need some help from our glorious patrons. Otherwise, you'll have to make a separate string for each possible status name.

Joined: Sep 2016
journeyman
OP Offline
journeyman
Joined: Sep 2016
Do you know what that kind of hook might look like? Or of any similar code I might work off of?


Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5