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

Quests::LUA Section regarding LUA scripts, help, questions, answers

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2015, 01:22 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default Changing corpses loot

I know there have been challenges on doing this in the past. Scenario is that once a mob dies, I want to alter the loot under certain conditions. I can clear the money on the body right when it dies, but not the loot. I can even clear the loot on the corpses in the vicinity, on this condition....if someone has opened up the loot window. I am not sure what that does to the corpse when the window is opened, but after than point I can alter the loot in every single corpse in the area...but not before that window is opened. If I can find out what that does to the corpse I may be able to make headway.

I can also access the inventory on the NPC before it is a corpse and I can delete the inventory if I know the item number, but this does not really help me much. The end goal is to remove a percentage of the loot based on conditions. Sure I could make another loottable and assign it based on the condition but spread out over hundreds of mobs doing it via Perl or Lua will simplify my life hundreds of times over.

Somthing like this kind of works, it will remove the cash even if the corpse window has not been opened. If it has been opened it will remove all items within that vicinity. It is nothing fancy, may even have an error because I remove a few things before pasting it.
Code:
   	local xloc = e.self:GetX();
	local yloc = e.self:GetY();
	local zloc = e.self:GetZ();

	local clist = eq.get_entity_list():GetCorpseList();
	if ( clist ~= nil ) then
	  for corpse in clist.entries do
		if ( corpse:IsNPCCorpse() ) then
			if (corpse:CalculateDistance(xloc, yloc, zloc) < 400) then
				local items = corpse:CountItems();
				e.self:Shout("Item count"..items);
				corpse:RemoveCash();

				for j=0, 25,1 do
					e.self:Shout("Removing item from slot ".. j);
					corpse:RemoveItem(j);
				end
			end
		  end
	  end
	end
Reply With Quote
  #2  
Old 02-01-2015, 04:16 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by provocating View Post
I can also access the inventory on the NPC before it is a corpse and I can delete the inventory if I know the item number, but this does not really help me much. The end goal is to remove a percentage of the loot based on conditions. Sure I could make another loottable and assign it based on the condition but spread out over hundreds of mobs doing it via Perl or Lua will simplify my life hundreds of times over.
Not quite sure what is is you're after. Are you concealing information, so that it remains secret? (Wouldn't blame you for doing so, just want to know if it's that or a comprehension issue on my part, likely the latter.)

But I'll focus on this:
Quote:
The end goal is to remove a percentage of the loot based on conditions. Sure I could make another loottable and assign it based on the condition but spread out over hundreds of mobs doing it via Perl or Lua will simplify my life hundreds of times over.
Just a percentage of the entire loottable or, specific loot? The latter of course being a bit more involved.

$npc->RemoveItem ($itemid, <quantity>);

In the EVENT_DEATH, would accomplish that, though it (was) unreliable the last time I toyed with RemoveItem, when in EVENT_DEATH

I'm thinking setting entity variables may be helpful here, but again, I don't believe I'm grasping your goal and the requirements that goal has to be met under, entirely.
Reply With Quote
  #3  
Old 02-01-2015, 04:18 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

Quote:
Originally Posted by ghanja View Post
Just a percentage of the entire loottable or, specific loot?
Just the items on the body, so if there were 8 I would want to remove 4
Reply With Quote
  #4  
Old 02-01-2015, 04:35 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by provocating View Post
Just the items on the body, so if there were 8 I would want to remove 4
PMed you back bud. And will stick to that for now, as I don't know if you want the conditions to be announced here.
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 12:35 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