Faller 93 Report post Posted December 20, 2016 Hey! I'd like if anyone has any ideas on how to make items with expiration date? I don't think there's any scripts for that, but if there is, I'd be really happy if you shared with me. Any ideas on how I can do it? I'm thinking of using log files to store the item date, but am not sure how to delete the item in-game after the expiration date.. lol Seems very complex for now. I hope you can help me, thank you! Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted December 20, 2016 You'll need unique identifiers for items if you're talking about having more than one of the same item that can expire since with logs it'll be kinda hard. Otherwise, if it's one item per inventory, then just apply a timer (with logs if you really want) and when it expires, make a check for that and then use "RemoveItem" function. 2 Quote Share this post Link to post Share on other sites
Ximboliex 86 Report post Posted December 22, 2016 (edited) --while giving item do --Change the local variables values to what you want (like local hours = 5 means 5 hours.) local mins = 25200 -- i've done for 1 week only mins = mins * 60 local hours = 0 hours = hours * 3600 local days = 0 days = days * 86400 local ItemID = --put item id here! item = GetChaItem2 ( character , 2 , ItemID ) SetItemAttr(item, ITEMATTR_URE, mins) -- i've set this for mins only you can change the variables values and place what you want here, if its days or hours or what ever. -- place >>TimedItem(role)<< in cha_timer function Timed_Item(role) local ItemID = --put item id here local Bag_Item = GetChaItem2 ( role , 2 , ItemID ) local mins = GetItemAttr(Bag_Item,ITEMATTR_URE) if mins > 0 then SetItemAttr(Bag_Item,ITEMATTR_URE, -1) elseif mins == 5 then SystemNotice(role,"the item will dissappear in seconds.") SetItemAttr(Bag_Item,ITEMATTR_URE, -1) elseif mins <= 0 then DelBagItem ( role , ItemID , 1) return end end Credits; Don't Remember Edited December 22, 2016 by Ximboliex 1 Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted December 23, 2016 @Ximboliex, that may probably work (I haven't tested it though) on common items, but an issue my arise when trying to apply it into items or equipment that use some stats for placeholders, such as: black dragon items (equipment and altar), medal of honor (I think it uses URE besides the strength and constitution attributes, not sure) and some others I can't remember at the moment. This script can be applied as long as you don't try to add more placeholders within that item, at least that they don't interfere with URE probably MAXURE as well. 2 Quote Share this post Link to post Share on other sites
Faller 93 Report post Posted December 23, 2016 Thank you for the replies! I'll try this script out, I appreciate so much that u shared it with us. Thanks <3 Quote Share this post Link to post Share on other sites
Totoka 152 Report post Posted December 25, 2016 Hey faller, and what about using something like this? > Lineage 2: https://l2wiki.com/Items#Shadow_Items ~ Flag the item as non repairable, and when equipped just countdown its duration. Quote Discord: andresc Share this post Link to post Share on other sites
Angelix 374 Report post Posted December 25, 2016 13 minutes ago, Totoka said: Hey faller, and what about using something like this? > Lineage 2: https://l2wiki.com/Items#Shadow_Items ~ Flag the item as non repairable, and when equipped just countdown its duration. There was an item like that, can't remember the name, but it was a sword that could be obtained from treasure chest by using the hunter npc from ToP2. You obtained the sowrd with X durabilty, if you died, sword dropped and its location was brodcasted in system for others to grab it, if its durability went to zero, the sword was removed from your inventory. 1 Quote Share this post Link to post Share on other sites
Keuvyn T. 3 Report post Posted January 14, 2017 Good evening friends, How can I use the function to make a sword disappear after 2 hours of the inventory of the player? Note: Starting from when he receives it the sword. He can use the sword. Quote Share this post Link to post Share on other sites
Faller 93 Report post Posted February 2, 2017 Hello @Ximboliex! I just tested the script you have shared, and sadly it didn't seem to work. Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted February 2, 2017 5 hours ago, Faller said: Hello @Ximboliex! I just tested the script you have shared, and sadly it didn't seem to work. If you strip the provided code, you will see that the code has semantic errors: On 12/21/2016 at 10:39 PM, Ximboliex said: if mins > 0 then SetItemAttr(Bag_Item,ITEMATTR_URE, -1) elseif mins == 5 then SystemNotice(role,"the item will dissappear in seconds.") SetItemAttr(Bag_Item,ITEMATTR_URE, -1) elseif mins <= 0 then DelBagItem ( role , ItemID , 1) return end setting your item to -1 and then takes the item before you can use it. On 12/21/2016 at 10:39 PM, Ximboliex said: local hours = 0 hours = hours * 3600 local days = 0 days = days * 86400 Useless variables. On 12/21/2016 at 10:39 PM, Ximboliex said: local days = 7 days = days * 86400 local ItemID = --put item id here! item = GetChaItem2 ( character , 2 , ItemID ) SetItemAttr(item, ITEMATTR_URE, days) At some point and if not careful, your ITEMATTR_URE value will exceed the maximum number it can store. Just want to point that there are better functions that already exists. Try looking for Evil Sword¡¤Soul Eating On 12/25/2016 at 3:34 AM, Angelix said: There was an item like that, can't remember the name, but it was a sword that could be obtained from treasure chest by using the hunter npc from ToP2. You obtained the sowrd with X durabilty, if you died, sword dropped and its location was brodcasted in system for others to grab it, if its durability went to zero, the sword was removed from your inventory. 2 Quote Share this post Link to post Share on other sites