• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Duration helmet

Toato

New Member
Joined
Nov 20, 2018
Messages
3
Reaction score
0
Hello, I wanna script to transfer helmet from ID to ID when i use X item on it then add duration for example 30 minutes and time runs out even if i am offline and not using it ( i mean if is it at my bp) tried with duration attributes but not changed so is there a way to do it without items.xml? i mean with action.lua


tfs 0.4
 
You're probably the same person who asked me on discord about this..

anyway, tldr from a recent conversation;

Set duration and start decay using a script when the item 'changes'.
Add a description to the item based on os.time().
Create an onLook event so the player isn't spammed with numbers.
Create a Login event, which scans a players inventory for all of these items, and adjust the duration of the item, to match with the os.time() that has passed and/or revert the item back to it's previous itemid if the item is 'expired'.

The only caveat is that items in the players depot have their duration paused as well.
I haven't looked, but there is probably some function that will let you scan through a players depot, and you can add various 'triggers' to find and alter those items as well.
- - (login/logout/stepping on/off depot tile/onThink maybe?/ -> server startup/shutdown) Gotta be careful though, since a depot can contain basically infinite items.

----
I don't know how the source code performs the duration bit, but I'm guessing it wouldn't be too hard to create another duration type that is based on os.time instead of a standard duration.

I don't know c++ at all, so I can't accurately comment on this portion.
----

Anyways,

Cheers.
 
Back
Top