From b417e23d977285610664d43bd696d53a3cbf35eb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 31 Oct 2014 00:02:05 -0400 Subject: [PATCH] Allow to set/del qglobals in encounters scripts --- zone/questmgr.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 90f0d370d..7757d0a70 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1290,9 +1290,9 @@ void QuestManager::signal(int npc_id, int wait_ms) { void QuestManager::setglobal(const char *varname, const char *newvalue, int options, const char *duration) { QuestManagerCurrentQuestVars(); - int qgZoneid=zone->GetZoneID(); - int qgCharid=0; - int qgNpcid = owner->GetNPCTypeID(); + int qgZoneid = zone->GetZoneID(); + int qgCharid = 0; + int qgNpcid = owner ? owner->GetNPCTypeID() : 0; // encounter scripts don't have an owner /* options value determines the availability of global variables to NPCs when a quest begins ------------------------------------------------------------------ @@ -1410,9 +1410,9 @@ void QuestManager::targlobal(const char *varname, const char *value, const char void QuestManager::delglobal(const char *varname) { QuestManagerCurrentQuestVars(); - int qgZoneid=zone->GetZoneID(); - int qgCharid=0; - int qgNpcid=owner->GetNPCTypeID(); + int qgZoneid = zone->GetZoneID(); + int qgCharid = 0; + int qgNpcid = owner ? owner->GetNPCTypeID() : 0; // encounter scripts don't have an owner if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved qgCharid=initiator->CharacterID();