#🙋 | image change when player takes damage

1 messages · Page 1 of 1 (latest)

jolly ether
#

is there a way to change image to the other one when player takes damage?

crisp knotBOT
# jolly ether is there a way to change image to the other one when player takes damage?

You can do this by toggling which image is visible with a variable that gets flipped whenever the player takes damage.

  1. Create two Image elements: one for normal state, one for “damaged”.

    • Give each a loading requirement that checks a FM variable (e.g., damage_flash). The normal image shows when damage_flash is false, the damage image shows when it’s true. Use the Is Variable Value (FM Variable) requirement (docs: Variables ).
  2. Add a listener: open Customization → Manage Listeners (see Listeners docs) and make an On Damage Taken listener.

    • In the action script, set damage_flash:true when it fires.
    • Then use a Ticker (or another listener action) to wait ~0.5s and set damage_flash:false again so the image goes back. You can use a Ticker element that resets the variable after a short delay (e.g., tick once, set variable false, stop).

That way the “damaged” image is only visible shortly after damage is taken while the normal image stays hidden during that time.

jolly ether
#

how to make the image changed for longer, let's say 3 seconds?

crisp knotBOT
# jolly ether how to make the image changed for longer, let's say 3 seconds?

Use a timer to keep the “damage” image visible for 3 seconds. One easy way:

  1. Variable logic: Keep what you already have — a variable like damage_flash that your two Image elements use as loading requirements (normal image shows when the variable is false, damaged image when it’s true).

  2. Listener + Ticker: Keep your On Damage Taken listener that sets damage_flash:true.

    • After setting it to true, also start a Ticker (set to tick once every 100 ms or so) that waits about 3 seconds and then sets damage_flash:false again.
    • You can configure the Ticker’s action script to run something like:
      ▶ Set Variable Value (damage_flash:false)
      ▶ Stop Ticker
      
      after it has counted enough ticks (use the Ticker’s tick delay and mode to cover roughly 3 seconds).
    • Docs: Listeners and Tickers via Action Scripts (add actions inside a Ticker).

That keeps the damage image active for about 3 seconds before reverting back automatically.

jolly ether
#

wait, back to step 1 in previous message. I added "is variable value", put variable name as "damage"... and now do I put this true/false things in "variable value to check for", or somewhere else?

crisp knotBOT
# jolly ether wait, back to step 1 in previous message. I added "is variable value", put varia...

In the Is Variable Value (FM Variable) requirement you add to each Image:

  1. Set Variable Name to damage (or whatever you named it).
  2. Set Variable Value To Check For to either true or false, depending on which image should show:
    • Normal image: requirement checks for false → it only draws when damage is false.
    • Damage image: requirement checks for true → it only draws when damage is true.

The listener and ticker will flip that variable (use the Set Variable Value action) when you take damage and after 3 seconds, so the correct image appears.

jolly ether
#

I made a listener, I'm a bit confused on how to set the damage_flash:true thing now

crisp knotBOT
# jolly ether I made a listener, I'm a bit confused on how to set the damage_flash:true thing ...

In your On Damage Taken listener you need to add an action that sets the variable.

  1. Open the listener and click Add Action → choose Set Variable Value (FM Variable).
  2. In the action’s value input write damage:true (or damage_flash:true depending on your variable name).
  3. That action will run whenever the listener fires, so the variable becomes true and your “hurt” image shows.

If you also want it to revert after 3 seconds, have a Ticker run after the listener (or inside the listener via a Start Ticker action) that waits 3 seconds and then runs damage:false with another Set Variable action.
See the docs for more on listeners and action scripts: Listeners and Action Scripts.

jolly ether
#

Okay...
On image A that's when I'm not taking damage I got a loading requirement "Is variable value" with variable name "Damage" and variable value to check for "false"
On image B that's when I'm taking damage I got a loading requirement "Is variable Value" with variable name "Damage" and variable value to check for "true"
In listeners I have "On damage taken", with Set Variable Value with action input being "Damage:true"
It doesn't seem to work, I only see image B, even if I'm not taking any damage, taking damage doesn't change anything

