• 🏆 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!

a Simple Wc3 math

Status
Not open for further replies.
Level 7
Joined
May 18, 2010
Messages
264
  • Income
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add (100 / (IncomeFoodFarm[(Integer A)] x (Random integer number between 60 and 140))) to Players[(Integer A)] Current gold
Hy guys.
the Math here (100/(income x random100)
Does it do 100/
or X random number First?
Since its / x - +
i want it to do income x random60-140 / 100
 
Level 11
Joined
Jul 9, 2009
Messages
926
  • Income
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Do Multiple Actions For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add ((IncomeFoodFarm[(Integer A)] x (Random integer number between 60 and 140 / 100)))) to Players[(Integer A)] Current gold
cause it happens in separate measures. in this trigger they will compute the 2nd condition first and the answer to it will be multiplied to the income. correct me if im wrong but I think this is the right trigger.

while in your trigger they will divide the income by 100 then multiply it to the random integer.
 
Level 7
Joined
May 18, 2010
Messages
264

Beware that integers can cause this to malfunction. For example x*(y/z) will produce zero if z > y.

For example, 50/100 = 0. 150/100 would be 1.

mhm intresting
  • Income
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set TimeCounter[1] = 60
      • Set TimeCounter[2] = (Random integer number between 60 and 140)
        • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
          • Loop - Actions
            • Player - Add IncomeMeatFarm[(Integer A)] to Players[(Integer A)] Current gold
            • Player - Add IncomeLumberFarm[(Integer A)] to Players[(Integer A)] Current lumber
            • Set TimeCounter[2] = (100 / (IncomeFoodFarm[(Integer A)] x (Random integer number between 60 and 140)))
            • Player - Add TimeCounter[2] to Players[(Integer A)] Current gold
            • Game - Display to (Player group((Player((Integer A))))) the text: ((String(IncomeMeatFarm[(Integer A)])) + ( + + ((String(TimeCounter[2])) + ( gold, + ((String(IncomeLumberFarm[(Integer A)])) + lumber Gained)))))
The Set TimeCounter[2]
is alwais 0 until income gets 100+
as i sayd i need
(Income x 60-140) / 100
first X then /

  • Income
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set TimeCounter[1] = 60
        • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
          • Loop - Actions
            • Player - Add IncomeMeatFarm[(Integer A)] to Players[(Integer A)] Current gold
            • Player - Add IncomeLumberFarm[(Integer A)] to Players[(Integer A)] Current lumber
            • Set TimeCounter[3] = (IncomeFoodFarm[(Integer A)] x (Random integer number between 60 and 140))
            • Set TimeCounter[2] = (TimeCounter[3] / 100)
            • Player - Add TimeCounter[2] to Players[(Integer A)] Current gold
            • Game - Display to (Player group((Player((Integer A))))) the text: ((String(IncomeMeatFarm[(Integer A)])) + ( + + ((String(TimeCounter[2])) + ( gold, + ((String(IncomeLumberFarm[(Integer A)])) + lumber Gained)))))
i just made 2 Variables...
aniway thx on help
 
Status
Not open for further replies.
Top