Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 10-31-2013, 10:34 PM
HnathBST
Sarnak
 
Join Date: Feb 2007
Location: Sunset Home
Posts: 71
Default

Quote:
Originally Posted by Akkadius View Post
Something like this should work:

Code:
sub EVENT_SAY{
	if(!defined($qglobals{"TenTimeEvent"})){ $client->SetGlobal("TenTimeEvent", "10", 7, 'F'); }
	my $CountToZero = (10 - $qglobals{"TenTimeEvent"});
	if($text=~/hail/i){ quest::say("The fuck you want?"); $client->Message(15, quest::saylink("Make me a sammich", 1)); }
	if($text=~/sammich/i){ 
		if($qglobals{"TenTimeEvent"} > 0){
			quest::say("WHAT?! Fine... But I will only do it " . $CountToZero . " more time(s)..."); 
			$npc->SetGlobal("TenTimeEvent", ($qglobals{"TenTimeEvent"} - 1) , 7, 'F');
		}else{
			quest::say("Sorry man, I told you I wouldn't make you a sammich anymore...");
		}
	}
}
You need to have qglobals enabled on the npc (Set to 1) and it is set at a global scope, meaning any NPC can grab this qglobal variable if you tried to fetch it.

He sets it once and when the value of the qglobal has been subtracted to 0, he no longer will make a sammich
I think you have $CountToZero incorrect. If the Qglobal is set to 10, $CountToZero = 10 - 10 = 0. So the NPC would say "I'm only doing it 0 more times". Unless my logic is wrong.

I would say:
Code:
sub EVENT_SAY{
	if(!defined($qglobals{"TenTimeEvent"})){ $client->SetGlobal("TenTimeEvent", "10", 7, 'F'); }
	
	if($text=~/hail/i){ quest::say("The fuck you want?"); $client->Message(15, quest::saylink("Make me a sammich", 1)); }
	if($text=~/sammich/i){ 
		if($qglobals{"TenTimeEvent"} > 0){
			quest::say("WHAT?! Fine... But I will only do it " . ( $qglobals{"TenTimeEvent"} - 1). " more time(s)..."); 
			$npc->SetGlobal("TenTimeEvent", ($qglobals{"TenTimeEvent"} - 1) , 7, 'F');
		}else{
			quest::say("Sorry man, I told you I wouldn't make you a sammich anymore...");
		}
	}
}
That eliminates the $CountToZero variable that was only used once for text anyway.
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 04:12 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