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 10-13-2011, 06:09 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default Suggestions for Quest Shortcuts?

I am interested in learning a shortcut or two. Let me describe what I have...

A quest npc hands Neriak tokens of 4 different grades equal to the number of skulls turned in. 1 skull = copper token, 2 skulls = silver token, etc.

Another quest npc accepts these tokens for faction. I know I could combine it all and skip a step - faction for skulls, but I wanted something a little more complex.

This shortcut issue is this: with a turn in of say copper tokens, the quest npc hands out faction. However, she hands it out if the turn-in is 1 token or 4 (using the =>1 ). I would like to use some form of command that allows a multiplicative quest reward. Double reward for two tokens, triple for three, etc.

Here is my current second-stage npc - I only included the pertinent part, she has another turn-in quest of her own as well:

Code:
elsif ($itemcount{1804} => 1){
    quest::faction(69,5);
    quest::faction(70,5);
    quest::faction(87,5);
    quest::faction(88,5);
    quest::faction(117,5);
    quest::faction(137,5);
    quest::faction(155,5);
    quest::faction(177,5);
    quest::faction(256,5);
    quest::faction(260,5);
    quest::faction(268,5);
    quest::faction(322,5);
    quest::faction(331,5);
    quest::exp(4000);
    quest::ding;
	quest::say("I see you have been skulking about for Noble Villifar. You are wise to aid us and your effort shall not go unnoticed, $name.");	
	quest::givecash("0","0","8","0");	
}

elsif ($itemcount{1805} => 1){
    quest::faction(69,10);
    quest::faction(70,10);
    quest::faction(87,10);
    quest::faction(88,10);
    quest::faction(117,10);
    quest::faction(137,10);
    quest::faction(155,10);
    quest::faction(177,10);
    quest::faction(256,10);
    quest::faction(260,10);
    quest::faction(268,10);
    quest::faction(322,10);
    quest::faction(331,10);
    quest::exp(6000);
    quest::ding;
	quest::say("I see you have been skulking about for Noble Villifar. You are wise to aid us and your effort shall not go unnoticed, $name.");	
	quest::givecash("0","0","8","0");	
}

elsif ($itemcount{1806} => 1){
    quest::faction(69,15);
    quest::faction(70,15);
    quest::faction(87,15);
    quest::faction(88,15);
    quest::faction(117,15);
    quest::faction(137,15);
    quest::faction(155,15);
    quest::faction(177,15);
    quest::faction(256,15);
    quest::faction(260,15);
    quest::faction(268,15);
    quest::faction(322,15);
    quest::faction(331,15);
    quest::exp(8000);
    quest::ding;
	quest::say("I see you have been skulking about for Noble Villifar. You are wise to aid us and your effort shall not go unnoticed, $name.");	
	quest::givecash("0","0","8","0");	
}

elsif ($itemcount{1807} => 1){
    quest::faction(69,20);
    quest::faction(70,20);
    quest::faction(87,20);
    quest::faction(88,20);
    quest::faction(117,20);
    quest::faction(137,20);
    quest::faction(155,20);
    quest::faction(177,20);
    quest::faction(256,20);
    quest::faction(260,20);
    quest::faction(268,20);
    quest::faction(322,20);
    quest::faction(331,20);
    quest::exp(10000);
    quest::ding;
	quest::say("I see you have been skulking about for Noble Villifar. You are wise to aid us and your effort shall not go unnoticed, $name.");	
	quest::givecash("0","0","8","0");	
}
In this, 4 different items (1804, 1805, 1806 and 1807) produce a faction result. How would I go about scaling the reward to the number turned in without resorting to 4 entries for each item (16 total entries)? Or is that possible?

I know I could use 1804 == 1
1804 == 2
1804 == 3
1804 == 4

There an easier way?
Reply With Quote
  #2  
Old 10-13-2011, 08:45 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

Remember that Perl and such are used outside of Eqemu, so the more you know how to program the more you can do. What you are thinking of are variables and what you might be interested in are arrays.

Code:
sub EVENT_ITEM
{
	my @factions = (69,70,87,88,117,137,155,177,256,260,268,322,331);
	my @items = (1804,1805,1806,1807);
	my $base_value = 5;
	my $base_exp = 2000;
	my $exp_multi = 2;
	foreach $item(@items) {
		my $item_count = $itemcount{$item};
		if($item_count) {
			foreach $faction(@factions) { quest::faction($faction,($base_value*$item_count)); }
			quest::exp($base_exp*$exp_multi);
			quest::ding;
			quest::say("I see you have been skulking about for Noble Villifar. You are wise to aid us and your effort shall not go unnoticed, $name.");	
			quest::givecash("0","0","8","0");	
		}
		$base_value += 5;
		$exp_multi++;
	}
}
Reply With Quote
  #3  
Old 10-13-2011, 10:16 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default

Awesome, yes!

Thanks, it will take me several days to work my mind around the structure, but this is perfect.
Reply With Quote
  #4  
Old 10-14-2011, 12:54 PM
Emmeric
Sarnak
 
Join Date: Aug 2011
Posts: 72
Default

That worked wonderfully. In fact, I ended up combining her other quest into it because this was more efficient.

However, I experimented with different ways to return unwanted items.

Code:
else {
  plugin::return_items(\%itemcount);
      return 1;
 }
This doesn't seem to work within the scope of the newer set-up. In fact, the quest doesn't work at all if this is inserted into the sub event_item.

I tried inserting it after the if argument within the foreach and even after the foreach, but no luck. Is there a different command when using these different arguments?

Something like if itemcount (does not equal?) @items...
Reply With Quote
  #5  
Old 10-14-2011, 09:01 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

You should probably google "perl tutorial" or really any basic computer logical expression explanations. If you think an else can go after a foreach(not knocking you, we all start somewhere), then its going to be really frustrating for you to attempt to get things done. Most people spend a lot of time on the DB and spells, etc... spend a fraction of that time doing perl tutorials or C++ tutorials and in a few weeks you will be shocked.

Havent tested this, but may work.

Code:
sub EVENT_ITEM
{
	my @factions = (69,70,87,88,117,137,155,177,256,260,268,322,331);
	my @req_items = (1804,1805,1806,1807);
	my %exp_rewards = (1804 => 4000, 1805 => 6000, 1806 => 8000, 1807 => 10000);
	my %faction_rewards = (1804 => 5, 1805 => 10, 1806 => 15, 1807 => 20);
	## Iterate through all items handed in	
	for my $item ( keys %itemcount ) {
		my $item_count = $itemcount{$item};
		## Compare current item with all available turn ins
		foreach my $req_item(@req_items) {
			if($item == $req_item) {
				foreach $faction(@factions) { quest::faction($faction,($exp_rewards{$item}*$item_count)); }
				quest::exp($exp_rewards{$item});
				quest::ding;
				quest::say("I see you have been skulking about for Noble Villifar. You are wise to aid us and your effort shall not go unnoticed, $name.");	
				quest::givecash("0","0","8","0");
				delete $itemcount->{$item}; ## Remove used items from itemcount
				last; ## End this loop and continue onto next handed in item
			}
		}
	}
	## Return all items that didnt get used
	plugin::return_items(\%itemcount);
}
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 09:22 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