• 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.

[General] Lumber and Gold problem

Status
Not open for further replies.
Level 23
Joined
Apr 16, 2012
Messages
4,041
this should do
  • thetrigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set loc = (Point(0.00, 0.00))
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Knight)) and do (Actions)
            • Loop - Actions
              • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) + 1)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Lumber Mill)) and do (Actions)
            • Loop - Actions
              • Player - Set (Player((Integer A))) Current lumber to (((Player((Integer A))) Current lumber) + 1)
      • Custom script: call RemoveLocation(udg_loc)
loc is point variable
 
Level 3
Joined
Aug 25, 2012
Messages
30
this should do
  • thetrigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set loc = (Point(0.00, 0.00))
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Knight)) and do (Actions)
            • Loop - Actions
              • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) + 1)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 10000.00 of loc matching ((Unit-type of (Matching unit)) Equal to Lumber Mill)) and do (Actions)
            • Loop - Actions
              • Player - Set (Player((Integer A))) Current lumber to (((Player((Integer A))) Current lumber) + 1)
      • Custom script: call RemoveLocation(udg_loc)
loc is point variable

Instead of 'Units within 10000.00 of loc' use 'Units within Playable map area' ;)
 
Level 4
Joined
Aug 26, 2012
Messages
123
/////////////////////////////////////
Event: every 1 second
Action: Pick every unit in (playable map) matching ([is a lumber mill] and [is yours]) and do action:
-add 1 lumber and 1 gold for you.
/////////////////////////////////////

I think it's simple (you make it so simple! Even not following the GUI/trigger's words!), but maybe there's some mistakes (well, everybody can do mistakes, so do YOU! Er, not you, you who read this text).
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You can have as many method as you can, but compare which is efficient.
My system does not pick every unit in the map and do iterations (check of condition - filter them out) which the process is heavy and powerful if you have many units on your map.

My system just assess building in the unit group (lower the value count compared to pick every unit in map).
 
Level 4
Joined
Aug 26, 2012
Messages
123
You're right. But on my system (lo-class, lo-specs, lo-price, lo-what again? [Oh, shuddup!]) it works pretty well.... Maybe because it's a tiny map...

You can use the very first answer, though, with some changes:
/////////////////////////////////////////
Act:
-set var (HowMuchTheLumberMill) = HowMuchTheLumberMill + 1
-turn on the trigger that gives you (HowMuchTheLumberMill) lumber and (HowMuchTheLumberMill) gold each second.
(Look, it's simplified again, and the var's name is way TOO LONG! You're lazy! [Yeah, I am])
/////////////////////////////////////////
Note: even the trigger have been turned on, what's the effect of turning it on once again? (answer: you turned it on twice)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Note: even the trigger have been turned on, what's the effect of turning it on once again? (answer: you turned it on twice)
Are you referring to my trigger ?
Turning on a turned trigger does not make less efficient.
It's like you're removing a unit from a unit group, which the unit is not in the unit group in the first place.

Checking Condition VS Null Action, it's pretty same I guess.

I can do this;
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (RG_Group is empty) Equal to True
    • Then - Actions
      • Trigger - Turn on RG Loop <gen>
    • Else - Actions
But it's the same, you're making a "check", while mine is doing action to a null value, making them both the same efficient as they are.
 
Level 4
Joined
Aug 26, 2012
Messages
123
Err... Umm... I'm so sorry, I don't think you'll say that! (Me too!)

I'm referring to my "changed trigger", that when LumbMill is constructed, that trigger will run Action, and the action "turn on trigger" will be done repeatedly, and I think someone will questioning it... (I'm silent now, to prevent future misunderstanding)

So the quote means "there's no effect turning on trigger repeatedly"....
(Well, I don't like the "VS" thing....)
 
Level 4
Joined
Aug 26, 2012
Messages
123
Sorry, I'm newbie here (very newbie, look at the join date...), I don't want to feel bossy.... (Even if you're a boss?)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Even if you're newbie and I'm elite (EXAMPLE), and you're right for certain matter, you have the right to have an argument with me (valid argument).

I once saw my classmate argued with physics teacher and he's right, that teacher admit it that it's her fault and mistake for teaching the wrong things.

But SOME people just do not want to admit their mistake.
 
Level 4
Joined
Aug 26, 2012
Messages
123
Well, thanks for that, defskull (an EXAMPLE of elite). But is it okay that we're talking about this... in this thread?
If no, i'm asking something on a new thread, which is on a same category with this....
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If you have another question that is not related to the main topic of this thread at all, you must open a new thread in a correct section.
After all, this is not your thread, you should not ask your questions here (unless it's related to the topic), it is somewhat called as "Thread Hijacking".
 
Status
Not open for further replies.
Top