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

Income System Error.

Status
Not open for further replies.
Level 3
Joined
Jan 8, 2011
Messages
70
Hey everyone, i am having an issue with my gold income system and would like some help to fix it. This is the trigger i use to generate income:

  • Gold building 1
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Gold Base) and (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True))))
          • Player - Add ((Number of units in Temp_Group) x 10) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_Temp_Group)
When the 'gold building' that generates income is upgraded, i have a new trigger which is:

  • Gold building 2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Gold Base #2) and (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True))))
          • Player - Add ((Number of units in Temp_Group) x 15) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_Temp_Group)
I understand where my problem is going wrong (i think) but i don't know how to fix it so any help would be appreciated.

Also, a secondary question about my income!
How would i display the gold gained through the building as text above (e.g. +10) (that floats up and dissapears after a certain amount of time) like in Troll vs Elves.

Cheers, +REP to everyone that helps.
 
Level 30
Joined
Jan 31, 2010
Messages
3,551
What's the problem in general? The gold is not gained, or not calculated properly?

Anyways, here's what you will need for Gold Text faking:
  • Gold Text Faking
    • Actions
      • Set Deny_Floating = (Position of (Your unit))
      • Floating Text - Create floating text that reads (|cffffcc00+ + ((String(GoldInteger)) + |r)) at Deny_Floating with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set Deny_Floating_Text = (Last created floating text)
      • Floating Text - Change Deny_Floating_Text: Disable permanence
      • Floating Text - Change the lifespan of Deny_Floating_Text to 2.00 seconds
      • Floating Text - Change the fading age of Deny_Floating_Text to 1.00 seconds
      • Floating Text - Set the velocity of Deny_Floating_Text to 80.00 towards 90.00 degrees
 
Level 3
Joined
Jan 8, 2011
Messages
70
Thanks so much for that, +REP.

Anyways, the problem is with the group, so when the gold base is upgraded, instead of gaining 15 gold as the trigger shows, it gains 80 gold. Or, if gold earnt is set to 0 in trigger 2, 65 gold is still earnt. Gold earnt is per interval (2 seconds) btw.
 
Status
Not open for further replies.
Top