PWSetMinLocalIntAndJournalForOpenerParty(string, string, int, int)
Based on opening an object, this function sets a local integer variable for all players in a group, awards XP, and sets a journal entry.
void PWSetMinLocalIntAndJournalForOpenerParty( string sVarName, string sJournalTag, int nState, 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.
nExperience
The amount of XP to award to the PC and party members.
Description
Based on opening an object, this function sets a local integer variable for all players in a group, awards XP, and sets a journal entry.
Remarks
Attempts to find the player object by calling (in this order): GetLastOpenedBy, GetLastUnlocked and GetLastKiller. The first of those to return an object other than OBJECT_INVALID is the object that is used as the player (oPC) for the rest of the function.
If no valid player is found, then this function ends without any actions being done.
Persistent worlds beware! If another player triggers one of the above functions, you could end up working with the wrong player. The chance of this happening is slim, but theoretically possible.
The journal entry, sJournalTag, is updated on the player. 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 group. If sJournalTag is an empty string (""), then no journal entry is updated.
After a valid player object is found, each player in the group is checked for a local integer named sVarName. 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 | GetLastOpenedBy | GetLastUnlocked | GetLastKiller | PWSetMinLocalIntAndJournalForItemAcquired | SetLocalInt |
categories: | Journal Functions | Experience Functions |
author: Baragg, editor: Mistress