Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-02-2008, 06:43 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default default.pl for NPCs without a quest

I've been working lately on making it so that NPCs return items when they've no use for them. Rather than go in deep and rewrite the item & quest handling code, I thought it would be easier if I just had a default quest file that NPCs used when they don't have an existing quest file. This allows me to leave the current quest files completely alone, but still make changes to NPC item handling.

This is what I have so far (and it works very well, except for the exceptions noted below). Change zone\embparser.cpp adding the red lines below:
Code:
		//if there is no file for the NPC's ID or name,
		//try for the NPC's name in the templates directory
		//only works if we have gotten the NPC's name above
		if(! filefound && ! filefound2) {
			bool filefound3 = false;
			if(tmpname[0] != 0) {
				//revert to just path
				filename = "quests/";
				filename += QUEST_TEMPLATES_DIRECTORY;
				filename += "/";
				filename += tmpname;
				filename += ".pl";
				curmode = questTemplate;
				//LogFile->write(EQEMuLog::Debug, "	template '%s'", filename.c_str(), filefound2);
			} else {
				//LogFile->write(EQEMuLog::Debug, "	no template name");
				filename += itoa(npcid);
				filename += ".pl";
				curmode = questDefault;
			}
			tmpf = fopen(filename.c_str(), "r");
			if(tmpf != NULL) {
				fclose(tmpf);
				filefound3 = true;
			}
			//if we haven't been able to find a quest file
			//let's use a default.pl file so we can make
			//all NPCs react the same on any event.
			if(!filefound3) {
				// Try default.pl
				filename = "quests/";
				filename += QUEST_TEMPLATES_DIRECTORY;
				filename += "/";
				filename += "default.pl";
				curmode = questTemplate;
			}
		}
Once that is in I created a quest\templates\default.pl with this:
Code:
sub EVENT_ITEM {
	plugin::return_items(\%itemcount);
}
So, the exceptions to the "working well" portion are what I would like to discuss. When are the times that you would want an NPC to accept an item when they didn't have a quest for it? I'll give you the obvious one: Pets. The code above will make it so that pets will no longer accept your gifts which is bad (especially for magicians).

So, I'd like to code the exceptions but before I spend a ton of time on this, can anyone think of other times when an NPC rejecting an item would be bad?
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 08:13 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