Jump to content
  • 0

Function and OnBuyItem


Mechomorph XD

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   1
  • Joined:  03/06/12
  • Last Seen:  

Hello, I have problem again :P

I'm doing function which this function will call from item.

1234,ITEM,...... { callfunc "Hello"; }

So that function have menu shop, It's will call shop before select menu already.

And problem is I'm add OnBuyItem event in function but Map-Server noticed error.

[Error]: npc_event: event not found [FAKE_NPC::OnBuyItem]

How to do that? or Who have idea about call npc from item?

Thank You.

Oh, Forget

this some part of my function

mes "x";

callshop "x",1;
npcshopattach "x";
close;

I'll want the player buy item and before that goto on OnBuyItem event.

Edited by Mechomorph XD
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

It is already saying that, the function is like a FAKE NPC, try changing the function into a floating script and use doevent.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   1
  • Joined:  03/06/12
  • Last Seen:  

I can do it. Thank You :P

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

instead of using the function calling method....you can use these

*donpcevent "{NPC NAME}::<event label>";


This command invokes the event label code within an another NPC or NPCs. If
event label has the form "NpcName::OnLabel", then only given NPC's event label
will be invoked (much like 'goto' into another NPC). If the form is "::OnLabel"
(NpcName omitted), the event code of all NPCs with given label will be invoked,
one after another. In both cases the invoked script will run without an attached
RID, whether or not the invoking script was attached to a player. The event
label name is required to start with On.

*doevent "<NPC object name>::<event label>";


This command will start a new execution thread in a specified NPC object at the
specified label. The execution of the script running this command will not stop.
No parameters may be passed with a doevent call.
The script of the NPC object invoked in this manner will run as if it's been
invoked by the RID that was active in the script that issued a 'doevent'.

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