quick question
Posted: Wed Jul 26, 2006 6:01 am
the wording for the return() function in the lexicon is a bit confusing to me. I assume when its run in a script it stops said script.
but im realy not sure

Code: Select all
// This function gets the gold of a player and calculates the new gold value to set.
int GetNewGold(object oPlayer, int iGoldMult)
{
// Get how much gold the player has
int iGold = GetGold(oPlayer);
// Get how much he should end up with
int iGoldFinal = (iGold * iGoldMult);
// Get how much gold to add
int iGoldToAdd = (iGoldFinal - iGold);
return iGoldToAdd;
}
void main()
{
// Get the PC in the conversation
object oPC = GetPCSpeaker();
// create a random reward from 1 - 3 times the current gold value
int iReward = (Random(2) + 1);
//Use the above function to find how much gold the player should be given
int iAddGold = GetNewGold(oPC, iReward);
//adds the reward
GiveGoldToCreature(oPC, iAddGold);
}