Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#644488 30/03/18 05:04 AM
Joined: Mar 2018
O
stranger
OP Offline
stranger
O
Joined: Mar 2018
Hello, I am rather new to the mod engine, however; I was able to reverse engineer an excellent random buff difficulty mod (by Baardvaark). The mod adds a random buff to enemy characters making the game more difficult and the combat more interesting. I am able to create and add all of my own designed buffs and custom icons with a few exceptions. Primarily, I cannot figure out to how to add a talent to my enemy character buff. I have tried a variety of different syntaxes. I am adding these using the “CONSUME” potion function. Below is one of my failed attempts. Any help is appreciated:

From “RandomizationStatus.txt”
new entry "ROBUST"
type "StatusData"
data "StatusType" "CONSUME"
data "ForGameMaster" "No"
data "InitiateCombat" "No"
data "DisplayName" "Robust"
data "Description" "Increased Vitality, Immunities, and Talents"
data "DescriptionRef" "Poison Vuln"
data "Icon" "Robust"
data "FormatColor" "Green"
data "StatsId" "Robust"

From “Potion.txt”
new entry "Robust"
type "Potion"
using "_SkillBoost"
data "VitalityBoost" "40"
data "PoisonResistance" "20"
data "Flags" "FearImmunity"
data "Talents" "AttackOfOpportunity"

Joined: Mar 2018
O
stranger
OP Offline
stranger
O
Joined: Mar 2018
Hello,

No one has any ideas? Am I missing something really simple? Should I post this in the scripting forum? I am looking at the last line of my entry:

data "Talents" "AttackOfOpportunity"

Is there a simple way to add a talent to an enemy character with a potion entry. As always any help is appreciated.

Joined: May 2017
enthusiast
Offline
enthusiast
Joined: May 2017
After messing around with statuses, potions, and "BoostWeapon" on potions (which links a weapon stat to potions, and weapons can have talents), I'm convinced that this would be easier to do with scripting, as there appears to be some limitations with statuses/potions/boost weapon.

Boost weapons on potions don't appear to apply bonus skills or talents to characters with the status, as they can't find the "source". I kept getting this error:
[eoc::ConcatDamageFromItemStats] source is null.

Category: Code
Count: 1
Timestamp: 04-04-2018 15:33:08:756
Function: eoc::ConcatDamageFromItemStats
Location: EoCShared\Shared\TooltipHelpers.cpp (56)

Despite this error, it would apply bonus damage to the weapon I was wielding, but wouldn't display the extra damage in any of the tooltips (probably due to the error).

I also tried applying talents with a damage status, as that can be linked to a weapon stat as well, and that didn't work for me either.
______________________________

Regardless, this would be way simpler and less tedious to handle via scripting. Story scripting in particular would make this easily manageable with databases. This tutorial here should help you get started: Your First Story Script.

Once you have a basic script set up, the code to apply talents could be like this:

INIT:
Code
//DB_MyMod_StatusToTalent(_Status, _Talent)
DB_MyMod_StatusToTalent("MYMOD_ROBUST", "AttackOfOpportunity");
DB_MyMod_StatusToTalent("MYMOD_ROBUST", "ResistPoison");
DB_MyMod_StatusToTalent("MYMOD_ENLIGHTENED", "ViolentMagic");
DB_MyMod_StatusToTalent("MYMOD_UNSTABLE", "Unstable");

Notice "MYMOD_ROBUST" has two talent entries here. Our script will apply both.

KB:
Code
IF
CharacterStatusApplied(_Character, _Status, _)
AND
DB_MyMod_StatusToTalent(_Status, _Talent)
AND
CharacterHasTalent(_Character, _Talent, 0)
THEN
CharacterAddTalent(_Character, _Talent);
DB_MyMod_TalentAdded(_Character, _Status, _Talent);

IF
CharacterStatusRemoved(_Character, _Status, _)
AND
DB_MyMod_StatusToTalent(_Status, _Talent)
AND
DB_MyMod_TalentAdded(_Character, _Status, _Talent)
THEN
CharacterRemoveTalent(_Character, _Talent);
NOT DB_MyMod_TalentAdded(_Character, _Status, _Talent);

That's all it takes. You can easily expand on the "DB_MyMod_StatusToTalent" database and link up multiple talents with specific statuses.

We use the "DB_MyMod_TalentAdded" database here to only remove a talent if it was added by the script. That way, enemies that already had that talent won't have it removed if the status is removed.

Last edited by LaughingLeader; 04/04/18 11:46 PM. Reason: Typo fix.
Joined: Mar 2018
O
stranger
OP Offline
stranger
O
Joined: Mar 2018
Thank you for the reply.

I will read through the material you posted and try what you have recommended.


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