Jump to content
  • 0

npc trigger area dependant if an item is held


Elyn

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  07/27/13
  • Last Seen:  

So i want to make it so that if a player is carrying a specific item, in this case an I.D. card, then specific npc's won't initiate dialogue with that character in the trigger area. If they aren't then diologue is started. How would i do this?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   4
  • Joined:  07/10/13
  • Last Seen:  

Let me get it though, sorry. Just to elaborate,

 

so for example id number 

 

4359 (Assassin Cross Card)

Will it be checked if it was equipped or will it be checked if its in the inventory?

 

This is possible but the structure of the complete script i'm not sure of as I am just starting to do scripting but don't worry i'm just trying to make things clear. I would also like to share my thoughts about this once I got the point clear I might be able to do the script and maybe someone would help us as well develop it.

 

Thanks!

Edited by redhotzip
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:  

Quite simple really, first off, just create an NPC that i triggered when a person walks within range of it.

<map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}

Then we edit the code to filter out when to activate. Whether it be when someone clicks on it or comes in range. In this case I'll do both, so that clicking an NPC will result in a different dialogue then when within range.

<map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{
mes "NPC Name";
mes "This is what will appear when someone clicks on me.";
close;
OnTouch: //This is triggered when a player walks in the trigger range of the NPC.
if ( countitem(<item id>) ) //This will check to see if the player has the item in his/her inventory.
    {end;} // If they do, it will end the script resulting in nothing happening. Otherwise it will continue down the script and trigger the dialogue.
mes "NPC Name";
mes "This is what will appear when someone walks within range of me, and does not have the item: "+ getitemname(<item id>) +" in their inventory.";
close;}

And that is all that needs to be done. Hope this solves your problem.

  • Upvote 2
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...