Hi I'm trying to use a value to turn invisibility on and off but the CD only changes invisibility once and stays that way. Why? Does it have something to do with Abilities? Sorry, I'm only just starting to figure out values and they're kinda confusing. I attached my screenshots of where I think the problem is. Thanks for your help!!
Hi @MutantTreeFrog! Don't worry, learning is a lifelong process we learn new things all the time when we code!
So just to make sure when you tap your CD, do you want it to:
- Turn off if it's already on
- Turn on if it's already off
Since we're using the value "Ocean Surf" for the invisibility of the CD, we can rewrite the dot points above using your value:
- Set Value "Ocean Surf" to 100 (off) if it's already 0 (on)
- Set Value "Ocean Surf" to 0 (on) if it's already 100 (off)
Planning out the steps helps us to visualise what we need to do
So using more code-like language and just re-arranging it, we have this:
- Check if "Ocean Surf" = 0 (on), Set Value "Ocean Surf" to 100 (off)
- Check if "Ocean Surf" = 100 (off), Set Value "Ocean Surf" to 0 (on)
And in code it looks like this:
So what it's doing is the same thing:
- Check if "Ocean Surf" = 0, Set Value "Ocean Surf" to 100
- Else (this means just otherwise, check if "Ocean Surf" ≠ 0 which includes when "Ocean Surf" equals 100)
- Set Value "Ocean Surf" to 0
Make sure you use the Check If Else block otherwise it might not work.
Whew! I hope that helps and if any bit is unclear or confusing please let me know and I will try to explain it more clearly and if it doesn't work let me know too and we'll try and work out what's going wrong
Remember to set invisibility to the value