Event - Real Variable change

Vassilev

New Member
Reaction score
39
I'm so used to Wc3's trigger Event where u could detect a change in Real variable.

e.g.:
Event
Real variable == 1.00

Can't seem to find it in sc2, is there even one?
 

Rushhour

New Member
Reaction score
46
What did you use it for? :O I never used that one.

Tell me what you want to do and I will may be able to show you how to do it in another way :D
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,228
Trigger:
  • Comparison
    • Value 1: Arithmetic (Real)
      • Value 1: Real Variable
      • Operator: +
      • Value 2: 0.0
    • Operator: ==
    • Value 2: 1.0


Condition: Math --> Arithmetic (Real) --OR-- Arithmetic Multiple (Real) --> Do your comparison there.

You should read every single event, condition, and action descriptions for you to fully utilize everything SC2 gave you. :)
 

Vassilev

New Member
Reaction score
39
>>> Rushhour

i want a trigger to run when a variable is changed something like

Event:
Scene_Count (Real variable) is Equal to 1.00
Conditions
Actions
...

>>> tom_mai78101
That's conditions, not an Event.
 

Rushhour

New Member
Reaction score
46
Yep, I know that the event exists, but I can't imagine any situation where I would need to be forced to use it.

Since variables can only be changed in the script you can easily spot all places where the variable gets modified.

When there are too many places the variable gets modified you should create an own "SetVariableXY" action. This action should take the new value the variable is set to as a parameter.
Then it should do this:
1. Check if it changed (compare new value to old value) and store that in some local variable.
2. Actually set the variable to the new value given by the parameter.
3. Filter with an If-statement if the variable changed (or reached a certain limit or got bigger/smaller,...)
4. Do the stuff you would do in your trigger.
 

Vassilev

New Member
Reaction score
39
>>> Yep, I know that the event exists, but I can't imagine any situation where I would need to be forced to use it.

it's more of my personal preference in method of coding.

>>> This action ....

That's an action, not an event

You see, all I want is a trigger to RUN, when a variable BECOMES a certain value because it's so much easier for sequential triggers.

Take for example:
Trigger 1
Event - Map initialization
Action
- create units, bla bla bla
- Run trigger 2

Trigger 2
Event - No event
Action
- create units, bla bla bla
- Run trigger 3

versus

Trigger 1
Event - Map initialization
Action
-create units, bla bla bla,
- Set Round_Timer = Round_Timer + 1

Trigger 2
Event - Round_Timer = 2.00
Action
-create units, bla bla bla
- Set Round_Timer = Round_Timer + 1

As you can see, the latter is much easier to do cuz all I need to do is copy "- Set Round_Timer = Round_Timer + 1" instead of changing which trigger to run (e.g. Run trigger 3/4/5/6..) every single time.


Warcraft 3 editor had this specific EVENT to detect variable change.

Nevermind.... I think i've searched all the events available and it just doesn't exist in sc2.... sigh....
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • jonas jonas:
    Is the school system in your country similar to Chinese school system? I could never imagine being a teacher in a Chinese school, what's expected of students and teachers is just so different from what I'd be looking for as a teacher
  • vypur85 vypur85:
    A Levels is based on the UK syllabus offered internationally. So the syllabus is similar throughout different countries, taught in english.
  • vypur85 vypur85:
    I can't speak or write or read much chinese... Too difficult....... Which also makes my life here in china a lil difficult.
  • jonas jonas:
    Oh, I see. I thought Chinese version of A-levels :D
  • jonas jonas:
    I've been using the translate app a lot on my phone. take a photo, translate. take another photo, translate again :D
  • jonas jonas:
    it also has voice translation, my colleagues sometimes use that
  • jonas jonas:
    You came during the 0 covid policy right? How'd you get through quarantine? Did you have some help with the apps and green codes?
  • tom_mai78101 tom_mai78101:
    If you have any Chinese you need help with, let me know.
    +1
  • vypur85 vypur85:
    @jonas Those were the things I did too. Translate app and VPN are always the most important things to have to survive. Lol.
  • vypur85 vypur85:
    Yea I came last year. I was quarantined for about 30 days. Fml. The first day of my quarantine was the eve of Chinese new year last year. Fml again... Lol.
  • vypur85 vypur85:
    @tom_mai78101 IIRC you're from Taiwan right.
  • The Helper The Helper:
    I thought China had cracked down on having any foreign teachers?
  • vypur85 vypur85:
    Yeah I've heard of the news before. My school is still actively hiring foreign teachers. Not sure how things work now.
  • The Helper The Helper:
    yeah it is hard to get reliable information about that kind of stuff
  • The Helper The Helper:
    but you are doing it so it is still doable
  • vypur85 vypur85:
    I think it doesn't affect existing foreign teachers. Then again, its still weird that my school is hiring.
  • The Helper The Helper:
    Happy Monday people hope everyone has a fantastic week!
  • Ghan Ghan:
    Happy Monday?! That's a contradiction.
  • jonas jonas:
  • jonas jonas:
    please put this in the news section, it's crazy
  • tom_mai78101 tom_mai78101:
    Technically, you can post in the Headline News. Just posted your news there.
  • tom_mai78101 tom_mai78101:
    I'm not aware of you not being able to post news.
  • jonas jonas:
    I think technically I can I just forget how
    +1
  • The Helper The Helper:
    Happy Thursday!

    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