Hi Kcat36! π
That's a super cool idea for a custom display! You can definitely do this using FancyMenu's new Listeners feature.
Here's how you can set it up:
-
Listen for the Totem Use Event:
- You'll want to use the
On Item Consumedlistener. This listener fires when the player finishes consuming an item. - You can then check if the consumed item is a totem of undying. You can do this with a condition in the listener's action script, using something like the
Is Textrequirement to check if$$item_key(the consumed item's identifier) contains "totem_of_undying".
- You'll want to use the
-
Start a Countdown Timer:
- Once the totem use is detected, you can use the
Set Variable Valueaction to set a FancyMenu variable to a starting time (e.g., settotem_cooldownto60for 60 seconds). - Then, you'll need a Ticker element to decrement this variable over time. Have the Ticker run every 1000 milliseconds (1 second) and use the
Set Variable Valueaction combined with theCalculatorplaceholder to subtract 1 fromtotem_cooldowneach tick, until it reaches 0.
- Once the totem use is detected, you can use the
-
Display the Timer:
- Finally, use a Text element in your layout and display the
totem_cooldownvariable using theGet Variable Valueplaceholder:{"placeholder":"getvariable","values":{"name":"totem_cooldown"}}.
- Finally, use a Text element in your layout and display the
It might sound like a few steps, but once you get the hang of variables and listeners, it's quite straightforward!
You can find more information about Listeners here: Listeners
And about Variables here: Variables
And here's some info on Action Scripts, which you'll use for setting variables and conditions: Action Scripts