Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-13-2014, 11:17 PM
kilst87
Sarnak
 
Join Date: Dec 2008
Location: sydney
Posts: 35
Default A really messy random, timed auto-updating merchant

So I've spent too many hours trying to get this thing to work (not a coder), but I think I've finally got it.

I just want someone to look over it, point out any flaws, and maybe clean it up a little if they can be bothered. It works fine from what I can tell, I just bet it's a mess though.

Code:
#############################################################
#			Programmable Auto-Updating Merchant				#
#  This quest allows you to have a merchant whose selling	#
#  items change based on a timer. You set up a blank vendor.#
#  All the items are stored in the merchantlist_temp table.	#
#  The shouts were mainly for testing, but they would be	#
#  useful anyway.				--kilst87					#
#############################################################


sub EVENT_SPAWN{
	quest::shout("Spawned!");
	quest::settimer("random_loot_timer", 5);
	#sets the timer that triggers merchant to post/withdraw items
	
}


sub EVENT_TIMER{

my $randi = int(rand(3));
#sets $randi with a random number between 0 and 2 to decide what to sell

	if($randi == 1) {
	
	if($timer eq "random_loot_timer"){
		quest::MerchantSetItem(999219, 1111, 10000);
		quest::MerchantSetItem(999219, 1112, 10000);
		quest::MerchantSetItem(999219, 1113, 10000);
		quest::MerchantSetItem(999219, 1114, 10000);
		quest::shout("Added items1!");
		quest::stoptimer("random_loot_timer");
		quest::settimer("itemgroup_1", 10);
		}
		#sets armor, stops the first timer, and starts the second timer

	if($timer eq "itemgroup_1") {
		quest::MerchantSetItem(999219, 1111, 0);
		quest::MerchantSetItem(999219, 1112, 0);
		quest::MerchantSetItem(999219, 1113, 0);
		quest::MerchantSetItem(999219, 1114, 0);
		quest::shout("Despawning after deleting items1");
		#quest::stoptimer("itemgroup_1");
		quest::respawn(999219,0);
		}
		#removes armor, stops second timer and respawns Merchant

	}
	
	
	elsif($randi == 0) {
	
	if($timer eq "random_loot_timer"){
		quest::MerchantSetItem(999219, 2111, 10000);
		quest::MerchantSetItem(999219, 2112, 10000);
		quest::MerchantSetItem(999219, 2113, 10000);
		quest::MerchantSetItem(999219, 2114, 10000);
		quest::shout("Added items!2");
		quest::stoptimer("random_loot_timer");
		quest::settimer("itemgroup_2", 10);
		}
		#sets armor, stops the first timer, and starts the second timer
		
	if($timer eq "itemgroup_2") {
		quest::MerchantSetItem(999219, 2111, 0);
		quest::MerchantSetItem(999219, 2112, 0);
		quest::MerchantSetItem(999219, 2113, 0);
		quest::MerchantSetItem(999219, 2114, 0);
		quest::shout("Despawning after deleting items2");
		#quest::stoptimer("itemgroup_2");
		quest::respawn(999219,0);
		}
		#removes armor, stops second timer and respawns Merchant
		
	}
	
	
	elsif($randi == 2) {
	
	if($timer eq "random_loot_timer"){
		quest::shout("Selling banded armor CHEAP!!");
		quest::MerchantSetItem(999219, 3053, 10000);
		quest::MerchantSetItem(999219, 3054, 10000);
		quest::MerchantSetItem(999219, 3055, 10000);
		quest::MerchantSetItem(999219, 3056, 10000);
		quest::MerchantSetItem(999219, 3057, 10000);
		quest::MerchantSetItem(999219, 3058, 10000);
		quest::MerchantSetItem(999219, 3059, 10000);
		quest::MerchantSetItem(999219, 3060, 10000);
		quest::MerchantSetItem(999219, 3061, 10000);
		quest::MerchantSetItem(999219, 3062, 10000);
		quest::MerchantSetItem(999219, 3063, 10000);
		quest::MerchantSetItem(999219, 3064, 10000);
		quest::shout("Added items!3");
		quest::stoptimer("random_loot_timer");
		quest::settimer("itemgroup_3", 10);
		}
		#sets banded armor, stops the first timer, and starts the second timer
		
	if($timer eq "itemgroup_3") {
		quest::MerchantSetItem(999219, 3053, 0);
		quest::MerchantSetItem(999219, 3054, 0);
		quest::MerchantSetItem(999219, 3055, 0);
		quest::MerchantSetItem(999219, 3056, 0);
		quest::MerchantSetItem(999219, 3057, 0);
		quest::MerchantSetItem(999219, 3058, 0);
		quest::MerchantSetItem(999219, 3059, 0);
		quest::MerchantSetItem(999219, 3060, 0);
		quest::MerchantSetItem(999219, 3061, 0);
		quest::MerchantSetItem(999219, 3062, 0);
		quest::MerchantSetItem(999219, 3063, 0);
		quest::MerchantSetItem(999219, 3064, 0);
		quest::shout("Despawning after deleting items3");
		#quest::stoptimer("itemgroup_3");
		quest::respawn(999219,0);
		}
		#removes banded armor, stops second timer and respawns Merchant
	}
	
	
	
	
	}
Edit: Okay, it seems to break a lot when removing items (maybe because the timers are so tight?), but I've let the second timer just loop til it catches it for now.


Edit2: Also, I don't know how to check if there are still items on the merchants, and then not set the item count to 0. If the items aren't there and you set them to 0, they will appear as "quantity: --", be visable, and one is sellable. I've set the item count high to counteract this, but it's a flaw.

Edit3: Huge bug. Characters spells lock up, and you can't open vendor windows etc etc.. after the merchant has been running too long. Zoning fixes the issue.
Reply With Quote
 


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 02:08 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