Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
Hi there,

I'm trying to add a bunch of skills like VenomCoating with an additional damage debuff for the enemy. Right now VenomCoating only adds poison damage to the weapon, resulting in poison damage to the enemy hit, but NOT apply the debuff POISONED. I'd like to change that and create a bunch of skills like that for coating weapons with fire, ice, air, oil, poison and acid with the additional status debuff like burning, chilled, shocked, (oilify), poisoned and acid.

My problem is that the StatsEditor doesn't support my task (or at least I didn't found it yet).

What I've tried by using VenomCoating as a reference:
My idea is to apply a POISONED,100,2 to the enemy hit after activated the VenomCoating Buff
[list]
[*] adding the debuff to SkillData-Shout at SkillProperties (dumb, I know, since the skill itself is a buff on myself, it poisens me too, not the enemy)
[*] SkillData-Shout links to StatusData-Status_CONSUME (still the buff on myself), this links via StatsId to Stats-Potion (still the buff), this links via BonusWeapon to Stats-Weapon, where it should be possible to add the debuff for the enemy
[*] at Stats-Weapon is the ExtraProperties column, which adds this debuff to other weapons already in the Shared library, but it didn't worked at my test. hitting enemies simply added the poison damage but no debuff state
[*] at Stats-Weapon is the column Boosts (which links into the same Stats-Weapon page), additionally adding a boost. i tried that by adding a modified "_Boost_Weapon_Damage_Poison" (set POISENED to 100) to my Status_VenomCoating, but with no positive result.
[*] i've tried to add the same Boost to a normal sword directly, which worked easily


Does anyone knows how to add that debuff successfully?

Thank you for your help.

Greeting, BigBadCook!e

Joined: Nov 2017
Location: Ukraine
apprentice
Offline
apprentice
Joined: Nov 2017
Location: Ukraine
Unfortunately, editor doesnt seem to support this. Was trying hard to make it work, since 80% of my mod is applying statuses on enemies IF i have some status on me.

_BonusWeapon wont do it, the only way the devs do it is using DeltaModifiers for weapons (real and physical, generated in the world), and applying _bonusWeapons to them via Deltamod.

Tried to do the same for "virtual" weapons, but failed.
The only solution for me was to create a custom weapon, with extra property that applys some "status_check" and then using scripting to manage the rest.

Smth like:

IF
CharacterStatusApplied (_Enemy, "Status_check", _Player)
AND
HasActiveStatus (_Player, "Debuffing_weapons_acid",1)
THEN
ApplyStatus(_Enemy, "ACID", 6.0);

(*just an example logic from story scripting)

1- trigered when status with name "Status_check" is applied
2- checks for active status on _Causee (_player) and if _causee (player) has "Debuffing_weapons_acid" status active,
3- then apply "ACID" status on enemy for 1 turn

If you need it for skill then no custom weapon needed, just apply that Status_Check on enemies with the skill ExtraProperty.

If you find a better way, lemme know please =)

edit: just rememberd, seems like every time you hit an enemy, the hardcoded status "HIT" is applied, so you could try to use it. Never tested though, it is too late for me, new weapons are ready and functional smile

Last edited by Module 003; 10/01/18 08:14 PM.
Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
Thank you for the update! I'm not understanding the scripting part of the game yet, but I planned to check that at the weekend. It's nice to know that you already tested that.

