Can someone please tell me excatly; how to connect variable and gameobjects?
Imagine; our Mission is firing the fireplace
After we found some objects and combine each other, we can finally heat up our firing place.
Now the mission is done.
So I create a local variable "FireInTheHole", type "boolean" I marked it "false" as initial value (what is difference between local and global?local is for scene, global is for game?)
And I create a cutscene, and it checks variables
source:"local", compare with "entered value"
"FireInTheHole", "equal to", "true", lets start action.
Now everything is perfect.
I have particle system for fire. It is invisible at the beginning, it becomes visible when we do correct moves.
So how we connect this gameobject visibility to this "FireInTheHole" variable?
Comments
Attach a ParticleSwitch script to your particle system, and when you set your variable to true, use the Object: Send message Action to pass "Turn On" to the system - this will turn it on.
Since the state of particle systems are not saved, you will have to create an "On load" cutscene that sets the state manually. Simply check the variable as you have done before, and then either send "Turn On" or "Turn Off" as appropriate.
Inside the Variables Manager (in the main Game Editor window), look for the Local Variables section and click Create new Local Variable. Be sure to do this when in the same scene as your particle system, as this variable will live in the scene in which you click this button.
Leave the new local variable's type as a Boolean (this is like an on/off switch), and set it's label to something like "Fire is on". If your game starts with the fire off, leave the variable's Initial value as False.
Then, you can use the Variable: Set Action to change this value in-game. For example, when your puzzle is solved, call this Action, setting the Source to Local, selecting your local variable, and setting it to True. In a separate Cutscene, create a Variable: Check Action to query the value of this variable. When the value is True (i.e. the fire is on, use the Object: Send message Action to turn on the particle system in the way I described above). When False, turn it off with by doing the same but passing the message "Turn Off". You can use the ActionList Editor window to better visualise this chain of Actions, since you can wire them up in a WYSIWYG way.
Then, call this Cutscene whenever you want your game to decide whether or not the particles should be on: you ought to call it whenever the local variable's value is changed, and when your game loads this scene. You can call a Cutscene from any other by using the Engine: Run ActionList Action.
This video tutorial is somewhat out of date so far as the look of the interface goes, but the principles are the same.