You have the right idea with database entries - you would need to add/delete to modify a database with the same key signature.

For your IntegerSum call, you probably did not call it as a query in your IF/AND block but rather tried to execute it in your THEN block. Anything with an output variable needs to be part of the IF/AND block.

Here is a little example code that actually exemplifies both of your questions. In this frame when a certain flag is set, the player is given 250 gold but the amount of gold given to any player is capped at 5000

ObjectFlagSet("HEA_DBG_GiveGold", _Player, _ID)
DB_HEA_DBG_GoldGiven(_Player, _Count)
_Count < 5000
IntegerSum(_Count, 250, _Sum)
CharacterAddGold((CHARACTERGUID)_Player, 250);
ObjectClearFlag(_Player, "HEA_DBG_GiveGold", _ID);
NOT DB_HEA_DBG_GoldGiven(_Player, _Count);
DB_HEA_DBG_GoldGiven(_Player, _Sum);

Last edited by Windemere; 11/06/19 11:58 PM.

DOS2 Mods: Happily Emmie After and The Noisy Crypt

Steam Workshop
Nexus Mods