crisp knotBOT
# jolly ether Okay... On image A that's when I'm not taking damage I got a loading requirement...

Two things to fix:

  1. Make sure the variable actually starts as false:

    • Go to Customization → Variables → Manage Variables, create Damage if it doesn’t exist, and set its value to false.
    • Without that, the requirement on Image A never passes so you always see Image B.
  2. Reset it after the hit:

    • The listener setting Damage:true works, but you also need to switch it back to false after ~3 seconds.
    • Add a Ticker (tick delay 1000ms, tick mode “Custom”) that runs every second and, after 3 ticks, executes Set Variable Value: Damage:false and stops itself.
    • Start that ticker from the listener (e.g., add an action after setting Damage:true that enables the ticker or use the ticker itself with a loading requirement tied to a helper variable).
    • Alternatively, inside the listener add a short action script (use the Calculator + Sleep via ticking) to delay before setting Damage:false, but ticking is easier.

That way Image A is shown until Damage is flipped to true, Image B shows while the listener-triggered timer keeps it true, and after 3 seconds the ticker flips the variable back so Image A reappears.

jolly ether
#

Okay, setting variable Damage to False helped, now I get image A that changes permanently into image B after I take damage. How exactly do I add a ticker?

crisp knotBOT
# jolly ether Okay, setting variable Damage to False helped, now I get image A that changes pe...

Nice, you’re almost done! To auto-reset Damage after ~3 seconds, add a Ticker that only runs while Damage is true and counts ticks until it flips the variable back:

Steps

  1. Create a Ticker element

    • Right-click the editor background → New Element → Ticker.
    • Set Tick Delay to 1000 (1 second) and Tick Mode to Normal (the ticker will run every second while it’s active).
  2. Limit it to the damaged state

    • Right-click the ticker → Loading Requirements → Is Variable Value (FM Variable)
      • Variable name: Damage
      • Value to check for: true
        This ensures the ticker only runs while Damage is true (i.e., the hurt image is shown).
  3. Give the ticker an action script

    • Open Edit Action Script for the ticker.
    • Add two actions:
      1. Set Variable Value
        • Value: damage_ticks:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"damage_ticks"}} + 1","decimal":"false"}}
          (This increments a helper variable damage_ticks every second.)
      2. IF statement with requirement Is Number comparing damage_ticks to 3 (use getvariable there again). Inside its block:
        • Set Variable Value → Damage:false
        • Set Variable Value → damage_ticks:0
    • That way, after the ticker runs three times (≈3 seconds) it flips Damage back to false and resets the counter. Since the ticker’s loading requirement now fails, it stops running until the next hit.
  4. Create/initialize the helper variable

    • Go to Customization → Variables → Manage Variables and add damage_ticks, default value 0. (It needs a starting value for the calc to work.)
#

If you want, you can also use the same variable logic to show debug text or change other elements. For details on scripting and variables, see the docs: Action Scripts and Variables.

jolly ether
#

can you expand on the "IF statement with requirement ..." point?
so far I put "Number: damage_ticks", and "compare to number: 3", but I'm not sure if I didn't mess something up, not sure what to do with "getvariable" you're talking about

crisp knotBOT
# jolly ether can you expand on the "IF statement with requirement ..." point? so far I put "...

