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 09-19-2009, 08:04 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default server first announcements thru quest system

i'm trying to set up so that when a player hits max level on your server, and they are the first to do so, it does a server wide announcement of it.

heres what i've got so far. i have it placed in quests/templates/player.pl, but I can't get it to work for some reason. can some one take a look at it, and tell me whats wrong pls?

Code:
sub EVENT_LEVEL_UP {
	my $maxlvl = 50
	if(!defined($qglobals{warmaxlvl}) && $ulevel == $maxlvl && $class eq 'Warrior') {
		quest::setglobal("warmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel warrior!");
	}
	
	if(!defined($qglobals{clrmaxlvl}) && $ulevel == $maxlvl && $class eq 'Cleric') {
		quest::setglobal("clrmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel cleric!");
	}
	
	if(!defined($qglobals{palmaxlvl}) && $ulevel == $maxlvl && $class eq 'Paladin') {
		quest::setglobal("palmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel paladin!");
	}
	
	if(!defined($qglobals{rngmaxlvl}) && $ulevel == $maxlvl && $class eq 'Ranger') {
		quest::setglobal("rngmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel ranger!");
	}
	
	if(!defined($qglobals{skmaxlvl}) && $ulevel == $maxlvl && $class eq 'ShadowKnight') {
		quest::setglobal("skmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel shadow knight!");
	}
	
	if(!defined($qglobals{drumaxlvl}) && $ulevel == $maxlvl && $class eq 'Druid') {
		quest::setglobal("drumaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel druid!");
	}
	
	if(!defined($qglobals{mkmaxlvl}) && $ulevel == $maxlvl && $class eq 'Monk') {
		quest::setglobal("mkmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel monk!");
	}
	
	if(!defined($qglobals{brdmaxlvl}) && $ulevel == $maxlvl && $class eq 'Bard') {
		quest::setglobal("brdmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel bard!");
	}
	
	if(!defined($qglobals{rogmaxlvl}) && $ulevel == $maxlvl && $class eq 'Rogue') {
		quest::setglobal("rogmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel rogue!");
	}
	
	if(!defined($qglobals{shmmaxlvl}) && $ulevel == $maxlvl && $class eq 'Shaman') {
		quest::setglobal("shmmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel shaman!");
	}
	
	if(!defined($qglobals{necmaxlvl}) && $ulevel == $maxlvl && $class 'Necromancer') {
		quest::setglobal("necmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel necromancer!");
	}
	
	if(!defined($qglobals{wizmaxlvl}) && $ulevel == $maxlvl && $class eq 'Wizard') {
		quest::setglobal("wizmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel wizard!");
	}
	
	if(!defined($qglobals{magmaxlvl}) && $ulevel == $maxlvl && $class eq 'Magician') {
		quest::setglobal("magmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel magician!");
	}
	
	if(!defined($qglobals{encmaxlvl}) && $ulevel == $maxlvl && $class eq 'Enchanter') {
		quest::setglobal("encmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel enchanter!");
	}
	
	if(!defined($qglobals{bstmaxlvl}) && $ulevel == $maxlvl && $class eq 'Beastlord') {
		quest::setglobal("bstmaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel beastlord!");
	}
	
	if(!defined($qglobals{bermaxlvl}) && $ulevel == $maxlvl && $class eq 'Berserker') {
		quest::setglobal("bermaxlvl",1,2,"F");
		quest::shout2("$name has made the server first level $ulevel berserker!");
	}
	
}
Reply With Quote
  #2  
Old 09-19-2009, 08:32 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

for starters, you need one more } at the very end
Reply With Quote
  #3  
Old 09-19-2009, 10:23 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

just curious, sorry if this seems ignorant, but why do I need one more }? accordin to notepad++ the sub is closed, and every if statement is closed as well.
Reply With Quote
  #4  
Old 09-19-2009, 10:42 PM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

Instead of copy pasting the code 15 times, you could do something like this:

Code:
sub EVENT_LEVEL_UP {
	my $maxlvl = 50;
	my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");
	foreach my $curclass (@classlist) {
       if(!defined($qglobals{$curclass."maxlvl"}) && $ulevel == $maxlvl && $curclass eq $class) {
            quest::setglobal($curclass."maxlvl",$name,2,"F");
            quest::shout2("$name has made the server first level $ulevel $class!");
            return;
	   }
	}
}
I think that may work. I'm storing the player's name in the variable instead of just a boolean flag in hopes that who knows, one day $pglobal will be loadable on NPC's.

If that ever occurs, I wrote a reporter NPC too, $qglobals are a little weird scope wise, NPC's don't load no NPC ID vars (aka Player vars). I may ask the coders to add a $pglobal that when you talk to a NPC, it loads non-NPC ID globals for the zone are loaded into $pglobal{}. Would be handy for this situation, and I can think of a few others.

This code doesn't work, but I wrote it anyways if the theory of player global vars non-NPC specific ever get written in.
Code:
sub EVENT_SAY
{
    if ($text=~/Hail/i) { #Initial Hail
        my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");;
        my $buffer = "";
        foreach my $curclass (@classlist) {
            $buffer = $buffer . $pglobals{$curclass."maxlvl"} . " [$curclass], " if (defined($qglobals{$curclass."maxlvl"}));
            if (defined($qglobals{Bardmaxlvl})) { $buffer = $buffer . $pglobals{Bardmaxlvl} . " [$curclass], "; }
        }
        if (length($buffer) > 3) {
            $buffer = substr $buffer, 0, length($buffer)-3;
            quest::say("Server First Classes: " . $buffer);
        }
        quest::say("end");
    }
}
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #5  
Old 09-19-2009, 10:57 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

