Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2009, 12:46 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default Trying to Create a Summonitem Proxy

I am looking to create a NPC that acts as a #summonitem proxy. I want to keep my players access limited to the default commands, and not give them access to any special commands. Since they have #itemsearch by default I would like to create an NPC that allows them to recieve an item of their choice by saying to him the item ID number. Once I get the basic event down I was thinking of turning it into some sort of quest with a handin and then he gives you the option to have him summon you any item in the game. Or just sticking him in a really hard location to get to. Not sure yet...

Example:

Code:
Player: Hail "NPC"

NPC: What [item] do you seek?

Player: I seek item 12345

NPC: Here is your item
I have searched the wiki quest info and also looked through a bunch of quests on the forums but cannot find anything with an example of a dynamic say event.

How do I make it so the NPC reads the item number that the player says and summons the item for the player?

quest::summonitem("12345") - would be the static way

$say = player text
quest::summonitem("$say") - dynamic way
Reply With Quote
  #2  
Old 07-13-2009, 01:47 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

I should start by saying that I have limited experience with perl or regular expressions.

Something like that, but instead of using quotations:
Code:
$say = player text
quest::summonitem("$say");
It should be:
Code:
quest::summonitem($say);
You could simply enough have it check if the string the player said was an integer and then summon that. I think that would be the following:
Code:
if($text=~/\d{1,6}/) {
quest::summonitem($text);
}
Someone who has more regex experience than me should double check that, but I think that strips everything except for the integer digits (minimum 1 digit, max 6).

edit: not sure what would happen if someone said for example '10061 13001', I think it might call summonitem(10061 13001) which should return an error. Also, you probably want to check the return value of summonitem (if it has one) and see if it found the item or not, if not the npc could say that there was no item found.
Reply With Quote
  #3  
Old 07-13-2009, 01:54 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

It would be 10x easier just to lower the status requirement for summon item instead. You can change the command's status individually to suit your needs, meaning you can give them access to just summon item if you like. I configure mine in command.cpp but I believe if you are using current EQEMU code, you can simply change the status in the database.

It is either in the rules table or there is a table called commands that lists these status levels in your database. The default status level for a player is 10 so change it to 10 and you're good to go.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #4  
Old 07-13-2009, 03:13 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Thanks pyfon for the reply. I will see what I can do with your suggestion.

Yeormon, I know I can just change the command in the DB but whats the fun in that. At least this way I can give players the ability to summon items but I can control it a bit more than just giving them the command.

I could create this into a quest where they have to do a turn in in order to be able to summon one item of thier choice. Or have the NPC spawn on the death of a very high level raid encounter.

I was trying to get a bit creative with it. This way the players will have to work for it, but it is still obtainable.

Just giving out #summonitem to everyone can ruin the game for someone fast. But if you have a character that you maxed out, and you finally can get to the NPC then you have earned it!
Reply With Quote
  #5  
Old 07-13-2009, 03:30 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Ok this works but I need to polish the quest a bit since it returns the following after everything you say to the npc even hails. But I just wanted to see if the item summon funtion works before I ironed out the details and it does.

Code:
No such item: 0
Code:
#############
#Written By : Cubber
#Quest Name: #summonitem proxy
#Quest Zone: Cshome
#Quest NPC: Krakskull
#################
sub EVENT_SAY
{
   if($text=~/Hail/i)
      {
         quest::say("Hello there $name,  Need some [items summoned]?");
      }
if ($text=~/items summoned/i)

                        {
                                quest::say("In order for me to summon an item for you I need to know it's ID number.  Please do a #itemsearch itemname and just tell me the number next to the item.");
                        }

                                if ($text=~/\d{0,9}/)
                                        {
                                                quest::summonitem("$text");     
                                        }


}
This successfully summons the item into your players cursor.

Thanks for the help pfyon!
Reply With Quote
  #6  
Old 07-13-2009, 03:43 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

You could replace the if statements after the first one with elsif statements. It's what I do whenever I work on quests unless I need it to check the text more than once separately.

The way I figure, if someone says (for example) "hail items summoned", I only want the hail text, not both the hail and items summoned. It also reduces server load (slightly) by not needing to evaluate every if, it just stops when something evaluates true.

This would keep the number checking code from being executed when they say hail or items summoned, which is a start. Other stuff would still trigger it though.
Reply With Quote
  #7  
Old 07-13-2009, 03:35 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

I should also note that someone who says '1some2thing som3et45hing' might get it picked up as id 12345, I suggest you look up perl regular expressions on google and do some testing.
Reply With Quote
  #8  
Old 07-13-2009, 03:39 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Yup I will have to fix the script to get rid of the errors and to make it a bit cleaner like you say. Just wanted to figure out if it was possible or not first, and ... well ... it looks like it is!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:13 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3