Sure! Here’s how to build the IF block properly:

  1. Add the IF statement inside the ticker’s action script (right-click ticker → Edit Action Script → Add “IF Statement”).

  2. Add the requirement to the IF block:

    • Click the little “Add Requirement” button on the IF entry.
    • Choose Is Number.
    • Set:
      • Number:
        {"placeholder":"getvariable","values":{"name":"damage_ticks"}}
        
      • Compare With: 3
      • Comparison Mode: bigger-than-or-equals
        This way the IF only runs once damage_ticks reaches 3.
  3. Inside the IF block, add two actions:

    • Set Variable Value → Damage:false
    • Set Variable Value → damage_ticks:0
  4. The ticker’s first action (before the IF) should increment the counter:

    {"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"damage_ticks"}} + 1","decimal":"false"}}
    

    Use that inside a Set Variable action with value damage_ticks:<calc placeholder>.

So the ticker increments damage_ticks each second. Once it hits 3, the IF runs, resets the counter, and flips Damage back to false. Because the ticker only runs while Damage is true, it stops until you take damage again.

If you need a refresher on building action scripts or using placeholders, check the docs: Action Scripts and Variables.

jolly ether
#

I did evertyhing you said, but I'm stuck on 4th point, the first action (Set variable value) looks exactly like that, but I'm not sure where to place "Use that inside a Set Variable action" part exactly

crisp knotBOT
# jolly ether I did evertyhing you said, but I'm stuck on 4th point, the first action (Set var...

The first action (before the IF) needs to be a Set Variable Value action that increments damage_ticks. Here’s exactly how to fill it:

  • Action type: Set Variable Value
  • Value input:
    damage_ticks:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"damage_ticks"}} + 1","decimal":"false"}}
    

This means: take the current damage_ticks, add 1, and store it back into damage_ticks every tick. Make sure this action is above the IF block inside the ticker’s action script so the counter increases before the IF checks it.

So the full script order is:

  1. Set damage_ticks to damage_ticks + 1 (as shown above)
  2. IF damage_ticks >= 3 →
    • Set Damage:false
    • Set damage_ticks:0

That makes the ticker count up to 3 seconds, then reset everything.

jolly ether
#

I did everything exactly like you said, and image B still doesn't change back to image A, no matter how long I wait

crisp knotBOT
# jolly ether I did everything exactly like you said, and image B still doesn't change back to...

Let’s simplify it so the ticker does the timing for you instead of manually counting ticks:

  1. Ticker setup

    • Add a Ticker (right-click background → New Element → Ticker).
    • Set Tick Delay to 3000 (3 seconds).
    • Leave Tick Mode on “Normal”.
    • Give the ticker a Loading Requirement: Is Variable Value → variable Damage, value true. That means the ticker only starts ticking when the damaged image is active.
  2. Ticker action script

    • Open the ticker’s action script.
    • Add a single action:
      Set Variable Value
      Value: Damage:false
      
    • Optionally add another action to reset a counter if you’re still using one, but it’s not needed.
  3. What happens

    • When you take damage, the listener sets Damage:true → Image B shows and the ticker becomes active.
    • After 3 seconds the ticker fires once, sets Damage:false, and since the loading requirement now fails, the ticker stops automatically.
    • Image A shows again.

Make sure the Damage variable starts as false in Customization → Variables → Manage Variables so you don’t start stuck on Image B.

Docs you might need:

jolly ether
#

okay... that works, but now, no matter the tick delay, image changes basically imideatly after I stop taking damage

crisp knotBOT
# jolly ether okay... that works, but now, no matter the tick delay, image changes basically i...

Right, that happens because tickers always fire their first action immediately when they become active — the Tick Delay only controls how long between subsequent ticks. So with your setup, the ticker sets Damage:false as soon as the hit ends, even if you set the delay to 3000.

To actually keep the hurt image visible for 3 seconds, make the ticker wait itself:

  1. Ticker settings

    • Tick Delay: 1000 (1 second)
    • Tick Mode: Normal
    • Loading Requirement: Is Variable Value → variable Damage, value true
    • (Create an FM variable damage_ticks and set it to 0 in Customization → Variables → Manage Variables.)
  2. Action script

    • First action: Set Variable Value →
      damage_ticks:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"damage_ticks"}} + 1","decimal":"false"}}
    • Add an IF Statement with requirement Is Number:
      • Number: {"placeholder":"getvariable","values":{"name":"damage_ticks"}}
      • Compare With: 3
      • Comparison Mode: bigger-than-or-equals
    • Inside the IF block add:
      • Set Variable Value → Damage:false
      • Set Variable Value → damage_ticks:0

