Issue information

Issue ID
#8162
Status
Fixed
Severity
Medium
Started
Samuel
Apr 24, 2014 10:50
Last Post
pan
May 7, 2014 0:16
Confirmation
Yes (1)
No (0)

Samuel - Apr 24, 2014 10:50

@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:

[code=auto:0] 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 [/code]

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..

Dastgir Pojee - Apr 24, 2014 11:19

Confirmed..
When we do @reloadscript , [code=:0] npc->event_doall("OnInit") [/code]
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..

This post has been edited by Dastgir Pojee on Apr 24, 2014 11:30

Samuel - Apr 25, 2014 12:02

Well, hopefully, it would be fixed.. :) Duplicates should run the OnInit label as well.. :)

pan - Apr 28, 2014 22:14

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.

pan - May 7, 2014 0:15

Fixed in [url="https://github.com/HerculesWS/Hercules/commit/9a425c11b61fb6f4e299013c7d8d9841129b8f45"]https://github.com/HerculesWS/Hercules/commit/9a425c11b61fb6f4e299013c7d8d9841129b8f45[/url]