I made a script yesterday for what sounds similar to what you're trying to do, maybe you can use this as a base. When talking to an NPC, it checks if you have at least 100 gold and if so it sets a hasMoney flag on the player and gives the NPC 100 of your gold.
IF
(whatever condition)
AND
CharacterGetGold(_Player,_Gold)
AND
_Gold > 99
THEN
ObjectSetFlag(_Player, "hasMoney");
Proc_GiveNPCGold(_Player,CHARACTERGUID_npcVendor_f8a54b4d-d096-4f42-a3a7-2a23d851ae26,100);
Then tell the dialog node to check for hasMoney flag.
A big tip that helped me a lot - if you struggle with getting a script to work, open up the Origins story and look at Larian's scripts. Go to the script editor and ctrl+shift+f and search for the command you want to use, say CharacterGetGold. Then you get examples of how Larian did it, you can see the context and then adapt it into your own script.
And yes the editor is real pain (esp the scripting) and not very user friendly.