Each tick increments damage_ticks; only when it reaches 3 does the IF fire and reset Damage back to false. Because the IF only runs on the third tick, you get ~3 seconds of hurt image even though the ticker’s first action runs immediately.

jolly ether
#

didn't we try it earlier and it didn't work? image is stuck at B again, instead of changing back to A

crisp knotBOT
# jolly ether didn't we try it earlier and it didn't work? image is stuck at B again, instead ...

Looks like the counting ticker still wasn’t resetting because the IF never triggered (or damage_ticks stayed at 0). Let’s simplify:

Use a second listener instead of counting ticks

  1. Keep your On Damage Taken listener setting Damage:true.
  2. Add another listener: On Variable Updated (set to watch Damage).
    • In its action script, add an IF that checks $$new_value equals true (use the listener variable $$new_value with an Is Text requirement or calc).
    • Inside that IF, add a Set Variable Value action Damage:false but wrapped in a Delay using a Ticker-style timer (easiest: add a Ticker triggered by another helper variable, or have the listener start a 3-second timer via a Ticker action).
    • Another idea: use the Action script → Add “Wait?” but there isn’t a wait action, so you still need a ticker or a simpler helper variable that the ticker watches.

However, the simplest fix is the previous ticker with counter — the problem was the counter never reset when you toggled back to false. Make sure:

  • damage_ticks variable exists and is reset to 0 whenever Damage switches to false (either in the ticker’s IF or in a separate action after the IF).
  • The ticker’s action order is: increment counter → IF counter ≄ 3 → set Damage:false, set damage_ticks:0.

If the IF never fires, open the ticker’s action script and double-check the Is Number requirement is pointing at {"placeholder":"getvariable","values":{"name":"damage_ticks"}} and comparison is bigger-than-or-equals with 3.

Still stuck? I can walk through your current ticker script step by step if you paste the action list.

jolly ether
#

how do I set watch of that variable to damage?

crisp knotBOT
# jolly ether how do I set watch of that variable to damage?

In the Manage Listeners screen, add a new listener and choose On Variable Updated [FM Variable]. In the listener settings:

  1. Set Variable Name to Watch → Damage (this tells FancyMenu to fire the listener whenever that variable changes).
  2. In the listener’s action script, you can now react to Damage flipping between true/false.
  3. Use the provided listener variable $$new_value (or $$old_value) inside requirements or actions—just treat them like placeholders (e.g., use an Is Text requirement checking if $$new_value equals true before starting your 3-second reset).

If you need the exact steps for the listener: see the Listeners documentation for the “On Variable Updated” section—there’s a short description and the runtime variables you can use.

jolly ether
#

ignore my last message, explain me again instructions on how to add that second listener

crisp knotBOT
# jolly ether ignore my last message, explain me again instructions on how to add that second ...

Sure! Here’s how to add the second listener (the “On Variable Updated” one) so it can react when Damage flips:

  1. Open Manage Listeners

    • Press Ctrl+Alt+C → Customization → Manage Listeners.
  2. Add a new listener

    • Click “New Listener” → choose On Variable Updated [FM Variable] from the list.
  3. Set the variable to watch

    • In the listener settings set Variable Name to Watch → Damage.
      That tells FancyMenu to fire the listener whenever the Damage variable changes.
  4. Add an IF so it only runs when it becomes true

    • In the listener’s action script, add an IF statement.
    • Give that IF an Is Text requirement with:
      • Text: $$new_value
      • Comparison mode: equals
      • Compare with: true
        (That makes the inner actions run only when Damage just turned true.)
  5. Inside the IF, reset the timer

    • Add actions like:
      • Set Variable Value → damage_ticks:0 (if you’re using the counter)
      • Set Variable Value → Damage:false after your ticker finished (or set a helper variable that the ticker watches).
      • You can also use this listener to flip another helper variable that lets your timer/ticker run for 3 seconds.
  6. Save the listener and test.

