Possible to add augment to loot items?
Can you have a perl script add augments to an item it is adding to a mob when it spawns? If have tried and repeatedly failed to get this to happen lol. I am to the point if someone more knowledge would want to write a quest to do the below please send me a message. I would be willing to work out a donation for the code and time spent.
Below obviously is just what I am looking for in layman’s terms not actual code: When a mob spawns I want a perl quest that fires to add an item to the mob. I want the item added to have random augments inserted into the item. In the zone folder I will name the quest the mobs name but there are different variations of the mob so I need it to trigger different items for each unique npc type id. Code:
sub EVENT_SPAWN |
So no one can even answer the question of if this is possible or not? :(
|
With an attitude like that, ain't noone gonna help you.
|
Quote:
lol how is that an attitude? please look through all my post and try and find me ever getting an attitude. Pro tip: see the sad face at the end. That helps you determine the emotion the text was written with. |
Source change would be necessary (from what I recall from the last time I looked at the source which is currently unavailable to me) to accomplish what you want in the way that you want.
However, if you wanted to handle this at EVENT_LOOT level, then yes, it should be very well possible using Perl. The only immediate downside I can think of it, is, it may cause a "blip" of the item while on cursor, where it temporarily disappears, but then reappears. Hell it may not even be noticeable. Basically, it would entail allowing the player to loot the item (and it would need to be LORE, more on this later), which kicks off EVENT_LOOT (player.pl in the zone this special circumstance belongs, or global_player.pl if it could be multiple zones for simplicity of code management), logical comparison of item looted, if qualifying item, nuke it, then Code:
$client->SummonItem(item_id, charges, attune, aug1, aug2, aug3, aug4, aug5) TBH, I think most would likely settle on simply modifying the loot tables, so that the NPC has the item (100%), then handle the randomization of the augment through the loot table as well. Then just let the player add the augments. If you want to force stats, then just create an item with those stats from the get go. I know Kingly recently added (I think it was him, my apologies to the dev if it wasnt him that did it) IsAugment() or maybe it was IsAugmented() which the latter making a little more sense imo. However, I'm not sure a Perl/LUA export exists to find just WHICH augments are on an item. I'd have to look at the source, as http://wiki.eqemulator.org/p?Ultimate_Perl_Reference hasn't received an update in awhile. TL;DR - With source code changes, yes. With just Perl, perhaps. |
Quote:
|
Quote:
|
Can always add the item using $client->SummonItem though.
Code:
sub EVENT_LOOT{ Then add an array for each 5 augments with a random chance to apply by passing $aug1, $aug2, $aug3, $aug4, $aug5. Note: This is just an example, but that's totes how i'd do it. Or if you really want to make this "Diablo Style" Add an NPC that will identify magic items and set tyhem from an NPC, and just provide the unidentified item as a shit item. |
Quote:
And the immediate one I can think of, as mentioned above, is if they do a right click (immediate) loot, making the item land in their inventory. But, this should be an issue if the item itself is LORE. That is likely the route I would go, rather than having Perl handle the traits of a "LORE" like item, as it just makes an already complex way to handle giving items/augments (in my humble opinion) more complex. |
Quote:
|
In diablo, there were no lore items or lore augments ;) remove lore and gucci.
Except Wirt's leg, but let's be honest, Wirt was a jerkoff. |
Quote:
The following assumes the item is lore, has not been tested, as I don't have Perl on the computer I'm on atm: Code:
sub EVENT_LOOT { Code:
@eligibleitemidarray It's not clean (i.e. could use some clean up), but, should at the very least give you an idea of how you could go about things. Now, if: Code:
quest::addloot() |
so running with the idea that a generic sword named "unidentified sword" drops and they have to take it to an npc to get it identified. is this how you would set up your array to spit out an item with augments in it. .Hopefully I understood what you were trying to say was possible.
Code:
{ |
If you take to an NPC, I would just have the player trade the item, then summon it to the players cursor (the augmented version).
|
That looks like a general concept.
Run with it! |
Well thank you both for the help. I cant wait to get home from work and try some of this out. :grin:
|
Quote:
However, I would use quest::ChooseRandom in place of Perl's rand. Also, know, that rand(4) would produce fractions (i.e. 0.43456, 1.2235, etc.) so that conditional, while it -could- some year be true as you have it written, if you are insistent on using rand(), then: Code:
my $random = int(rand(3)); Here is an example of something (without iterating through the %itemcount hash for simplicity, as I'm not sure your comfort level of hashes) utilizing an EVENT_ITEM (i.e. trade) event: Code:
sub EVENT_ITEM { |
all my knowledge and familiarity with any of this comes from the wiki introduction to perl scripting, ulitmate perl reference and what I can copy and past from code I find searching the forums/quest folder haha.
|
I'm going a little beyond my comfort level without having at least Perl installed on this PC, but this may do the trick:
Code:
sub EVENT_LOOT { I -think- it will function as closely as what you were after. I used the augment item ID's of what you originally provided for reference of what is going on in the hash of arrays. The key values (ie. 1 and 4) are the item ID's of the main item you're dealing with. Gotta run, good luck. |
$client->SummonItem technically can be passed a slot_id, it's just unlisted on the Perl Ultimate reference page and defaults to 30 (cursor). What you would have to do in the case of a "right click auto loot" instead of a left click on cursor is determine what slot the loot landed in, and then Nuke->SummonItem.
Code:
XS(XS_Client_SummonItem) |
Quote:
(*ninja edit) Updated so that the SummonItem places the newly augmented item where it found the unaugmented (freshly looted) one. |
Sorry for double post - but I also looked into quest::addloot and it *looks* like a fairly simple code change if you are comfortable modifying source. If not, use SummonItem.
Code:
void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) { |
I'm finalizing packing before heading out of state. I have NPC::AddLootDrop open now (as a result of revisiting this thread due to your initial post) and, yeah, I see that as well. Actually not much involved, append parameters to the function's existing parameters, if null/undef default to 0 as they are now already so it doesn't break anything, then as you said modify the questmanager calls and Perl/LUA parser.
If this preparing doesn't take too much longer, I'll have a dig at it, otherwise, I'm sure someone else may jump in (which is fine, I need to get back to what I was doing but ADD kicked in, actually it was getting monotonous). |
Quote:
EDIT: Also I love your script. Do you mind if I shamelessly copy a chunk of it to use for finding empty inventory slots for my NPC barter system? At the moment I just summon all the items traded to cursor and let the client handle placing them but with your slot finder section I could find empty slots and summon to those instead. |
Thanks to everyone that replied to this. this is all great stuff.
|
So I finally got some time to play around with this and here is what I have. I went with having a NPC identifing the item as it fits my server even better then the item just dropping plus by adding a fee it adds a small money sink. And its not hard to just make a dummy (unidentified) item for each item. One thing I could not get to work was aug6. I could only ever get it to work up to aug5. It would leave the slot blank and then eventually just stop working. I also found if i didnt set up a random for each aug it would pick the same number for all 5.
Code:
sub EVENT_ITEM{ Thanks again for all the input. This works great. :) |
I added augment support to $npc->AddItem() and quest::addloo0,, I never thought of something like this, so I'm glad you brought this up. Hopefully you can make use of it, but you'll have to wait until this pull request is merged so you can pull the code down and use augments in these functions.
|
"Usage: Client::SummonItem(THIS, item_id, charges=0, attune=0, aug1=0, aug2=0, aug3=0, aug4=0, aug5=0, slot_id=30)"
The perl api isn't coded to handle the extra aug slot. Not easy to change since it would break any pre-existing scripts based on the 5-augment code. |
Kinglay Karab for duh wein
|
Not quite the original intended purpose but I can confirm $client->SummonItem works great when supplying a slot id. I used ghanja's code to iterate through inventory slots and then summon items direct to a free one in my trading system. Kind of moot now that KK has fixed the loot ones, but good to know nevertheless!
|
As far as I saw, he wanted something like this to be possible.
Code:
sub EVENT_SPAWN { |
All times are GMT -4. The time now is 08:51 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.