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

PROBLEM! Adds gold 100, but not 10 - 35.

Status
Not open for further replies.
Level 10
Joined
Nov 3, 2009
Messages
686
Hello,

Here is some gold system I made for my rpg, It works, but not like I want (Ex. how it works now: When unit dies It adds 100 GOLD, but not from 10 to 35.) It should give gold like integar A 10-35 gold... But it gives 100 gold instead of 10-35. :D
Here systems trigger:

  • Gold System
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
    • Actions
      • For each (Integer LoopInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set PlayerLooted[LoopInt] = False
      • Set TempPoint = (Position of (Triggering unit))
      • Floating Text - Create floating text that reads (|cff9925DE+ + ((String((Point-value of (Triggering unit)))) + |r)) at TempPoint with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 52.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Set TempGroup = (Units within 400.00 of TempPoint matching (((Matching unit) belongs to an ally of (Owner of (Killing unit))) Equal to True))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerLooted[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • For each (Integer A) from 10 to 35, do (Actions) // <- Should Add 10 to 35 gold, but adds 100!!!!!!
                • Loop - Actions
                  • Player - Add (Integer A) to (Owner of (Picked unit)) Current gold
                  • Set PlayerLooted[(Player number of (Owner of (Picked unit)))] = True
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempGroup)
 
Last edited:
Level 12
Joined
Apr 15, 2008
Messages
1,063
Strange, this code should add like 500 gold. You see, that is a loop, it runs the code for each integer from 10 to 35, so it adds 10 gold, then 11, then 12 and so on to 35.
If you want to add random number between 10 and 35, use "random number".
  • Player - Add (Random number between 10 and 35) to (Owner of (Picked unit)) Current gold
EDIT: Ok, I was a little slower :grin:
 
Status
Not open for further replies.
Top