server icon indicating copy to clipboard operation
server copied to clipboard

🐛 npcUtil.popFromQM doesn't work with DYNAMIC_LOOKUP definition.

Open Xaver-DaRed opened this issue 3 years ago • 4 comments

  • [x] I have paid attention to this example and will edit again if need be to not break the formatting, or I will be ignored
  • [x] I have searched existing issues to see if the issue has already been opened, and I have checked the commit log to see if the issue has been resolved since my server was last updated
  • [x] I have read and understood the Contributing Guide

Branch affected by issue

base

Steps to reproduce

As an example

!pos 488 -1 166 54 (Arrapago reef qm1 pos) !additem 2601 (pop item for Lil'Apkallu)

Trade the item we just added to the ??? we just warped to. The NM won't pop. Map log will return the following:

imagen

Expected behavior

I have no expectations, as in, I dont know if we should adjust the function or use a different (existing) method completely and deprecate the existing popFromQM.

Xaver-DaRed avatar Jul 30 '22 18:07 Xaver-DaRed

Betting money you're setting your ID local to the scripts/zone/IDs.lua

That doesn't pull the cached value, so need to require zones[<zone_ID>]

claywar avatar Jul 30 '22 18:07 claywar

Well, not like "I" am. This is on a fresh untouched build.

Xaver-DaRed avatar Jul 30 '22 18:07 Xaver-DaRed

This is more of a shift that needs to be made with dynamic lookups. We can't look at the file, because the values are changed at runtime. Instead, have to look at the resulting cached value. Songbirds in a Snowstorm was the first time I ran into this. Resolved by:

local pastBeaucedineID = zones[xi.zone.BEAUCEDINE_GLACIER_S]

as opposed to requiring the IDs.lua

This doesn't look like a problem with the function, but rather what is being passed into the function.

claywar avatar Jul 30 '22 18:07 claywar

@claywar I have tested your fix related to this issue and it does correct this problem but creates another.

If you are to restart the server after making direct LUA change, this will again repeat the same error if the local is outside of the function for spawning a ZNM (Referencing a QM NPC)

If you place the local within the entity.onTrade = function this will correct the issue and return the proper Zone ID

N3ckB3ard avatar Aug 28 '22 06:08 N3ckB3ard