PDA

View Full Version : Adding random loot to specific NPCs


Aquaojo
05-08-2017, 05:58 PM
Ok - I had this working this morning...Then fried my brain on another project and must be missing something now.

Basically just adds random loot to chest spawns that come up after mobs are killed. Chests are spawning fine. Just no loot.

sub EVENT_SPAWN {

if($npc_id >= 705003 && $npc_id <= 705007)
{
my $itemid = ( int rand 95000 ) + 1001;
$npc->AddItem($itemid);
}
}

As always - Thanks for the help!!

Coenxai
05-08-2017, 06:20 PM
Why are you checking npc id? Also, you should fix your rand() function.

atrayas
05-08-2017, 06:51 PM
Use the add loot plugin, simple and works great. You are creating steps that are not needed with what you have there.

Look it up on the wiki, akkadius has instructions there for it.

Aquaojo
05-08-2017, 07:11 PM
Tunnel vision...Didn't even think about using AddLoot. :p

Thanks fellas