That listener fires the moment Damage changes, so you can start/stop whatever timer you’re using from there. The docs for this listener (and the $$new_value variable it exposes) are here: Listeners doc, On Variable Updated section.

jolly ether
#

Okay. I made a listener "on value updated". I don't have something like variable name to watch, I can only add actions or remove a listener

crisp knotBOT
# jolly ether Okay. I made a listener "on value updated". I don't have something like variable...

When you create the “On Variable Updated [FM Variable]” listener, there’s a small settings panel before the action list where you enter the variable name it should watch. If you already created the listener, just open it again and look at the top of that screen—it should show a field labeled “Variable Name to Watch” (it might default to variable). Replace it with Damage.

If you can’t find that field, close the listener and create a new one:

  1. Customization → Manage Listeners → New Listener
  2. Pick On Variable Updated [FM Variable]
  3. Right after picking it, the UI should show the “Variable Name to Watch” input—type Damage there before adding any actions.
  4. Then add your IF action / tick logic inside the action script.

Once that’s set, the listener will fire whenever Damage changes. You can use the provided placeholder $$new_value inside your requirement to check whether it was set to true before starting the timer.

jolly ether
#

I don't have something like this

crisp knotBOT
# jolly ether I don't have something like this

If the “Variable Name to Watch” input never showed up, it probably got skipped when you created the listener. The field only appears immediately after you pick On Variable Updated [FM Variable] in the “New Listener” dialog—before you add any actions. You can’t edit it later, so the easiest fix is to:

  1. Delete the listener you just created.
  2. Click New Listener → On Variable Updated [FM Variable].
  3. In the very first screen that appears, type Damage into the “Variable Name to Watch” field (that’s the one you were looking for).
  4. Then continue to add your action script (IF with $$new_value, etc.).

If you still don’t see that field, it might be scrolled off-screen—make sure you scroll up while the listener dialog is open.
For reference, here’s the listener doc section: Listeners (look for “On Variable Updated”).

jolly ether
#

very first screen after I create it is "add actions" one... I Checked twice, there's NOTHING like variable name to watch there

crisp knotBOT
# jolly ether very first screen after I create it is "add actions" one... I Checked twice, the...

Ah, I get it—SpiffyHUD’s dialog is a bit weird. When you hit New Listener → On Variable Updated [FM Variable], the first screen should have the “Variable Name to Watch” field at the top before you ever add an action. It’s easy to miss if you immediately click “Add Action” because the UI scrolls down.

So try this:

  1. Open Manage Listeners and delete that listener.
  2. Click New Listener → On Variable Updated [FM Variable].
  3. Without clicking “Add Action” yet, look at the top of the new listener screen—there’s a text box labeled “Variable Name to Watch”. Type Damage there.
  4. Now you can scroll down and add your action script (the IF checking $$new_value etc.).

If you still don’t see the field, it might be scrolled out of view. Scroll up—or resize the window—before clicking “Add Action”. Once the variable name is set there, it can’t be changed later, so make sure it’s correct before adding actions.

Let me know if the field really isn’t showing even before you add actions and I’ll figure out another workaround.

#
AI Answers Paused

@jolly ether paused AI answers for this thread. The bot will stay quiet until resumed.

#

🙋 | image change when player takes damage

#

<@&1365490168563372113>

Human Help Requested

@jolly ether has requested human assistance.

A human moderator will help you as soon as possible. In the meantime, you can continue asking questions to the AI support bot if you'd like.

The support team has been notified.

jolly ether
#

...I give up, I think bot is too far gone BelfryLOL