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


Code
IF
ObjectFlagSet("HEA_DBG_GiveGold", _Player, _ID)
AND
DB_HEA_DBG_GoldGiven(_Player, _Count)
AND
_Count < 5000
AND
IntegerSum(_Count, 250, _Sum)
THEN
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.

Shadow Over Moonglow - Standalone campaign (WIP)

The Noisy Crypt
(also on Nexus)