I'm trying to apply it via the HIT status. Seems like an interesting way to try that.

Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
I'm trying to put the code you mentioned into the game. I'm currently struggling by adding a charscript to my playable characters (the origins).
Referencing on the documentation by larian, charscripts have to be added via the root template of the character (https://docs.larian.game/Activating_Scripts : "Character and item scripts can be assigned to resp. characters and items via the Scripts property in the sidebar. You can do this both for root template and for instances/objects of root templates that you placed in a level.")

Do I have to load something to access the origins root_templates? is there a better way then trying to add a charscript to the origins?

I've tried to add a gamescript as well, since they don't have to be linked to specific characters, but I don't know how to add the caster or hitter as a character.

Code
EVENT CharacterSetMotA_WEAPON_COAT_DEBUFF
VARS
    CHARACTER:_EnemyHit
    LIST<STATUS>:_RemoveList
    STATUS:_Result
	INT:_Turns
ON
    FetchCharacterApplyStatusData(_EnemyHit,HIT)
ACTIONS
	Set(_Result,null)
	Set(_Turns,null)
	ListClear(_RemoveList)
	StatusText(_EnemyHit,"GotHit")

	RETURN(_RemoveList,_Result,_Turns)


The code worked great, and every hit displayed a GotHit text, but I didn't managed to get a "Hitter" display text above the caster.

Joined: Nov 2017
Location: Ukraine
apprentice
Offline
apprentice
Joined: Nov 2017
Location: Ukraine
IF you do not have have any .charScripts already, I'd advice to use Story scripting instead.

Most important: .char Scripts will make your mod conflict with other mods, while story scripts will not.
So if you want ppl not to trouble about compability and use your mod with others without addition patches / fixes - use story scripting.

It has enough tools for most of the cases.

Making a new story script is easy, just
1) open story editor;
2) file - "Generate diffinitions, build and reload" (ctr+F7);
3) chosee to parent script (the top one), right mouse button - "Add new subitem"
4) name it the way you want. Beter to have unique name, smth like: YorModeName_ScriptName

After that you can just write your script in "KB" section (the middle one).
To apply changes: File - "Build and reload"

The script I showed as an example in previous post, is a story script, and should work fine, just change status names.

Here are some links you may need to learn story scripting (also called Osiris)
https://docs.larian.game/Osiris_Overview - overvew
https://docs.larian.game/User:Sunjammer/api - API list



Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
Hi Module 003,

first of all a great thanks for the help, I really appreciate it.
Second, there's still an issue with the story scripting I encountered.

I made a story script, adding the following code
Code
IF
	CharacterStatusApplied(_Enemy, "HIT", _Player)
AND
	HasActiveStatus(_Player, "ACID_COATING",1)
AND
	Random(100,_RandomResult)
AND
	_RandomResult < 10
THEN
	ApplyStatus(_Enemy,"ACID",2.0);


The minor issue is, that no matter what I write as a number for the duration, I always resulting in only 1 turn, so ACID 2.0 still applies the effect for only 1 turn. But I could live with that.

The bigger issue is, that the Status Check I use to register the attack, "HIT", simply is triggered by everything frown
Even if I attack with a ranged elemental skill, I currently apply acid.

I thought about adding another check for the distance between _Player & _Enemy ("GetDistanceTo"), but that's not a 100% working solution, since a spell could be casted in melee range as well...

Any other ideas for the status check?

Thank you!

Last edited by bigbadcook!e; 14/01/18 02:27 PM.
Joined: Nov 2017
L
member
Offline
member
L
Joined: Nov 2017
The duration is actually in seconds, not turns, going by this:
https://docs.larian.game/Osiris/API/ApplyStatus

Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
Another question about Osiris and how it works for performance reasons:

Does osiris directly go to the "ELSE" if a single condition was violated or does the keep checking all conditions? I'm asking because since the game has to check my script at every single attack someone does it might be better to let it return after the most unlikely condition is violated (if the Buff is set).

If Osiris checks all conditions before returning to the else statement, it might be better to pyramid the other conditions... just thinking.

Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
I have seen the "seconds" thing at the documentation, still thought that a second is a turn. But still, I even tried 11.0 with no higher reward then 1 turn

Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
ok, found out that game handles 6 seconds a turn smile

Joined: Nov 2017
Location: Ukraine
apprentice
Offline
apprentice
Joined: Nov 2017
Location: Ukraine
Osiris overview can tell alot about how it works.
https://docs.larian.game/Your_First_Story_Script
may help as well.

