Timer won't stop

MissKerrigan

Active Member
Reaction score
23
Hey I create a trigger: 'destroy timer' but the timer still keeps counting
Does anybody knows what's going on here?

MissKerrigan

(omg, spend 2 hours yesterday to change 2 little things in the editor!!)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
please when you have any kind of trigger problems with something you have already attempted, do this:
[noparse]
Trigger:
  • right click it, copy as text, and past it in these wc3 tags
[/noparse]
 

MissKerrigan

Active Member
Reaction score
23
In the start of the game I create repeating a timer every 60 seconds countdown

Wave 50 is the last wave, so I create the trigger:

event: wave 50 starts

condition: none

action: destroy timer window 'last created timer' (can't select other timers here)

In the game the timer still keeps counting down from 60 seconds
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
(Last created timer window) doesn't work between triggers. In that trigger, there is no last created timer since you haven't created a timer in that trigger.

Therefore it destroys no timer window. So how do we fix this?

Well, first of all you need a global variable of the Timer Window type. Then go into the trigger where you first create your timer window and create the action "Set variable" below it. Set your timer window variable to the Last created timer window. This will work since in this trigger, you have created a timer window so in this case (Last created timer window) actually refers to something.

Then you go into the trigger where you want to destroy the timer. Change (Last created timer window) to your global variable.

You said you can't select other timers there. That's because you're only looking at functions. There's preset, variable and custom script as well.

In this case, since we saved our timer in a variable, we want to go to the variable tab and pick your global variable.

I hope this helps.

Edit: Changed timer to timer window. My bad. thanks for pointing it out Dave.
 

Dave312

Censored for your safe viewing
Reaction score
269
Just to clarify, the action you are trying to use destroys a timer window not a timer. As such, you are only able to select a parameter of the type Timer Window not Timer. Most likely you will still want to destroy the timer window so do what Siretu said but change the variable to the type Timer Window.

Even after you destroy the timer window, the timer will continue to run (you just won't be able to see it on screen). Use the Pause/Unpause Timer action to stop the timer from running.
 

MissKerrigan

Active Member
Reaction score
23
I don't understand anything about global variables
For me it's even more difficult than soccer! haha

but I already got it!
I made a trigger which is just only the timer
And in the 'wave 50' trigger I simple turned off the timer trigger

MissKerrigan
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Do you know what a variable is?

In each trigger there are several parts. Events, Conditions, Local variables and Actions. I assume you know how events, conditions and actions work.

A variable is a place where you can store data. If I have a string variable, I can store a string in it. Let's say I store the string "foo" in my variable x. Then every time I want to get the string "foo", I could just refer to the variable x.

You can store other things as well such as timers and integers and a lot of other things.

You can create a variable in two places, locally in your trigger and globally. What's the difference? Well, local variables can only be used inside that specific trigger. No other triggers can see them.

A local variable is created in local variables in your trigger. A global variable is created in the list to the left where all your triggers are.

You can create a variable by right clicking in the right place(either in your trigger to make a local one or in the list to the left to make a global one) and selecting New > New Variable. You can also click ctrl+b.

When you create the variable, you get to choose a name. The name can be changed later on by right-clicking and pressing rename. The only thing you have to worry about in the variable for right now is the part that says "Type". That is where you change the type.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
global variables are basically a form of storing data to be used in triggers, they can save almost anything from unit groups to numbers to strings to players and they can have indexes or save multiple pieces of data for a specific set of integer values ie: (variable[1-10]) every number from 1 to 10 can hold its own unique data of one type for that variable
 

Sevion

The DIY Ninja
Reaction score
413
A variable is something that stores either data or an address pointing to data.

A variable that stores the address pointing to data is known in the Object Oriented Programming (OOP) world as a Pointer.

Pointers don't exist in Galaxy/StarCraft II GUI, so we'll just stick to explaining variables that store data.

Basically variables are like a cardboard box. You make your variable, shove some data in, and later you can use the data inside of it.

I can make a unit variable (a cardboard box that only holds objects of type unit) and shove a Zergling into there. Now I have a cardboard box with a Zergling in it (a specific Zergling in this case).

Later on, I can open that box and pull out that Zergling and say "Oh, in this box, there is Zergling #51895."

With that, I can use Zergling #51895 for whatever I want. I.E. Killing it. Calling a kill event on that variable will kill Zergling #51895.

I can also pull Zergling #51895 out and put say..... Marine #8715 into it.

Now the cardboard box (the variable) holds Marine #8715 and I can do whatever I want to Marine #8715 by referencing the variable.

You can also put "NULL" into it. That is, in effect, pulling Marine #8715 out and putting nothing, "NULL", into it.

That, in essence, is what a variable is.

To understand scope, you only need to really know three different things:

Static, Global, and Local.

Locals are only usable in their respective functions.

Globals are usable everywhere.

Statics are only usable in the Galaxy file they're declared in (don't need to worry about this unless you're using advanced Galaxy programming like in my tutorial here).
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293

MissKerrigan

Active Member
Reaction score
23
well I tried few things but I still don't understand grrr

Well I'm a dutch girly so for me it's hard to understand this

I know a variable is something to store things but I don't understand the following thinig:


If I create a variable 'unit type' Jim Raynor I can use this later in trigger, I know

But why does starcraft not make values of units so I just can select Jim Raynor in the trigger actions

Example:

Event: 'unit enters region' (only possible to set this on 'any unit')

Condition: none

Action: 'kill unit in region' (they must make a value of all units here so you just can select the unit you want instead of this stupid variables)


Well, it doesn't matter actually, I already made a few maps without variables

MissKerrigan
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you could use variables if you wanted to do the same thing with other unit types; IE:

spawning units in the middle of the map

every 5 seconds you create a unit type of variable_X at the center of the map

every time you do this you change the unit typ of variable_X

60 seconds in you now have 12 unique units
 

Sevion

The DIY Ninja
Reaction score
413
I'm not sure what you mean by "must use a variable".

You can select preplaced units in actions and conditions. You can also use units through event responses (I.E> Triggering Unit).

And in your example you can use specific unit-types. You don't have to use a variable.

In my experience, variables make just about everything a lot easier, but you don't have to use them.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
The reason you can't use your unit-type variable in those actions is because they take a unit variable.

A unit is not the same thing as a unit-type. They're two different variable types.

One metaphor for this would be cars. A specific car model is a unit-type while MY car is a unit. Does this make more sense?

So if you wanted to use "Unit enters region", you would use any unit and then a condition that looks like: "(Unit type of (Triggering Unit)) == Jim Raynor"

If you want to kill a unit in a region, how would the trigger know what unit to kill? Do you want to kill a random one? There's a function that picks a random unit in a region.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top