Take gold from a PC in a conversation and make sure he has enough to pay

Take gold from a PC in a conversation and make sure he has enough to Pay
This is fairly simple to do, the harder part seems to be getting the Conversation right. One thing to keep in mind when doing a conversation is that the line you donâ€™t want displayed unless a certain condition is met comes before, lets call it the Default line. Take a look at the example. +Root NPC â€“ Hello, it will be 50 gold for a slap in the face. PC â€“ Ok. Pay 50 gold. NPC â€“ You donâ€™t have enough money. PC â€“ [End Dialog] NPC â€“ Great!  PC â€“ Thanks! [End Dialog] PC â€“ No Way![End Dialog]

We donâ€™t want the line NPC â€“ You donâ€™t have enough money. to appear unless he has enough gold to pay. So thatâ€™s were we will put the check, in the "Starting Condition" of the text node.

Place this script in the "Text Appears When" hook of the text line you donâ€™t want to show unless the PC donâ€™t have enough money to pay. int StartingConditional {   object oPC = GetPCSpeaker; if(GetGold(oPC) < 50) // Set the gold amount you want. {       return TRUE; // Return TRUE if he has less than expected amount }   return FALSE; // return FALSE otherwise. (do not display text) }

If the above script is TRUE then that text node will show to the PC instead of the one below it. If it is FALSE, then the next text line will appear.

Now we need to take the gold, if he has enough. In the â€œActions Takenâ€ script handle of the NPC â€“ Greate!  text node place the following script.

//////////////////////////////////////////////////////// // Take Gold from PC //////////////////////////////////////////////////////// void main {  TakeGoldFromCreature(50, GetPCSpeaker, TRUE); } //End

This is a simple script from the script wizard. It takes 50 gold from the PC speaking to the NPC and then destroys it. If you want the NPC to keep the gold then change the TRUE to FALSE.