Issues With Variables

Xebarsis

New Member
Reaction score
7
I have a variable set for 0 on a trigger, and I want a different trigger to set the variable to 1. Unfortunately when I have Trigger 1 set the variable to 1, Trigger 2 does not recognize the change.

Code:
Trigger 1
    Events
        Game - Player 1 types a chat message containing "Hell", matching Exactly
    Local Variables
        HellMode = 0 <Integer>
    Conditions
    Actions
        UI - Display "HellMode is now set to 1." for (All players) to Subtitle area
        Variable - Set HellMode = 1

Code:
Trigger 2
    Events
        Game - Player 1 types a chat message containing "Is Hell Mode turned on?", matching Exactly
    Local Variables
        HellMode = 0 <Integer>
    Conditions
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                HellMode == 1
            Then
                UI - Display "Yes, Hell Mode is ON!" for (All players) to Subtitle area
            Else
                UI - Display "No, Hell Mode is OFF!" for (All players) to Subtitle area

Even if I run Trigger 1, which is supposed to set HellMode to 1, Trigger 2 still tells me, "No, Hell Mode is OFF!" How can I make Trigger 1 set HellMode to 1 so that Trigger 2 can recognize it?
 

Frozenwind

System maker
Reaction score
99
You are using "Local Variables".

Let me teach you something about local variables.

Local variables are variables linked to one trigger (or actually one function, but let's say trigger to make it less complicated) only. Even if two triggers have the same local variable name, it will stay a different variable.
This is an awesome system to save things which may not ever be overwritten by some other trigger.


What you want are "Global Variables".
You can create one like a trigger, but now you use "New Variable". Choose it's name, type, init. value and eventually it's array and you can start using it!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top