random loot, the easy way
i finally got around to using the new global_npc.pl script
it makes loot randomization so much easier... this small snippet - doesn't make changes to default loot chances - only gives npcs with existing loot tables are given an extra item (so untargetable, invisible npcs won't turn into floating weapons) - verifies itemid is valid via temporary itemlink creation EQEmu\quests\templates\global_npc.pl Code:
sub EVENT_SPAWN { examples: filter specific items from roll destroy extra item under certain conditions roll for chance at extra item additional random items NOTE: you'll want to change the number from 131474 to whatever the highest itemid is in your items table and subtract 1001 (or your lowest itemid) from that number. |
Hah that is awesome!
|
glad you like it. i've added all sorts of bells and whistles to this on my test server. trivial encounter check, filtering based on item usability by encounter participants and/or an arbitrary never-drop list, minimum base chance and additional chance scaled by npc level, etc.
my previous method required that you modify every existing npc quest script you wanted to apply random loot to. needless to say, the recent addition of global_npc simplified things a great deal. thanks, akkadius! |
intentional complications
using something very close to this to verify that the npc can equip the item in question before the call to $npc->AddItem(). read: no more augfists, yay!
it can be modified for use as an additional validation step while picking the random item (filtering out items that are not usable by an participant in the encounter, for example). this was fun! (no sarcasm) Code:
use 5.012; |
I've never played on such a server, so I wonder why one would ever fight tough mobs when there are rats in the newbie area potentially dropping end-game gear. (I'm not saying that is necessarily a bad thing, I just wonder how things would play out)
|
some people just like the idea of random loot. the initial snippet was to give those people something to play with. technically speaking, most servers don't actually employ randomization, they simply scramble the drops in the database. they're still static that way. the misnomer is a pet peeve of mine.
as for your concerns, i had them as well. i'm working on implementing ways to determine if the encounter was trivial and remove the extra item. i'm also looking into filtering out loot based on the required level of the item. so the npc won't get something outside of its level range. my objective on my personal server is for there to only be a very small chance of the extra item, which scales up a tiny bit with npc difficulty (starting at level 11), so the extra item won't be something that is a common occurrence to begin with. finally, i'm considering giving the npcs in these rare instances abnormal abilities, so as to make things more of a challenge, given the extra bounty. the devil is in the details ... :) |
yow. the original won't work as posted because of the way quest::varlink() works. if you call it without a client as the initiator, the zone will crash. i was testing the functionality via EVENT_SAY, so it worked without issue.
compiling a minor source modification to see if it takes care of the crash without altering the functionality of quest::varlink() now. it'll just return an empty string if there is no client initiator, but only after it validates the itemid passed to it. |
applying the source change found here and changing
Code:
while $tested =~ /INVALID/ Code:
while $tested =~ /INVALID ITEM/ |
I can see the attraction of an occasional random item (random rewards are more effective psychologically, think Pavlov did some work on this). I'd actually like to play on such a server to check it out.
If I were doing such a thing, I would create a singleton on the server that built a list of items by level. Then have it select something from a requested range through a new Perl call. (I know you weren't asking for suggestions, but I thought I'd throw that out there. It might inspire someone). Edit: I just realized that this would be a good candidate for the shared memory region. No need to replicate the table across zones. |
no worries. suggestions are always appreciated. i've got plenty of ideas, just not enough skill to do anything other than hack them together with perl and my limited knowledge of c++.
|
All times are GMT -4. The time now is 04:50 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.