EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Random Item PLUGIN.. (https://www.eqemulator.org/forums/showthread.php?t=19152)

sdabbs65 08-19-2005 06:37 AM

Random Item PLUGIN..
 
Im looking for a plugin that will drop a random item on a corpse in event_death.
summonitem is not good enuff, I want it on the corpse.
I have all the item numbers from items.sql but I am unable to find a function that will place them on a corpse.
there is some old code that I enabled in 6.0 source for poolLoot items but it only drops coins.

if anyone has one please share.

sdabbs65 08-20-2005 05:05 PM

command
 
Quote:

Originally Posted by sdabbs65
Im looking for a plugin that will drop a random item on a corpse in event_death.
summonitem is not good enuff, I want it on the corpse.
I have all the item numbers from items.sql but I am unable to find a function that will place them on a corpse.
there is some old code that I enabled in 6.0 source for poolLoot items but it only drops coins.

if anyone has one please share.

just need to make this pick a random loot somehow...

# After hailing the NPC he gains 1 of item ID 5420 to his inventory.
sub EVENT_SAY
{
if($text=~/hail/i)
{
quest::addloot(5420,1);
}
}

cofruben 08-21-2005 01:08 AM

I'm guessing you would need to code a bit...If that's not implemented in perl, you will need to add a new perl function that calls CastToNPC()->AddItem(itemid, quantity) I think. It should not be that hard. Good luck..if still having problems just say.

fathernitwit 08-21-2005 03:13 AM

with perl XS you can call $npc->AddItem(id, charges) from perl.

sdabbs65 08-21-2005 03:01 PM

...
 
Quote:

Originally Posted by cofruben
I'm guessing you would need to code a bit...If that's not implemented in perl, you will need to add a new perl function that calls CastToNPC()->AddItem(itemid, quantity) I think. It should not be that hard. Good luck..if still having problems just say.

adding the item is not the problem... the issue is I want it to pick a random item from my database and add it to the corpse.
I dont think I have functions tho just yet.

sub EVENT_DEATH
{
quest::say("I'll get you back $name!");
my @items = (all the item numbers go here 1,22,33,433,40.);
quest::AddItem("$items[int(rand($#items+1))]"); <-- this is wrong need the item on the npc's corpse.
quest::shout("I've just died!");
}

sdabbs65 08-21-2005 04:43 PM

..
 
after spending several hours trying to figgure it out .
I gave up on it and just added every single item to one loot table and
gave it a chance of .1 to drop.
seems to work good but it's a memory hog.

FaerinTelDanor 08-22-2005 11:04 AM

Put the additem call in EVENT_SPAWN instead of EVENT_DEATH, the mob will spawn with a random item which will be on it's corpse when it dies.

sdabbs65 08-22-2005 11:14 PM

hmm
 
Quote:

Originally Posted by FaerinTelDanor
Put the additem call in EVENT_SPAWN instead of EVENT_DEATH, the mob will spawn with a random item which will be on it's corpse when it dies.

Never thought of that... it works..
guess I overthought that one a bit.


All times are GMT -4. The time now is 10:28 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.