Jump to content
  • 0

Instance problem: event not found


chriser

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

Hi guys,

 

I wanted to launch my new dungeon on my server today, but when people went into it, every mob which called an OnKill label triggered an error saying:

[01:43:29][Error]: npc_event: event not found [dup_1_110050525::OnKill]

I removed the dungeon from my live server then, and tested it again on my test server, and I do not understand the following results:

We tested the dungeon by killing the mobs with @killmonster and everything worked fine. But now, when the player kills a mob by himself, the error above occurs.

What I then tested surprised me any more...

First, I did the following:

donpcevent instance_npcname(strnpcinfo(0))+"::OnKill";

Which did what I expected: Trigger the OnKill Label. I tought i must be wrong somewhere, when I tested this...

getpartymember 'partyid,2;
attachrid $@partymemberaid[0];
doevent instance_npcname(strnpcinfo(0))+"::OnKill";

This bastard throws the error above. So basically, when there is a RID attached to the kill, the OnKill can not be found, but when there is no RID attached, it works? Am I missing something stupid or is this a bug?

(I think this snippet should be enough http://pastebin.com/ygRfyJgZ you can be sure that all variables are set right and everything works, except the stuff above...)

And btw: Both labels were exact the same when I displayed them. Both times the exact same event was called, but with a RID attached, the event could not be found.

Edited by chriser
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   3
  • Joined:  03/09/12
  • Last Seen:  

Sounds like you're forgetting the instance_id() within your donpcevent commands.

 

try donpcevent instance_npcname(strnpcinfo(0), instance_id())+"::OnKill";

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

Why do I have to add the instance_id, if instance_npcname already uses the instance_id which is attached?

And this is not the problem, the problem is that it works with donpcevent, but not with doevent and an RID attached. I thought I made that clear.

(the whole EndlessTower script does not use a single instance_id())

Edited by chriser
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   3
  • Joined:  03/09/12
  • Last Seen:  

Ah, I apologize, I overlooked that.

 

Looking at your third snippet, why are you trying to use an account id instead of a character id for attaching the RID?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

The RID is the account id, and not the charid. http://rathena.org/wiki/Attachrid

 

And the stuff I postet is only the representation what happens when using @killmonster to kill the mobs or killing them normally.

 

@killmonster equals using donpcevent <kill label>, because no RID is attached (and it works)

killing the monster normally equals attachrid and doevent <kill label>, because a RID is attached (and it does not work)

 

My problem has nothing to do with the code I posted. My problem is that the Kill label doesn't get found when a RID is attached. 



finally fixed it, but someone who knows stuff better should look at that, because this is really hacky...

First of all what I found out:

/*==========================================
 * NPC processing event type
 *------------------------------------------*/
int npc_event(struct map_session_data* sd, const char* eventname, int ontouch)
{
	struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname);
	...
}

if the event is an instanced duplicated one (e.g. dup_1_11009906), this code gets NULL as event data, when the event would be dup_1_11009906::OnKill

what i did was the following:

static int npc_event_sub2(DBKey key, DBData *data, va_list ap)
{
	const char* p = key.str;
	struct event_data* ev, **rev;
	int* c;
	const char* name;

	nullpo_ret(ev = db_data2ptr(data));
	nullpo_ret(name = va_arg(ap, const char *));
	nullpo_ret(rev = va_arg(ap, struct event_data**));
	if( p && strcmpi(name, p) == 0 )
	{
		*rev = ev;
		return 1;
	}


	return 0;
}
/*==========================================
 * NPC processing event type
 *------------------------------------------*/
int npc_event(struct map_session_data* sd, const char* eventname, int ontouch)
{
	struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname);
	if(ev == NULL)
		ev_db->foreach(ev_db,npc_event_sub2,eventname,&ev);
	...
}

So I iterated over the ev_db, found the event with the eventname and put the event into the pointer &ev, where I then have the event_data for the event  dup_1_11009906::OnKill

This works for my code posted here, where no error exists.

Akinari also told me a solution (with which i was not satisfised) to just add Global to the event label, which worked too. But it was not acceptable for me that there is an ugly Global on each of my kill labels, so I made some overtime and now I have this.

 

So please have a look at this @devs, I think this could be a really nasty bug or sth...

 

Edit: Can somebody explain what #dandelion_duplicates is? this npcname showed up multiple times when displaying some npc names of events with a player attached.

Edited by chriser
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Well, for troubleshootings sake, instead of

instance_npcname(strnpcinfo(0))+"::OnKill";
USE
instance_npcname(strnpcinfo(3))+"::OnKill";

I say this, because I can't reproduce your problem. I was just testing a similar feature involving a monster Event label in an instance and it worked fine.

Although I must say that, I do not specify instance_npcname( strnpcinfo(3) ), I actually type out the full npc name. This has resulted with 0 errors.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

Hmm okay, I will test this in the next days, because of now, my instance works with the modified npc_event.

does strnpcinfo(3) return the REAL unique name (generated by the scripting system) or does it return only the stuff after :: (which would be nothing in my case)?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

It should return the ' real ' unique name, because when used with an npc named:   test

it strnpcinfo(3) would show test, the same as strnpcinfo(0). This is to say, that if there is ANY hidden information regarding the npc's naming, it should detect it. This should hold true for NPCs that have been renamed by the server due to duplicate names.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

Okay, I will have a look at it.

Nevertheless it's still am mystery how

strdb_get(ev_db, eventname);

does not get the right event_data, but iterating over the ev_db and checking if the key == eventname finds the right one.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...