Req Trigger: Income (LoE, EBR etc.)

snowyowl

New Member
Reaction score
0
Hi everyone, I'm new to this forum, but not too new to the World Editor. I don't do JASS or such, I just try to come up with a map every once in a while without having the Editor crash all too often (Which sadly is very often since I'm on a Mac).

Anyways, I need some help with a trigger that I can't get to work properly.
It's supposed to count the number of buildings owned by each player and give resources according to following number:

Code:
Building 1: # * 50 gold, # * 50/2 lumber
Building 2: # * 75 gold, # * 75/2 lumber
Building 3: # * 100 gold, # * 100/2 lumber
Building 4: # * 125 gold, # * 125/2 lumber
Building 5: # * 150 gold, # * 150/2 lumber

The trigger I'm trying to create is to be similar to the one used in Lords of Europe to calculate income.
Currently my trigger looks like following (Yeah, I know it's crap, that's why I need help):
Code:
Events
[INDENT]Time - IncomeTimer expires
[/INDENT]
Conditions
Actions
[INDENT]Set IncomeRealVariable[1] = (((((((((Real((Number of living Tent units owned by Players[(Integer A)]))) x 50.00) + ((Real((Number of living Lodge units owned by Players[(Integer A)]))) x 75.00)) + ((Real((Number of living Hut units owned by Players[(Integer A)]))) x 100.00)) + ((Real((N
[/INDENT]
[INDENT]Set IncomeRealVariable[2] = (((((((((Real((Number of living Tent units owned by Players[(Integer A)]))) x 50.00) + ((Real((Number of living Lodge units owned by Players[(Integer A)]))) x 75.00)) + ((Real((Number of living Hut units owned by Players[(Integer A)]))) x 100.00)) + ((Real((N
[/INDENT]
[INDENT]Set IncomeRealVariable[3] = (((((((((Real((Number of living Tent units owned by Players[(Integer A)]))) x 50.00) + ((Real((Number of living Lodge units owned by Players[(Integer A)]))) x 75.00)) + ((Real((Number of living Hut units owned by Players[(Integer A)]))) x 100.00)) + ((Real((N
[/INDENT]
[INDENT]Set IncomeRealVariable[4] = (((((((((Real((Number of living Tent units owned by Players[(Integer A)]))) x 50.00) + ((Real((Number of living Lodge units owned by Players[(Integer A)]))) x 75.00)) + ((Real((Number of living Hut units owned by Players[(Integer A)]))) x 100.00)) + ((Real((N
[/INDENT]
[INDENT]Set IncomeRealVariable[5] = (((((((((Real((Number of living Tent units owned by Players[(Integer A)]))) x 50.00) + ((Real((Number of living Lodge units owned by Players[(Integer A)]))) x 75.00)) + ((Real((Number of living Hut units owned by Players[(Integer A)]))) x 100.00)) + ((Real((N
[/INDENT]
.... And so on, one of those for each players ....
[INDENT]Player - Add (Integer(IncomeRealVariable[(Integer A)])) to Players[(Integer A)] Current gold[/INDENT]
[INDENT]Player - Add (Integer((IncomeRealVariable[(Integer B)] / 2.00))) to Players[(Integer B)] Current lumber
Game - Display to Player Group - Player 1 (Red) the text: ((You've recieved  + ((String(IncomeRealVariable[1])) + ( gold and  + ((String((IncomeRealVariable[1] / 2.00))) +  lumber during this income period.)))) +  )
Sound - Play Income <gen>
[/INDENT]

With this trigger, I just recieve the game message (When playing as Player 1 Red, ofcourse) saying I've recieved 0.000 gold and 0.000 lumber.
So basically, I need a fully functional trigger which works for all players.

Thank you for any help!

Note: The Set IncomeRealVariable above is not complete because it's too long (it seems) but it just continues in the same pattern for the 5 diffrent buildings.
 

Baltazhar

Active Member
Reaction score
55
Okay, had some trouble in wrapping my mind around it, but here's what I did. Note that I haven't tested it, but I'm almost 100% that it will work.

Code:
Testing
    Events
        Time - TimerVariable expires
    Conditions
    Actions
        Set BuildingsIncome[1] = 50
        Set BuildingsIncome[2] = 75
        Set BuildingsIncome[3] = 100
        Set BuildingsIncome[4] = 125
        Set BuildingsIncome[5] = 150
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                For each (Integer A) from 1 to 5, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Number of units in (Units owned by (Picked player) of type Farm)) Equal to (Integer A)
                            Then - Actions
                                Player - Add BuildingsIncome[(Integer A)] to (Picked player) Current gold
                                Player - Add (BuildingsIncome[(Integer A)] / 2) to (Picked player) Current lumber
                            Else - Actions
                                Do nothing

EDIT: In the event I made a TimerVariable, just to make it look more like ur trigger - So that one is purely for looks, I know u have ur own variable.
The other Variable i used is the on set here, BuildingsIncome.

Btw, you don't need to make ur variables 'real', just use integer. You only need real for something like time, distance, angles and such.. For counting things, money and lumber, u can use integer.
 

snowyowl

New Member
Reaction score
0
Thanks for the help, I'll try this right away. Meanwhile, does this include all 5 buildings, considering (Number of units in (Units owned by (Picked player) of type Farm)) Equal to (Integer A) ?
And what about the game message, any clue on how that should be triggered?

Edit: Ran some tests, gold was recieved but not in the amounts I was hoping for. For having 2 [1] and 2 [2] I just recieved 75 gold, and no lumber...
 

Baltazhar

Active Member
Reaction score
55
Oooooh... Then I have misunderstood ur question completely.
I thought it was like this:

There are 1 income building-type. Let's call it "Farm". If u have 1 Farm u get 50, if u have 2 Farms u get 75 etc...

But there are 5 different building-types? Cuz then we'll need another trigger :)

EDIT: Just to be clear, the trigger I made check if u have 1, 2, 3, 4 or 5 IncomeBuildings.
 

snowyowl

New Member
Reaction score
0
Ahh yeah that was clearly a misunderstanding. As in Lords of Europe and similar maps, where you claim more and more cities (income buildings) I wish that certain buildings give 50 gold, others give 75 gold and so on. Sorry if I wrote confusing in this and earlier posts.
 

Baltazhar

Active Member
Reaction score
55
I can see in the Topic of the thread u wrote LoE and EBR... Unfortunately, I don't know any of these maps xD

Hang on and i'll make the trigger work as intended :)
 

Baltazhar

Active Member
Reaction score
55
Okay, here it is.

Code:
Testing
    Events
        Time - TimerVariable expires
    Conditions
    Actions
        Set BuildingsIncome[1] = 50
        Set BuildingsIncome[2] = 75
        Set BuildingsIncome[3] = 100
        Set BuildingsIncome[4] = 125
        Set BuildingsIncome[5] = 150
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                -------- Building 1 --------
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x BuildingsIncome[1]) to (Picked player) Current gold
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x (BuildingsIncome[1] / 2)) to (Picked player) Current lumber
                -------- Building 2 --------
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x BuildingsIncome[2]) to (Picked player) Current gold
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x (BuildingsIncome[2] / 2)) to (Picked player) Current lumber
                -------- Building 3 --------
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x BuildingsIncome[3]) to (Picked player) Current gold
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x (BuildingsIncome[3] / 2)) to (Picked player) Current lumber
                -------- Building 4 --------
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x BuildingsIncome[4]) to (Picked player) Current gold
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x (BuildingsIncome[4] / 2)) to (Picked player) Current lumber
                -------- Building 5 --------
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x BuildingsIncome[5]) to (Picked player) Current gold
                Player - Add ((Number of units in (Units owned by (Picked player) of type Farm)) x (BuildingsIncome[5] / 2)) to (Picked player) Current lumber

As u can see all unit types are set to Farm, but ofc, they have to be each City level 1-5 respectively. Other than that, this should work perfect :)
 

snowyowl

New Member
Reaction score
0
Thanks alot. I'm going to try this out once I've recovered from the WJC in hockey where Sweden just beat Russia in sudden death in the semifinals. :D
What d'you think regarding the text message which is to be announced individually to each player? Should I link the BuildsIncome variable into one which is to be displayed? What do I have to do to make it display correct income to correct player?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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