diff --git a/Changelog.txt b/Changelog.txt index 356b091e2..7851b5d90 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3789,3 +3789,6 @@ Added: 'H' shortcut for variables to get the value as hexadecimal. 25-06-2024, Nolok - Fixed: LASTUSED, LASTDISCONNECTED, TIMESTAMP being interpreted as a number with a different base (seconds or tenths of seconds or milliseconds) in different contexts. Now they expect in scripts only values in seconds. - Fixed: crash when moving a char in an area full of teleporters, or whichever items made the char move multiple times in the same tick. + +26-06-2024, Jhobean +- Changed: @NPCRESTOCK References modification. Now SRC:Server I:NPC (Before it was always server) diff --git a/src/game/chars/CCharNPC.cpp b/src/game/chars/CCharNPC.cpp index 6b9a476c7..347111caf 100644 --- a/src/game/chars/CCharNPC.cpp +++ b/src/game/chars/CCharNPC.cpp @@ -282,22 +282,21 @@ void CChar::NPC_LoadScript( bool fRestock ) CCharBase * pCharDef = Char_GetDef(); - // 1) CHARDEF trigger - if ( m_pPlayer == nullptr ) // CHARDEF triggers (based on body type) - { - CChar * pChar = this->GetChar(); - if ( pChar != nullptr ) - { - CUID uidOldAct = pChar->m_Act_UID; - pChar->m_Act_UID = GetUID(); - pChar->ReadScriptReducedTrig(pCharDef, CTRIG_Create); - pChar->m_Act_UID = uidOldAct; - } - } - //This remains untouched but moved after the chardef's section - if ( fRestock && IsTrigUsed(TRIGGER_NPCRESTOCK) ) - ReadScriptReducedTrig(pCharDef, CTRIG_NPCRestock); - + CChar * pChar = this->GetChar(); + if (pChar != nullptr) + { + // 1) CHARDEF trigger + if ( m_pPlayer == nullptr ) // CHARDEF triggers (based on body type) + { + CUID uidOldAct = pChar->m_Act_UID; + pChar->m_Act_UID = GetUID(); + pChar->ReadScriptReducedTrig(pCharDef, CTRIG_Create); + pChar->m_Act_UID = uidOldAct; + } + //This remains untouched but moved after the chardef's section + if ( fRestock && IsTrigUsed(TRIGGER_NPCRESTOCK) ) + pChar->ReadScriptReducedTrig(pCharDef, CTRIG_NPCRestock); + } CreateNewCharCheck(); //This one is giving stats, etc to the char, so we can read/set them in the next triggers. }