//There are already functions to give the party gold or XP, but I could not find one to give each player an item, so I modified the Gold one like so:
//
//What it does: Gives every PC in the party an item or a stack of items

Params:
sResRef - the ResRef of the object
oTarget - a PC.
bAllParty - if true, everyone in the party gets the item, otherwise, just the target get it.
nStackSize - the number of items to give each target.




void RewardPartyItem(string sResRef, object oTarget,int bAllParty=TRUE, int nStackSize=1)
{
// * for each party member
// * cycle through them and
// * and give them the appropriate reward
// * HACK FOR NOW
if (bAllParty == TRUE)
{
object oPartyMember = GetFirstFactionMember(oTarget, TRUE);
while (GetIsObjectValid(oPartyMember) == TRUE)
{
//AssignCommand(oPartyMember, SpeakString("MY GP reward is: " + IntToString(GP)));
CreateItemOnObject(sResRef, oPartyMember, nStackSize);
//GiveGoldToCreature(oPartyMember, GP);
oPartyMember = GetNextFactionMember(oTarget, TRUE);
}
}
else
{
CreateItemOnObject(sResRef, oTarget, nStackSize);
//GiveGoldToCreature(oTarget, GP);
}
}





I used this to give the players some Cure Light Wounds potions as a reward for a quest.