Icon | ![]() |
---|---|
Name of gadget | Variable Modifier |
Section | Logic & Processing |
Number of Tweak pages | 1 |
Author | LadylexUK, QuietlyWrong |
Last updated | 27 Feb 2019 [Beta] |
Description
This gadget modifies or reads a named Variable gadget. It works wirelessly and you can have any number of modifiers associated with one variable, so it can keep your logic tidy and legible. There are options that allow you to make a change in a one-off pulse, for example adding gold to your purse when you sell an object, or to change it continuously over time, such as reducing your fuel while you are firing the thrusters on your rocket-ship.
You could use a variable and variable modifier as a health gadget to track the player’s health but the dedicated Health Modifier (used with a Health Manager) is normally a better choice.
Example Tutorial (adapted from Media Molecule)
See Variable
Tweak Menus
![]() |
|
- Variable Name
Add the name of the variable you wish to modify here. The name is case-sensitive. Unless you have dozens of variables, it’s easiest to select from a list of existing variable names by hovering the mouse tip over this box and pressing up or down on the d-pad to cycle through them – this reduces the chance of a misspelling breaking your logic. Don’t forget to actually create and name your variable first though! - Operation Type
- Set
Use this to change the value of the named variable directly, to the value of Operation Value (4.). - Get
Use this to read the value of the named variable and output it to Variable Value (5.). - Add
Increases the variable value by the value in Operation Value (4.) – and of course you can “subtract” by “adding” a negative number. - Reset
Returns the variable to its default value.
- Set
- Update Type
Dictates when the Variable Modifier actually modifies or reads the named variable:- When Powered On
Only operates at the split-second when the “Power” status of the gadget switches from Off to On. It will then do nothing more until the Power is turned off (and then on) again. - Continuously
Continuously updates the value of the named variable (or outputs its value) as long as the gadget is powered on. Used with the “Add” operation, this will keep the variable value changing.
- When Powered On
- Operation Value
Used by Operation Types “Set” and “Add” only, it is the value in this field that either replaces the named variable’s value or is added to it. - Variable Value
Used by Operation Type “Get” only, this outputs the current value of the named variable, no matter where it is in your level. - Power
This is where you turn the gadget on/off
I’m having a bit if trouble figuring out how to cause an action when a variable is set to a specific number, in particularly while pressing a button on the controller.
I thought I could accomplish this with an AND Gate, but it doesn’t seem to work.
LikeLike
Wire your button to the power of a variable modifier that is set to change your Variable (make sure the name of your variable and the referenced variable in your modifier is the same). Use set and the number of your choice. No AND gates required. Now this variable is permanently changed. You could use a timer powered at the same time and attached to another variable modifier to revert it back after a second or two if you need the action that is controlled by the variable to be activated numerous times (however if you are wanting to have an action on a button press a variable is not really the correct method).
LikeLike