Quote:
Originally Posted by Shin Noir View Post
Instead of copy pasting the code 15 times, you could do something like this:

Code:
sub EVENT_LEVEL_UP {
	my $maxlvl = 50;
	my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");
	foreach my $curclass (@classlist) {
       if(!defined($qglobals{$curclass."maxlvl"}) && $ulevel == $maxlvl && $curclass eq $class) {
            quest::setglobal($curclass."maxlvl",$name,2,"F");
            quest::shout2("$name has made the server first level $ulevel $class!");
            return;
	   }
	}
}
I think that may work. I'm storing the player's name in the variable instead of just a boolean flag in hopes that who knows, one day $pglobal will be loadable on NPC's.
I put this in to quests/template/player.pl. restarted server, and still nothing, makes me feel like i'm not putting this in the correct spot, or that #level 50 isn't triggering the sub EVENT_LEVEL_UP. idk which, any enlightenment would be appreciated.
Reply With Quote
  #6  
Old 09-19-2009, 11:42 PM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

It should. There may be an issue with scripts in the zone folder conflicting with the templates folder, just for testing try to put the player.pl inside the zone you're inside, and #reloadpl
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #7  
Old 09-19-2009, 11:52 PM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

Some quest coder should help me out here.. I'm not very familiar with it. :/ but!
LoadPlayerScript() function in embparser.cpp
it does this whole..
Code:
string filename= "quests/";
	filename += zone;
	filename += "/player.pl";
	string packagename = "player";
	packagename += "_";
	packagename += zone;
build of the quests\zone\player.pl directory.. tries to eval it
Code:
try {
		perl->eval_file(packagename.c_str(), filename.c_str());
	}
then if it doesn't load,
Code:
if(!isloaded(packagename.c_str()))
	{
		filename = "quests/";
		filename += QUEST_TEMPLATES_DIRECTORY;
		filename += "/player.pl";
try templates. So if I'm not corrected, if a /<zone>/player.pl exists, it stops the parser from loading /templates/player.pl?
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #8  
Old 09-19-2009, 11:56 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

did as suggested, tried it with the guild lobby, cut/paste the player.pl and #reloadpl, and worked. cut/paste back into templates folder, #reloadpl, doesn't work. now what I don't understand is there isn't anything in the guild lobby folder, cept the guildhall instance creation script, so i'm not seeing what would be conflicting with the EVENT_LEVEL_UP. btw is there a way to broadcast, instead of having "$name shouts, blah blah blah". was looking more for a system msg world wide, then having the player shout it world wide.
Reply With Quote
  #9  
Old 09-20-2009, 12:30 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

Try $client->Message(13, "Message here");
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #10  
Old 09-20-2009, 12:37 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

I really hate that 5 minute edit limit. So new post!

I'm working on a quest cheat sheet wiki. Not newb friendly, but a good quick reference is my objective.
This link should go to the $client->function() section, the message one and show the different color types noted in source.
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #11  
Old 09-20-2009, 12:55 AM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

does $client->Message() broadcast worldwide, or just to the client that triggered the event?
Reply With Quote
  #12  
Old 09-20-2009, 01:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yes, it will try to load the player.pl from the zone folder and if not there, it will load it from templates if one exists there. It would be nice if both could load and run simultaneously so you could have global stuff for player.pl as well as zone specific stuff.

I believe that for any scripts located in the templates folder, the server has to be restarted for them to take effect. Not 100% sure on that, but I think that was the conclusion I came to last time I tried playing around with it.

Also, some notes on your compilation of quest wiki pages:

EVENT_ENTER and EVENT_EXIT are both related to proximities, so they don't work from the player.pl. They are triggered when the client enters or exists a proximity around an NPC.

EVENT_SCALE_CALC is for item quest files, specifically for items with something set in the charmfile field. This event is for setting how much you want an item's stats to scale based on a percentage. Here is an example of a custom quest I made for a custom charm I have on my server:

/quests/items/CHRMTitanium.pl
Code:
sub EVENT_SCALE_CALC 
{
	if (defined($qglobals{titanium_relic})) {
		$questitem->SetScale($qglobals{titanium_relic}/10);
	}
	else {
		$questitem->SetScale(0);
	}
}
Note that the quest is stored in a folder name "items" instead of a zone name. Also, note that CHRMTitanium from the file name is what needs to be placed in the charmfile field for the item.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #13  
Old 09-20-2009, 01:07 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

Thanks trevius. and @ nightsta, hmm, that's a good question. Pretty sure it's possible, but can't think of a script I can pull up to find the function.
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #14  
Old 09-20-2009, 01:14 AM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

Quote:
Originally Posted by trevius View Post
Yes, it will try to load the player.pl from the zone folder and if not there, it will load it from templates if one exists there. It would be nice if both could load and run simultaneously so you could have global stuff for player.pl as well as zone specific stuff.
so basically what your saying is, for this to work, I have to go through every zone and place my level up script in each player.pl? that'll completely defeat the purpose of what i'm tryin to do. i'm tryin to make something similar to the achievement styles of wow. including leveling, mob slaying, and several other things, which requires the use of quest globals and things such as this. if I have to put my scripts into each and every zone player.pl, that'll be WAY to much work. is there any way of changing the source to read from both? or what is stopping it from using both scripts?
Reply With Quote
  #15  
Old 09-20-2009, 01:27 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default

To use the scale event you utilize "quests/items/" folder? Interesting. Wonder how I'll categorize that.
Sorry for derailing topic nightsta. I'm unsure at your answer, we'll see!
__________________

~Shin Noir
DungeonEQ.com
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 06:48 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3