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

income system using mana and limiting maximum gold/lumber

Status
Not open for further replies.
Level 6
Joined
Jul 13, 2006
Messages
140
So this has been making my head hurt for quite a while.
I'm trying to figure out how to do a mana-based income system and also adding a cap to the maximum amount of a specific resource (gold or lumber) to all players.

  • income experiment
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Sound - Play GoodJob <gen>
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • -------- These two are irrelevant to the main point --------
          • Set TempGroup = (Units owned by (Player((Integer A))) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Territory)))
          • Player - Add (Number of units in TempGroup) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Set TempGroup = (Units owned by (Player((Integer A))) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Factory)))
          • Player - Add (Number of units in TempGroup) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_TempGroup)
          • -------- This is the actual trigger, or well an example --------
          • Set TempGroup = (Units owned by (Player((Integer A))) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Some Unit)))
          • Player - Add ((Number of units in TempGroup) x 1) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Set TempGroup = (Units owned by (Player((Integer A))) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Some other Unit)))
          • Player - Add ((Number of units in TempGroup) x 1) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_TempGroup)
So, the thing that needs to be adjusted is the add property part but I can't seem to figure it out!

And, as I've already mentioned, I also need help in making a system that limits a player to say...200g but if they have like some storage structure they can get a maximum of 250g and if they have 2 storage facilities then 300g and so on.

Any help (or, well, help that's helpful) is greatly appreciated.
And if the loose their storage facilities they loose 50g for each.
 
First of all, use "Player Group - Pick every player in (All players) and do (Actions)" action.
To adjust it having a maximum gold income, use
  • If (All conditions are true) then do (Actions) else do (Actions)
  • If - Conditions
    • ((Number of units in (group)) * 50) + (Current gold of (Picked Player))) Less than or Equal to Limit
  • Then - Actions
    • Player - Add (Limit - (Number of units in (group) * 50) + (Current gold of (Picked Player))) to (Picked Player) Current gold
  • Else - Actions
Limit is the maximum gold a player can have.

  • Trigger
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to X
  • Actions
    • Player - Add -50 to (Owner of (Triggering unit)) Current gold
 
Level 6
Joined
Jul 13, 2006
Messages
140
First of all, use "Player Group - Pick every player in (All players) and do (Actions)" action.
To adjust it having a maximum gold income, use
  • If (All conditions are true) then do (Actions) else do (Actions)
  • If - Conditions
    • ((Number of units in (group)) * 50) + (Current gold of (Picked Player))) Less than or Equal to Limit
  • Then - Actions
    • Player - Add (Limit - (Number of units in (group) * 50) + (Current gold of (Picked Player))) to (Picked Player) Current gold
  • Else - Actions
Limit is the maximum gold a player can have.

  • Trigger
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to X
  • Actions
    • Player - Add -50 to (Owner of (Triggering unit)) Current gold

Um, so do you mean that "Limit" is a variable with one copy for each player or?
Wait nevermind, figured it out, heh. So you mean that limit should be an Integer that is the base amount of gold for all players right?
So, if I put this in a, say periodic trigger that occurs every 10 seconds it should automatically set all players gold to "Limit" plus whatever many Storages they have times 50 it should work fine right?

But the biggest problem is the mana trigger but I am thinking of using both of these triggers together, to stop the problem of people getting too much money.
So, I'll try to implement my interpretation of your suggestion and see how it goes.
 
Level 6
Joined
Jul 13, 2006
Messages
140
Yes, this Limit is an Integer variable that you will store in the Map Initialization.
It will store the value, so, unless you change the value afterwards with triggers, the limit will always have that pre-set value you defined in the Map Initialization.

P.S. I'll kill Hive. Somebody CALL RALLE.

Uh wait a bit, I am kinda getting a bit confused now, heh.
So, like this or?
  • Limit check
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current gold) Greater than (MoneyLimit + ((Number of living Resource Storage units owned by (Picked player)) x 50))
            • Then - Actions
              • Player - Set (Picked player) Current gold to (MoneyLimit + ((Number of living Resource Storage units owned by (Picked player)) x 50))
            • Else - Actions
Oh and please say if it leaks and how to fix it because I am fairly sure that it leaks a unit group because of the number of living resource storage units thing, but how do I plug that hole?
Edit: Wait what? Kill the Hive? Er.....okay?
 
Last edited:
Level 6
Joined
Jul 13, 2006
Messages
140
Yeah, I was too upset because of it being slow and the message that appears on almost every load of the site's pages.
Well, why don't you follow the exact trigger I gave you?

Well, I kinda did, more or less.
But I can't have it subtracting for every storage so instead, just check every second (the reason for not subtracting is that...maybe a person has 150g and like 3 storages? Then if all those get killed that player looses 150g, could be very annoying, especially to new people who goes: what the [censored]!? Because of it).
 
Status
Not open for further replies.
Top