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.
NWScript: void RewardPartyItem(string sResRef, object oTarget,int bAllParty=TRUE, int nStackSize=1)
{
if (bAllParty == TRUE)
{
object oPartyMember = GetFirstFactionMember(oTarget, TRUE);
while (GetIsObjectValid(oPartyMember) == TRUE)
{
CreateItemOnObject(sResRef, oPartyMember, nStackSize);
oPartyMember = GetNextFactionMember(oTarget, TRUE);
}
}
else
{
CreateItemOnObject(sResRef, oTarget, nStackSize);
}
}
I used this to give the players some Cure Light Wounds potions as a
reward for a quest.
|