GiveGoldToCreature(object, int)

Creates the specified amount of gold on the creature.

void GiveGoldToCreature(
    object oCreature,
    int nGP
);

Parameters

oCreature

Creature set to receive the windfall.

nGP

Amount of gold to give to oCreature.


Description

Give nGP gold to oCreature.



Version

1.61

Example

//Put OnClientEnter of the module's properties
//to have all PCs start out with exactly 500 gold pieces

void main()
{
object oPC=GetEnteringObject();

//Make sure it only happens on the first entry of the player
if (GetLocalInt(oPC, "gold_reset")) return;

SetLocalInt(oPC, "gold_reset", TRUE);

//How much gold does the PC already have?
int nGold=GetGold(oPC);

//Too much, too little, or just enough?
if (nGold>500)
   {
   //Too much!
   AssignCommand(oPC, TakeGoldFromCreature(nGold-500, oPC, TRUE));
   }
else if (nGold<500)
   {
   //Too little!
   GiveGoldToCreature(oPC, 500-nGold);
   }
}

See Also

functions: GetFactionGold | GetGold | GetGoldPieceValue | RewardPartyGP | TakeGoldFromCreature
categories: Action on Object Functions | Money Functions


 author: Jody Fletcher, editor: Lilac Soul
 Send comments on this topic.