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

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2014, 03:34 AM
kilst87
Sarnak
 
Join Date: Dec 2008
Location: sydney
Posts: 35
Default

Cleaned up the code a bit, did some more learning regarding "if" (admittedly, not much). I figured the elsif's I was using for the /ooc and respawns were what was causing the skipping. Now it's working, and not skipping any timers.

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 {

	if (!defined $qglobal{vaylena_items}) {

		if($qglobals{"vaylena_items"} == 1) {
			quest::settimer("spawned_1", 2);
			#quest::resume();
		}
		
		elsif($qglobals{"vaylena_items"} == 2) {	
			quest::settimer("spawned_2", 2);
			#quest::resume();
		}
	
		elsif($qglobals{"vaylena_items"} == 3) {
			quest::settimer("spawned_3", 2);
			#quest::resume();
		}
		
	}
	#Set timers to delete remembered items
	
	if (not defined $qglobal{vaylena_items}) {
		quest::setglobal('vaylena_items', 0, 6, F);
		quest::settimer("random_loot_timer", 5);
	}
	#sets qglobal if not set	
}


sub EVENT_TIMER{

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

my $shout = int(rand(10) + 20);
#set $shout with a number between 3 and 4 mins between item shouts

	if($timer eq "spawned_1") {
		quest::MerchantSetItem(999219, 1111, 0);
		quest::MerchantSetItem(999219, 1112, 0);
		quest::MerchantSetItem(999219, 1113, 0);
		quest::MerchantSetItem(999219, 1114, 0);
		quest::shout("Spawned!1");
		quest::stoptimer("spawned_1");
		quest::settimer("random_loot_timer", 5);
		#deletes any saved items, starts next timer
		}
			
	elsif($timer eq "spawned_2") {
		quest::MerchantSetItem(999219, 2111, 0);
		quest::MerchantSetItem(999219, 2112, 0);
		quest::MerchantSetItem(999219, 2113, 0);
		quest::MerchantSetItem(999219, 2114, 0);
		quest::shout("Spawned!2");
		quest::stoptimer("spawned_2");
		quest::settimer("random_loot_timer", 5);
		#deletes any saved items, starts next timer
		}
			
			
	elsif($timer eq "spawned_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("Spawned!3");
		quest::stoptimer("spawned_3");
		quest::settimer("random_loot_timer", 5);
		#deletes any saved items, starts next timer
		}

	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("New crap items up!");
			quest::stoptimer("random_loot_timer");
			quest::settimer("itemgroup", 40);
			quest::settimer("itemgroup_1_shout", $shout);
			quest::setglobal('vaylena_items', 1, 6, F);
			#post items, start shout and respawn timer, and save list to globals			
			}
	}
	
	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("New trader selling all kinds of stuff");
			quest::stoptimer("random_loot_timer");
			quest::settimer("itemgroup", 40);
			quest::settimer("itemgroup_2_shout", $shout);
			quest::setglobal('vaylena_items', 2, 6, F);
			#post items, start shout and respawn timer, and save list to globals
			}
	}
	
	elsif($randi == 2) {
	
		if($timer eq "random_loot_timer"){
			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("Leveling blacksmith selling Banded armor cheap");
			quest::stoptimer("random_loot_timer");
			quest::settimer("itemgroup", 40);
			quest::settimer("itemgroup_3_shout", $shout);
			quest::setglobal('vaylena_items', 3, 6, F);
			#post items, start shout and respawn timer, and save list to globals
		}
	}
	
	if($timer eq "itemgroup_1_shout") {
		quest::ze(2, "Vaylena says out of character 'Please buy my crap armor!!'")
		#zonewide emote used as /ooc
	}

	if($timer eq "itemgroup_2_shout") {
		quest::ze(2, "Vaylena says out of character 'Selling all kinds of armor, check me out!!'")
		#zonewide emote used as /ooc
	}

	if($timer eq "itemgroup_3_shout") {
		quest::ze(2, "Vaylena says out of character 'Selling armor!! Please buy my BANDED!!!'")
		#zonewide emote used as /ooc
	}
		
	if($timer eq "itemgroup") {
		quest::respawn(999219,0);
		quest::stoptimer(itemgroup);
		#respawn when timer is up
	}

}
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 07:20 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