I’m now experimenting with triggers. I have figured out how to use triggers to start level sequences. But, I’m stumped about how I can make a trigger work under special conditions; such as if an unrelated object’s integer variable is greater than or equal to 0. What would I need to do, to make sure the trigger does not work unless another object’s variable is set this way?
You would need to get a reference to the actor that has the variable you want to check. From there you can get their variables and do all the checks you need. Getting references is a pretty hard topic to learn when starting out, but there’s some tutorials that explain the concept pretty well.
Do you know of any tutorials with examples? I have tried casting to objects and using branches, but UE was pretty picky about that.
its been a long time since I learned about references, so I wouldnt remember which tutorials are good, but I should be able to help you with your specific case. Can you tell me more about what your trying to do? What actors variables do you need?
I have been working on a puzzle demo, on which I’ve made progress, thanks majorly to ClockworkOcean. The puzzle involves “powering up” cubes by connecting them to a “starter” cube that charges any adjacent “conductor” cubes. Halfway through one of five levels, I have a trigger that, when stepped on, causes a cube to rise and charge the pipes. I want to see if I can set the puzzle to where the level sequence raising the cube will not occur until all objects before that point are “powered.”
Hopefully, these screenshots will help give you an idea on what I mean.
The pole is the charger, and the cubes touching the pole and each other are “powered up.”
Right here is the box trigger in question.
Notice how the pipes in the bottom-right are charged but the ones on the left are not. There’s a charging cube that will rise when triggered, but I want to set the trigger to not work unless everything before this point is “charged.”
I’ve figured out the solution. What I needed to do was reference a particular object and set the trigger to work only when the integer associated with the object is greater than 0. You see, when a conductor is “powered up,” its “Lifetime” integer is set to a number higher than 0 and will not tick away as long as it’s touching other powered objects. So, as long as that last pipe’s Lifetime is 0, the trigger will not work. Anyway, thanks for your help and for your suggestion.