Issue Information
-
#008162
-
3 - Medium
-
Fixed
Issue Confirmations
-
Yes (1)No (0)
@loadnpc works well with the main npc having the oninit label, but those duplicates OnInit doesn't trigger..
So for example, I made an npc like this:
So when I use @unloadnpcfile path of that npc and use @loadnpc after (without errors in console), When I go to the main NPC and say warp, it triggers the Event..
But when I go to the duplicate npc and says warp, nothing happen.
But when I do @reloadscript, both main and duplicate will work triggering the OnInit Label..
So for example, I made an npc like this:
prontera,150,150,4 script Kriemhild#20::InsideFlagsPR2 GUILD_FLAG,{ L_Warp: message strcharinfo(0),"WoE is not Active"; end; OnRecvCastlePt01: flagemblem getcastledata("prtg_cas01",1); end; OnInit: defpattern 2,"warp","L_Warp"; activatepset 2; end; } prontera,155,133,4 duplicate(InsideFlagsPR2) Kriemhild#22 GUILD_FLAG
So when I use @unloadnpcfile path of that npc and use @loadnpc after (without errors in console), When I go to the main NPC and say warp, it triggers the Event..
But when I go to the duplicate npc and says warp, nothing happen.
But when I do @reloadscript, both main and duplicate will work triggering the OnInit Label..
Confirmed..
When we do @reloadscript ,
While on loadnpc, npc->parsesrcfile is Executed.
npc->parsesrcfile executes npc->parse_script (Which has function to call OnInit) While duplicate is parsed form npc->parse_duplicate, which does not have an function to call OnInit..
When we do @reloadscript ,
npc->event_doall("OnInit")is Executed.
While on loadnpc, npc->parsesrcfile is Executed.
npc->parsesrcfile executes npc->parse_script (Which has function to call OnInit) While duplicate is parsed form npc->parse_duplicate, which does not have an function to call OnInit..
Well, hopefully, it would be fixed.. Duplicates should run the OnInit label as well..
I could reproduce this issue but I'm not going to flag it yet because I'm not sure of the expected behavior of OnInit as our documentation isn't clear, so I'll consult the rest of the staff to determine which way it should work.
Thank you for reporting.
Thank you for reporting.