PWSetMinLocalIntAndJournalForItemAcquired(string, string, int, string, int)

Based on acquiring an item, this function sets a local integer variable for all players in a group, awards XP, and sets a journal entry.

void PWSetMinLocalIntAndJournalForItemAcquired(
    string sVarName,
    string sJournalTag, 
    int nState, 
    string sItemTag,
    int nExperience
);

Parameters

sVarName

The string used to reference the integer on the player character.

sJournalTag

The tag of the journal category (case sensitive).

nState

The value used for the journal entry and local variable.

sItemTag

The tag of the item used to check against for journal updates.

nExperience

The amount of XP to award to the PC and party members.


Description

Based on acquiring an item, this function sets a local integer variable for all players in a group, awards XP, and sets a journal entry.



Remarks

Persistent worlds beware! This function uses GetModuleItemAcquired to determine the item to work with. Be aware that if another player triggers the OnAcquiredItem event, you could end up working with the wrong item. The chance of this happening is slim, but theoretically possible.

If the tag of the item returned by GetModuleItemAcquired does NOT match sItemTag, then this function ends without any actions being done.

The journal entry, sJournalTag, is updated on the player that has the item returned by GetModuleItemAcquired. The call to AddJournalQuestEntry has the last three parameters set to: TRUE, FALSE, FALSE. This results in the journal entry being added to all members of the player's party. If sJournalTag is an empty string (""), then no journal entry is updated.

Next, the local integer named sVarName is checked on each player in the group. If the player's saved value for sVarName is less than nState, then the local integer is updated to nState on that player. Also the player is given nExperience through a call to GiveXPToCreature. The XP is only awarded if the local integer was updated.


Requirements

#include "nw_i0_plotwizard"


Version

???

See Also

functions:  AddJournalQuestEntry | GetModuleItemAcquired | PWSetMinLocalIntAndJournalForOpenerParty | SetLocalInt
categories:  Experience Functions | Journal Functions


author: Baragg, editor: Mistress