As to performance, don't worry too much about it.
If 1st condition failed, the script will just ignore the rest of the event block.

If same event called multiple times, it will handle them 1 by 1 in the order you mentioned them in script.

And game seems to be doing it smooth.
Failed a few times, and had a status applied in a loop for infinity, without delays. With icon , animation, display massage, etc. But even then editor crashed only after several seconds =)

And as to additional condition..
A good question. That's the main reason i had to add custom weapons to my mod. Not to worry about such a thing.

I wasn't able to find ANY trggers, that could say "character is performing a basic attack". That is ennoing as hell.

Distance+damage type(physical) may be your best choises.
And some others mb, like "IsEnemy" "PartyMember" and so on. Just examine all querys and see what will fit you.

I cheaty solution could be applying some invisible status each time player cast a spel, using timer for 1-2 seconds (timer calculates time in REAL time, not the way "turns" do).
And then add a check for it

HasActiveStatus(_Player,"CASTING_A_SPELL",0)

or smth like that

Last edited by Module 003; 14/01/18 06:09 PM.
Joined: Nov 2017
Location: Ukraine
apprentice
Offline
apprentice
Joined: Nov 2017
Location: Ukraine
IF
SkillCast(_charGUID,_)
THEN
DB_somePrefix_databaseName(_charGUID);
ApplyStatus(_charGUID,"CASTING_A_SPELL",-1.0,1);
TimerStart("RemovingApplyBlock",2000);

IF
TimerFinished("RemovingApplyBlock");
AND
DB_somePrefix_databaseName(_charGUID)
THEN
RemoveStatus(_charGUID,"CASTING_A_SPELL");
SysClear("DB_somePrefix_databaseName",1);


IF
CharacterStatusApplied(_,"HIT",_causee)
AND
HasActiveStatus(_causee,"CASTING_A_SPELL",0)
AND
.....
THEN
....

Thats a cheaty way that should work in most cases.
The problem here is that a spell can be a melle spell, like flurry, or some other, that is supposed to apply statuses from weapon.

This can be solved, but more scripting is needed.
Just create a database with all spells, that you want to exclude from list (that wont block status apply)
and add this database to a condition.

There can be other minor issues, like custom melle spells, added by other modders, specialy the ones that use scripting to cast multiply skills in a row without animation.
Or there can be spells with an awfull animation textKeys ("SkillCast" call will triget not at the start of cast, but somwhere in the middle, AFTER the hit), but most of them can be solved.

It is for you to decide how you will handle it, but the more accurate you want it to be, the more complicated it will become. Moding DoS is more like developing..

Last edited by Module 003; 14/01/18 06:45 PM.
Joined: Jan 2018
B
stranger
OP Offline
stranger
B
Joined: Jan 2018
Great, thank you!

I'm going to look into that in the next days. It's an interesting idea to add a custom spell-casted-state to the game and use that.

But I still think it's strange that there is no implemented way to detect if the skill is weapon-based or cast-based. checked the API's after you told me that story scripting is the way to do it and found nothing.


Joined: Nov 2017
Location: Ukraine
apprentice
Offline
apprentice
Joined: Nov 2017
Location: Ukraine
You're welcome.

If this approach will fail, you can alway search for other.

Just came to my mind, you can try use
AttackedByObject call instead of statust apply "HIT".
It may have more options. Or some HP change calls, or smth.

gl with it =)

Joined: Mar 2018
L
apprentice
Offline
apprentice
L
Joined: Mar 2018
There is no need to script this. Just add the condition you want to the ExtraPorperties field of the Status_VenomCoating weapon the same way that every other weapon does it.

Joined: Mar 2018
L
apprentice
Offline
apprentice
L
Joined: Mar 2018
I should add, in my test it worked for the slowed condition, but I haven't rigorously tested it or anything.

Joined: Mar 2018
L
apprentice
Offline
apprentice
L
Joined: Mar 2018
I was wrong.


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