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 03-10-2009, 04:10 PM
Aldest
Sarnak
 
Join Date: Feb 2009
Location: Georgia
Posts: 69
Default Using Or

I'm trying to get a good grasp on item turn ins and I basically wanted to take the jboots example and go from AND to OR.

More or less I want to allow players to turn in hate/fear plate armor and get a token. Now I could create 40 different ifs for plate or couldn't I just do this?

Code:
sub EVENT_ITEM
	if ($faction >= 4) {
 {
  if(($itemcount{4861}) || ($itemcount{4862})  || ($itemcount{4863}) || ($itemcount{etc}) || ($itemcount{etc}) || ($itemcount{etc}) || ($itemcount{etc}) || ($itemcount{etc}))
     {
    quest::emote("takes the armor and offers you a figurine.");
    quest::say("Excellent! As promised, here is your figurine.");
    quest::summonitem("2493"); #Heavy Knight
    quest::exp(5000);
    quest::faction(485,5); # Elysian Wanderers
     }
  }
More or less if you're amiable or greater you can turn in any of those items and get the reward. Is this correct?

Also, this is more obscure but is there a way to cap how many times you can get the faction gain from this? would you do an if inside the if?
Reply With Quote
  #2  
Old 03-11-2009, 10:25 AM
Aldest
Sarnak
 
Join Date: Feb 2009
Location: Georgia
Posts: 69
Default Well

Alright, so that didn't quite work! Any thoughts on this?

Code:
sub EVENT_ITEM 
	{
 		 if($item1 == 4861 || 4862 || 4863 || 4864 || 4865 || 4866 || 4867 || 4911 || 4912 || 4913 || 4914 || 4915 || 4916 || 4917 || 4881 || 4882 || 4883 || 4884 || 4885 || 4886 || 4887 || 4851 || 4852 || 4843 || 4854 || 4855 || 4856 || 4857 || 4841 || 4842 || 4843 || 4844 || 4845 || 4846 || 4847)
    	 {
    quest::emote("takes the armor and offers you a figurine.");
    quest::say("Excellent! As promised, here is your figurine.");
    quest::summonitem("2493"); #Heavy Knight
    quest::exp(5000);
    quest::faction(485,5); # Elysian Wanderers
     	}
     }
Reply With Quote
  #3  
Old 03-11-2009, 12:11 PM
realityincarnate
Developer
 
Join Date: Dec 2007
Posts: 122
Default

That way won't work, you'd need to write the much more tedious method of:
Code:
 if (($item1 == 4861) || ($item1 == 4862) || ($item1 == 4863) || etc...
Since most of the items you're looking at are in a sequence, you might try something like:
Code:
 
if ( (($item1 >= 4861) && ($item1 <= 4867)) || (($item1 >= 4911) && ($item1 <= 4917)) ) {
for each set of items to cut down on the work.
Reply With Quote
  #4  
Old 03-11-2009, 03:14 PM
Aldest
Sarnak
 
Join Date: Feb 2009
Location: Georgia
Posts: 69
Default

OKay thank you so much!

I'm glad at least my logic was in the right place. It is tedious but much less so than doing an entire if for every piece.

I'll change my code to the && version and let you know!
Reply With Quote
  #5  
Old 03-11-2009, 10:20 PM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

You could make an array of the turn-in items and loop through them. Something like this should work for you.

Code:
@items = (1001, 1002, 1003, 1004, 1005); 

sub EVENT_ITEM {
   my $accepted_items = 0;

   foreach (@items) {
      if($itemcount{$_} == 1) ++$accepted_items;
   }

   if ($accepted_items > 0) {
      quest::summonitem(1006);
   } else {
      plugin::return_items(\%itemcount);
   }
}
Reply With Quote
  #6  
Old 03-12-2009, 06:20 PM
Aldest
Sarnak
 
Join Date: Feb 2009
Location: Georgia
Posts: 69
Default

Thank you all for the advice!

I've now got it working with reality's idea. That is a load off my mind. I'm down to just getting one more quest npc in and figuring out how to lock them to a faction.
Reply With Quote
Reply


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 01:17 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3