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

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2014, 11:28 PM
kilst87
Sarnak
 
Join Date: Dec 2008
Location: sydney
Posts: 35
Default

Okay, I added a check at the start to see if the items are still saved in the merchantlist_temp.

Qglobals are a heap of fun!

Also, does anyone know how/if I would be able to save user input strings to qglobals, or set is to a var?

I want an NPC to ask a question, and save/use the users $text response.

Anyway, new code:

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(238);
		}
		
		elsif($qglobals{"vaylena_items"} == 2) {	
			quest::settimer("spawned_2", 2);
			quest::resume(238);
		}
	
		elsif($qglobals{"vaylena_items"} == 3) {
			quest::settimer("spawned_3", 2);
			quest::resume(238);
		}
		
	}
	#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
			}
			
if($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
			}
			
			
if($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_1", 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($timer eq "itemgroup_1_shout") {
			quest::ze(2, "Vaylena says out of character 'Please buy my crap armor!!'")
			#zonewide emote used as /ooc
		}
		
		elsif($timer eq "itemgroup_1") {
			quest::respawn(999219,0);
			quest::stoptimer(itemgroup_1);
			#respawn when timer is up
		}

	}
	
	
	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_2", 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($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
		}
		
		elsif($timer eq "itemgroup_2") {
			quest::respawn(999219,0);
			quest::stoptimer(itemgroup_2);
			#respawn when timer is up
		}
		
	}
	
	
	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_3", 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
		}
		
		
		elsif($timer eq "itemgroup_3_shout") {
			quest::ze(2, "Vaylena says out of character 'Selling armor!! Please buy my BANDED!!!'")
			#zonewide emote used as /ooc
		}
		
		elsif($timer eq "itemgroup_3") {
			quest::respawn(999219,0);
			quest::stoptimer(itemgroup_3);
			#respawn when timer is up
		}
	}
	
	
}


Any input still welcome.

Cheers

Edited for newest revision.
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 09:32 AM.


 

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