Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Database/World Building

Development::Database/World Building World Building forum, dedicated to the EQEmu MySQL Database. Post partial/complete databases for spawns, items, etc.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2016, 12:08 AM
Toony's Avatar
Toony
Sarnak
 
Join Date: Jul 2009
Location: USA
Posts: 85
Default SQL Query/update to add item to all NPC's 35 and higher

Could really use some help with this query, I'm trying to figure out a way to add a specific item id with a 1% drop rate to all npcs level 35 and over.


I've got this so far
Code:
select * from npc_types where `level` > 34
but I'm not sure how to finish it.

Help me eqemu community, you're my only hope.
Reply With Quote
  #2  
Old 10-10-2016, 12:31 AM
Darkscis
Sarnak
 
Join Date: Mar 2015
Posts: 62
Default

Would be 100 times easier to script this than do it in the database. In the database you would have to create a loot drop, then add it to every NPC's loot table and/or create a loot table if they don't already have one - or if they share one with NPC's that are under level 35.

If scripting it, you can just add it to global_npc.pl and do something like;

Code:
sub EVENT_DEATH {
if ($mlevel >= 35) { $npc->AddItem(itemid, quantity); }
}
EDIT: Forgot your 1% requirement. Just add a random roll statement before the additem.
Reply With Quote
  #3  
Old 10-10-2016, 12:32 AM
kimura
Hill Giant
 
Join Date: Oct 2011
Posts: 132
Default

This should work if you put it in the global_npc.pl file. the 12345 is whatever itemID (Untested of course)...

this also will not allow pets to get the item...

Code:
sub EVENT_SPAWN{

if ($mlevel >= 35)
	{
		return unless $npc->GetLoottableID();
		if (int(rand(100) + 1) >= 99) {
		{
			$npc->AddItem(12345,1,0);
			
		}
	  }
    }
}
Reply With Quote
  #4  
Old 10-10-2016, 11:22 AM
Toony's Avatar
Toony
Sarnak
 
Join Date: Jul 2009
Location: USA
Posts: 85
Default

Thanks, new to the idea of scripting drops but yeah, that seems a lot easier.
Reply With Quote
  #5  
Old 10-10-2016, 06:46 PM
Toony's Avatar
Toony
Sarnak
 
Join Date: Jul 2009
Location: USA
Posts: 85
Default

Ok, I have the following in C:\eqemu_server\quests\templates\global_npc.pl


Code:
sub EVENT_SPAWN{

if ($mlevel >= 35)
	{
		return unless $npc->GetLoottableID();
		if (int(rand(100) + 1) >= 99) {
		{
			$npc->AddItem(11703,1,0);
			
		}
	  }
    }
}
And for testing purposes I've changed "1) >= 99)" to "50) >= 99)"

But I can't seem to get my item to drop even after several tests, what am I missing?
Reply With Quote
  #6  
Old 10-10-2016, 06:53 PM
kimura
Hill Giant
 
Join Date: Oct 2011
Posts: 132
Default

It's in the wrong folder, it needs to be in global folder
Reply With Quote
  #7  
Old 10-10-2016, 07:10 PM
Toony's Avatar
Toony
Sarnak
 
Join Date: Jul 2009
Location: USA
Posts: 85
Default

Woot, worked, thanks much.
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 04:34 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