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
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top