Income generated for every unit of type owned

Holla.

New Member
Reaction score
14
Basically what i want is a trigger that gives the player 5 income per 30 seconds per Control point they have.

( These are made by destroying the oponents control point and it is replaced by your own if that matters )

I have no idea how to acomplish this since i can not just select the control point since it will die and be replaced, how can i go about triggering this, im stumped.

EDIT: Also, whats the trigger for checking who a unit is owned by?
 

Carl-Fredrik

New Member
Reaction score
51
Basically what i want is a trigger that gives the player 5 income per 30 seconds per Control point they have.

( These are made by destroying the oponents control point and it is replaced by your own if that matters )

I have no idea how to acomplish this since i can not just select the control point since it will die and be replaced, how can i go about triggering this, im stumped.

Code:
Untitled Trigger 001
    Events
        Time - Every 30.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Set [COLOR="DarkOrange"]TempUnitGroup[/COLOR][(Integer A)] = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and ((Unit-type of (Matching unit)) Equal to Control Point)))
                Player - Add ([COLOR="Red"]100[/COLOR] x (Number of units in [COLOR="DarkOrange"]TempUnitGroup[/COLOR][(Integer A)])) to (Player((Integer A))) Current gold
                Custom script:   call DestroyGroup (udg_TempUnitGroup[1] [COLOR="DarkRed"](One of these for each player)[/COLOR])

The orange text "TempUnitGroup" is a Unit Group with the Array 12
The loop shall ran once for each player, so if there are 12 players, it will run "from 1 to 12", if there are 5 players, it will run "from 1 to 5"

For the moment each control point will give you 100 gold (The red text)
 

Holla.

New Member
Reaction score
14
Can you tell me how to do some of that? im not good at anything remotely close to a variable and i dont know how to use the: set blah as blah thing either, please elaborate thx
 

Carl-Fredrik

New Member
Reaction score
51
Can you tell me how to do some of that? im not good at anything remotely close to a variable and i dont know how to use the: set blah as blah thing either, please elaborate thx

I could try, but beware, I might just confuse you...

To create a variable, click the big X in the trigger editor. Create a new one, call it TempUnitGroup and set the Array to 12. Then use the action "Set Variable" in a loop, choose the variable you just created (TempUnitGroup) and set the [] area to For Loop Integer A. Then set it to set it to "Units in region matching condition". Let the region be Playable Map Area or Entire Map, then choose the condition "And" to start with, and add a Unit Type Comparison condition and a Player Comparison (look at the trigger I posted to check what it should look like).

Then choose the action Player - Add property.
Change 1000 to Arithmetic and change Value to 100, then change the + to a x and finally the Value to "Count Units In Unit Group", choose your variable (TempUnitGroup) and as earlier, put For Loop Integer A inside the brackets. Then change Player 1 (Red) to Conversion - Convert Player To Player Index and then change the 1 to For Loop Integer A.

And finally, add the action "Custom Script". But this script in:

JASS:
DestroyGroup (udg_TempUnitGroup(1)


Then make one script for each player, and you're done.
 

Kelvin87

New Member
Reaction score
14
Actually, Carl-Fredrik's way aren't the best way to guide the Control Point Income. It could be many issues happened if the player predict the time accurately to take over the Control Point to get the effective Income. Lets me introduce my way to do it.

you can put an ability marker with X levels (an ability that is functionless that not affecting the gameplay) to the Control Points. You make a periodic trigger to pick all the control points to increase their ability marker level. When the ability marker of Control Point reaches X levels, give income to the player.

Get it? :thup:
 

Holla.

New Member
Reaction score
14
After reading the confusing ass stuff. I mostly get it but i cant seem to set the TempUnitGroup [integer A] As units in region, its not there??:eek:
 

Holla.

New Member
Reaction score
14
Whats that o_O
Cause when i click = Value and scroll down the functions none of them has to do with a region besides count number of units in playable map area, but that doesn't have the extentions so i dont know..

Edit: Im so confused..

Help please i have to get off wc sometime soon!
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
To make a variable an array, open the variable in the variable editor and check the box that says 'array'

You don't need to change the number of arrays, leave it as one.
 

Holla.

New Member
Reaction score
14
Then choose the action Player - Add property.
Change 1000 to Arithmetic and change Value to 100, then change the + to a x and finally the Value to "Count Units In Unit Group", choose your variable (TempUnitGroup) and as earlier, put For Loop Integer A inside the brackets. Then change Player 1 (Red) to Conversion - Convert Player To Player Index and then change the 1 to For Loop Integer A.

And finally, add the action "Custom Script". But this script in:

JASS:
DestroyGroup (udg_TempUnitGroup(1)


Then make one script for each player, and you're done.



I cant make the value this: Units in region matching condition It doesn't exist, i dont get it

EDIT: turns out it does, but its inside another trigger, sry bout that, now im stumped on one last thing.
After Owner of matching unit i cant set it to integer A, o_O how do i do this
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
When you were creating your variable, did you make sure to set the field in the dropdown menu to 'Unit Group'?

If not then I don't understand what your problem is :p.
 

Holla.

New Member
Reaction score
14
wow thats embarressing, i forgot to change to unit group. Ok now thats done,

My last problem is 2 problems, no 1: I cant set matching player to integer A.

Two: How do you do this, when i go to Count units in group theres no variable option. Help!

"Count Units In Unit Group", choose your variable (TempUnitGroup) and as earlier, put For Loop Integer A inside the brackets
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
wow thats embarressing, i forgot to change to unit group. Ok now thats done,

My last problem is 2 problems, no 1: I cant set matching player to integer A.

Two: How do you do this, when i go to Count units in group theres no variable option. Help!

"Count Units In Unit Group", choose your variable (TempUnitGroup) and as earlier, put For Loop Integer A inside the brackets

1. Player - Convert Player Index to Player

2. Select your variable from the dropdown menu 'variables', not from the preset ones. :)
 

Holla.

New Member
Reaction score
14
DONE HOLY SHIT, gonna test soon but the last thing i cant do, he says make one for every player, what does he mean by that and how do i do it?
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
You don't have to do it one for every player, he's done it the long way :).

Simply enter this at the end of the integer A loop (inside the loop, but at the end)

Get the "custom script" trigger, and in the text box enter this exactly:

call DestroyGroup(udg_TempUnitGroup[GetForLoopIndexA()])

What he's done will not only take longer, he's actually done it wrong so it won't work at all >.>
 

Holla.

New Member
Reaction score
14
wait what?? the whole thing wont work?


Also go away im trying to do it myself lol. I've done it all right.
 

Holla.

New Member
Reaction score
14
Hey can you help me with something though, How to make a button come up at the start for choosing random heroes or whatever. Random or not random, random spawnes a hero in everyones base out of 11 heroes no copies, not random spawns the normal 11 like paladin for humans for example
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
No, I don't mean the whole thing won't work, just the custom script :p.

There are tutorials on dialog boxes and random hero triggers on the forum, I suggest searching them up.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top