• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Making a turn counter..

Status
Not open for further replies.
Level 9
Joined
Apr 14, 2020
Messages
63
I am a little lost on how to trigger a turn counter in with my income timer.

I currently have a timer going counting down from 60 starting at the initialization of the map.

What I would like to do is every time the counter hits 0, add a "turn" to a counter in the same timer.

So at map start "Turn 1 0:35"

ten minutes in.... "Turn 10 0:59"

etc.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
Not sure how your income timer is set up, but you could try this:

  • Map Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Turn = 1
  • Untitled Trigger 001
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
If your income timer cannot be stopped/paused at any point in game, then you may use just a periodic event instead of timer:
  • Untitled Trigger 001
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
 
Level 9
Joined
Apr 14, 2020
Messages
63
Not sure how your income timer is set up, but you could try this:

  • Map Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Turn = 1
  • Untitled Trigger 001
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
If your income timer cannot be stopped/paused at any point in game, then you may use just a periodic event instead of timer:
  • Untitled Trigger 001
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
I used a variation of this, thanks for pointing out the use of the variable to increase turn counts. I appreciate it!
 
Level 68
Joined
Dec 23, 2013
Messages
1,433
Not sure how your income timer is set up, but you could try this:

  • Map Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Turn = 1
  • Untitled Trigger 001
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
If your income timer cannot be stopped/paused at any point in game, then you may use just a periodic event instead of timer:
  • Untitled Trigger 001
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
This is going to sound astonishingly dumb, but how do I set up the variables to do that?

I am struggling hard here, and just about every guide says something like: "You'll need to create some variables to do this. Great, now that you did that, let's start showing you how to build the thing you were looking for!"
(Completely bypassing the "how to variable" part)

This is how I have my Timer window set up:
  • Turn Timer
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Create a timer window for MyTimer with title Turn
      • Set VariableSet MyTimerWindow = (Last created timer window)
      • Countdown Timer - Show MyTimerWindow
      • Countdown Timer - Start MyTimer as a Repeating timer that will expire in 60.00 seconds
 
Level 68
Joined
Dec 23, 2013
Messages
1,433
Variable editor at the top of the window. Make variables there. (You can also make them inside trigger categories if you want, but it's a little more clunky.)
I know that part, I mean every guide skips over which variables you need to make
A fellow on Discord helped me out yesternight, but goodness was it involved.

For those who don't know how to get started, here's what you do:
1 - Open your Trigger Editor and create a new folder called Variables
2 - Create a new global variable called "TurnTimer" and change the Variable Type to [Timer]
3 - Create a new global variable called "TurnTimerWindow" and change the Variable Type to [Timer Window]
4 - Create a new global variable called "Turn" and change the Variable Type to [Integer]
(Now your variables are all done)
Now you can begin setting up your Turn Counter like so:
  • Turn Timer
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Create a timer window for TurnTimer with title Turn
      • Set VariableSet TurnTimerWindow = (Last created timer window)
      • Set VariableSet Turn = (Turn + 1)
      • Countdown Timer - Show TurnTimerWindow
      • Countdown Timer - Start TurnTimer as a Repeating timer that will expire in 60.00 seconds
      • Countdown Timer - Change the title of (Last created timer window) to (Turn + (String(Turn)))
And you'll need this one to show the Turns going up after every 60 seconds
  • Turn Timer Count
    • Events
      • Time - TurnTimer expires
    • Conditions
    • Actions
      • Set VariableSet Turn = (Turn + 1)
      • Countdown Timer - Change the title of (Last created timer window) to (Turn + (String(Turn)))
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
I know that part, I mean every guide skips over which variables you need to make
I frankly don't understand how this could be confusing at all. Start building your trigger to do whatever you need it to do, and whenever you need to create a variable of a particular type to proceed (because you need to set, manipulate, or read that variable)... you just make that type. GUI has all the fancy blue fields you can click on to change parts of the trigger actions; in addition to it being generally obvious what type of object 'goes' in each 'field', you can also create a new variable of exactly the type you need for the field you are editing while in the field edit box.

When you make a timer window, you need to refer to a specific timer... so you make a timer variable.
Now you need to assign that timer window to a variable so you can manipulate it later... so you make a timer window variable.
That timer window needs to display the turn number on it, which is an integer... so you make an integer variable.

I'm being snarky to highlight that you're probably overthinking. I don't have some magical conception of all N variables I'm going to need in a trigger before I write it out... I just keep moving and make them ad-hoc as I need them on a line-by-line basis.
 
Level 68
Joined
Dec 23, 2013
Messages
1,433
What's obvious to you is Elvish to me, man. :peasant-cheers-back:
I can tell you all about bones, particle emitters, the effects of Bezier and Hermite nodes on an animation track, etc
But if you were to ask me what integer means, I wouldn't have an answer.

You are probably capable of scripting in your sleep, but might struggle to make terrain or custom models;
I'm the other way around, terrain and models come easy where triggering a basic function is a paralyzing slog.

The post above is for folks like me who haven't done this before and don't want to hassle others to do the work for us.
I should have included how to set up "Set VariableSet Turn = (Turn +1)", as it took me half an hour of blind trial and error.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I can tell you all about bones, particle emitters, the effects of Bezier and Hermite nodes on an animation track, etc
In my opinion the question "but what type should the variable(s) be" is just as silly as trying to follow a Blender tutorial and being stuck at step 0 asking "should it be a 3d or a 2d model?" Context clues.

If your native language isn't english and you're using the WE in english you can have a pass, but....
  • Not everyone has programming experience
  • Not everyone enjoyed/paid much attention during math

  • Most people should know what integers and real numbers are because they were in school for 9-16 years and those are the simplest two fundamental categories of numbers (blah blah rational vs irrational, yes you're correct whomever is reading this)
  • Most people do not know what a boolean is, but understand the concept of true/false implicitly
  • Strings are familiarity tossups, but their functionality/form could be determined by trying to assign something to a string variable
  • Most wc3 mapmakers should know what units, unit groups, timers, regions, items, etc. all are because they have played wc3 where those objects were used

  • When in doubt you can always make a variable of a particular type and then try to give it a (default) value; this will show you what type of 'thing' that variable type corresponds to. "Oh the box to enter the value only lets me type numbers, so an integer must be some type of number."
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
The post above is for folks like me who haven't done this before and don't want to hassle others to do the work for us.
I should have included how to set up "Set VariableSet Turn = (Turn +1)", as it took me half an hour of blind trial and error.
If you are complete beginner to WC editor, then you will struggle at first until you understand the way Blizzard set up the editor - that happened to all of us.
Anyway, you should check the Tutorials section on this site. For example there is tutorial about Variables
 
Status
Not open for further replies.
Top