Jump to content
Sign in to follow this  
gunnapong

item time limit

Recommended Posts

hello, i want to Weapons or outfits with a time limit of 7 days. If after 7 days the item will disappear or become unusable, I would like to know how we should code it.

Share this post


Link to post
Share on other sites

Hello @gunnapong,

 

Sample Algorithm:

1) Add a characteristic to the item with an ID <ID> that will record the time that the item has been in the player's bag in the function Creat_Item() (check this topic);

2) In the cha_timer() function:

2.1) Search for the items with ID <ID> (GetChaItem());

2.2) Read the time characteristic from the item (GetItemAttr());

2.3) Check that characteristic is equal to value 604800. Remove the item if this is true;

2.4) Otherwise increment the characteristic by 1 and update the item (SetItemAttr()).

2.5) Repeat 2.1 - 2.4 for all items with ID <ID> in the player's bag.


Share this post


Link to post
Share on other sites
14 hours ago, V3ct0r said:

Hello @gunnapong,

 

Sample Algorithm:

1) Add a characteristic to the item with an ID <ID> that will record the time that the item has been in the player's bag in the function Creat_Item() (check this topic);

2) In the cha_timer() function:

2.1) Search for the items with ID <ID> (GetChaItem());

2.2) Read the time characteristic from the item (GetItemAttr());

2.3) Check that characteristic is equal to value 604800. Remove the item if this is true;

2.4) Otherwise increment the characteristic by 1 and update the item (SetItemAttr()).

2.5) Repeat 2.1 - 2.4 for all items with ID <ID> in the player's bag.

Thanks for answering me, I would like you to try writing some working code for me. @V3ct0r

Share this post


Link to post
Share on other sites
On 9/25/2022 at 5:52 AM, gunnapong said:

Thanks for answering me, I would like you to try writing some working code for me. @V3ct0r

Maybe someday I will develop such a mod.

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...