• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Income timer + Income timer window issues

Status
Not open for further replies.
Level 3
Joined
Jul 18, 2008
Messages
42
Okay so I've been trying loads of different stuff... The problem I've been having though is that it seems like the timer window and "every x seconds of game time" don't go at the same speed or something...
The reason I think this is I had one trigger that was to make a repeatable timer, and then to turn on another trigger who's purpose was to give income every 60 seconds, through the "every 60 seconds of game time" event. But for some reason the money wouldn't come in at the same time as the timer, it would be 5-10 seconds early. Any ideas what I can do to fix it?


Here's another trigger I tried but it crashed the game...

Income
Events
Unit - Dummy caster1 0002 <gen> Dies
Conditions
Actions
Countdown Timer - Create a timer window for (Last started timer) with title Income
Countdown Timer - Start (Last started timer) as a Repeating timer that will expire in 20.00 seconds
Set Income_timer = (Expiring timer)
Trigger - Turn on income2 <gen>








income2
Events
Unit - Dummy caster1 0002 <gen> Dies
Time - Every 60.00 seconds of game time
Time - Income_timer expires
Conditions
Actions
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 1 (Red) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 2 (Blue) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 3 (Teal) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 4 (Purple) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 5 (Yellow) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 6 (Orange) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 7 (Green) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 8 (Pink) Current gold)

{EDIT}
Here's the trigger where they didn't end at the same time




Income
Events
Unit - Dummy caster1 0002 <gen> Dies
Conditions
Actions
Countdown Timer - Create a timer window for (Last started timer) with title Income
Countdown Timer - Start (Last started timer) as a Repeating timer that will expire in 20.00 seconds
Trigger - Turn on income2 <gen>














(Below trigger isn't initially on)




income2
Events
Time - Every 20.00 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 1 (Red) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 2 (Blue) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 3 (Teal) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 4 (Purple) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 5 (Yellow) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 6 (Orange) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 7 (Green) Current gold)
Player Group - Pick every player in (All players) and do (Player - Add 100 to Player 8 (Pink) Current gold)
 
Last edited by a moderator:
Level 4
Joined
Oct 29, 2008
Messages
65
You should specify the Timer instead of using Last started timer. Also, making it a Repeating timer makes it restart after it ends. Make it One-shot if you want it to trigger only upon death, once per death.


In general, you might encounter problems if you're keeping your map the way it is. I assume you want a timer to start whenever a unit dies to give everyone gold? You're going to have to set multiple timers for this, as starting the same timer twice won't work out too well. You'll need an Array and an integer-based counter or some way to differentiate the timers.
 
Level 1
Joined
Mar 6, 2009
Messages
7
can someone help me i want to make a unit making income every sec.
so when you make it you get income
 
Level 4
Joined
Oct 29, 2008
Messages
65
event unit enters playable map area
condition unit type is blah
action turn on income trigger

WRONGGG. Or at least very badly made.

See, it doesn't matter when the building is made, only that it is exists. Plus this trigger would be too inflexible.

Event:
Every 1 second (or whatever interval you want)

Action:
Set IncomeGroup = All Units in Region Matching Condition Unit-Type is <THE UNIT YOU WANT TO MAKE INCOME>
Unit Group - Pick All Units in IncomeGroup and:
-Add X gold. (X is the amount you want each building to add.)
Custom: call DestroyGroup(udg_IncomeGroup)

You can repeat this all you want for a host of buildings.

Obviously the triggers aren't exact. I'm not writing everything for you. =P
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
WRONGGG. Or at least very badly made.

See, it doesn't matter when the building is made, only that it is exists. Plus this trigger would be too inflexible.

Event:
Every 1 second (or whatever interval you want)

Action:
Set IncomeGroup = All Units in Region Matching Condition Unit-Type is <THE UNIT YOU WANT TO MAKE INCOME>
Unit Group - Pick All Units in IncomeGroup and:
-Add X gold. (X is the amount you want each building to add.)
Custom: call DestroyGroup(udg_IncomeGroup)

You can repeat this all you want for a host of buildings.

Obviously the triggers aren't exact. I'm not writing everything for you. =P

Obviously badly made, it's GUI. Go learn jass and then come talk to me.
 
Level 4
Joined
Oct 29, 2008
Messages
65
Obviously badly made, it's GUI. Go learn jass and then come talk to me.

First of all, you assume that I do not know JASS.

Second of all, you assume JASS is superior to GUI.

While it is true that it is more flexible, but GUI is generally just as capable as JASS. Indeed, GUI is simply an interface for JASS; all GUI is converted into JASS when saved.

I personally only use JASS for things that strictly cannot be done in GUI, such as local variables. And even then, I simply just define them on top with custom script and continue in GUI. I am quite willing to lose the .01 seconds that it takes to call a native function. Heck, I can just remove BJs with an optimizer.

All of this suggests you have a severe superiority complex that was triggered by your failure to provide a trigger in what you consider an "inferior" triggering method.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
First of all, you assume that I do not know JASS.

Second of all, you assume JASS is superior to GUI.

While it is true that it is more flexible, but GUI is generally just as capable as JASS. Indeed, GUI is simply an interface for JASS; all GUI is converted into JASS when saved.

I personally only use JASS for things that strictly cannot be done in GUI, such as local variables. And even then, I simply just define them on top with custom script and continue in GUI. I am quite willing to lose the .01 seconds that it takes to call a native function. Heck, I can just remove BJs with an optimizer.

All of this suggests you have a severe superiority complex that was triggered by your failure to provide a trigger in what you consider an "inferior" triggering method.

First of all, your lack of intelligence in believing that GUI has any advantage over JASS proves that I've already won this argument.

Secondly, the question didn't ask for a complicated trigger that would be running periodically; he asked a simple question and I gave him a simple answer.

Thirdly, if you believe an optimizer that reduces the use of BJ functions is anything close to a handwritten script, you obviously have a lot to learn about the blizzard conversion process.

Fourthly, if you think that running JASS scripts saves actual clocktime versus running a converted GUI function, you're wrong and should probably aim to understand the use out of creating shorter scripts.

And most importantly, arguing in someones question thread is the wrong place; I can see you're semi new here so I'll give you the benefit of the doubt and go ahead and tell you you should ultilize private messaging or public user messages if you have something to say directly to me, in which case I'll give you detailed descriptions on the advantages of scripting in well made JASS versus building what you believe to be a "just as good" GUI trigger. Hopefully if you're interested I can point you in the right direction.


Penzer: If our trigger concepts are hard to understand I'm sure one of us would be more than glad to write you a trigger which you can implement directly provided you gave us more detailed information on what the trigger is doing.
 
Level 4
Joined
Oct 29, 2008
Messages
65
@Cokemonkey11
Believing that JASS is a decent programming language at all is quite embarrassing to begin with.

A simple but bad answer. You made two inflexible triggers when you only needed one flexible one.

event unit enters playable map area
condition unit type is blah
action turn on income trigger

This just means, the unit gets built, turn on the income trigger (which would look like the one I suggested).

I know the differences between JASS and GUI and to be honest, I find it a negligible difference. Optimizers remove the majority of the junk, obviously it does not make it as if it were miraculously written by the hand of God.

I'm new on Hive Workshops, but not to WC3 Edtior.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
2 short simple triggers are better than one laggy periodic unnecessary one. The point is, if he asked for a more specific trigger that required more complex functions I would have given him one.

And I most definitely do not believe JASS is a decent programming language, and usually stray far from those that don't even support OO.
 
Status
Not open for further replies.
Top