Buildings increasing variables

Banditsin

New Member
Reaction score
1
I have searched the forums but I couldnt find anything about this...

I want to make owning a specific building increase a variable. How do I do this the easiest way?

Thanks! :)
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
Do you mean like, you build a farm and Variable X increases by 1?

Code:
Event
  - A unit finishes the construction of a building
Condition
  - Unit type of constructed unit equal to Farm
Action
  - Set Variabe X = Variable X + 1
Pseudo-code, but I guess it's understandable ^^
 

Banditsin

New Member
Reaction score
1
Yes but I want to be able to upgrade the building so it will increase the variable further.

Also other players should be able to take over the building, which would increase "their variable" (1Red Variable, 2Blue Variable, 3Teal Variable etc.)...

How do I do this?
 

Andyoyo

TH.net Regular
Reaction score
22
*make sure your variables are integers*
I want to upgrade the building so it will increase the variable further.
Events
Unit - A unit Finishes an upgrade

Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red) --Player Comparison
(Unit-type of (Triggering unit)) Equal to Keep --Unit-Type Comparison, I used upgrading from a Town Hall to a Keep as example

Actions
set red1 = (red1 + 1) --set Variable


Also other players should be able to take over the building, which would increase "their variable" (1Red Variable, 2Blue Variable, 3Teal Variable etc.)...
Events
Unit - A unit Changes owner

Conditions
(Owner of (Ownership-changed unit)) Not equal to (Previous owner) --This will prevent incorrect variable values

Actions
If/Then/Else --repeat this for as many players with variables you want
If
(Owner of (Ownership-changed unit)) Equal to Player 1(Red)
Then
Set red1 = (red1 + 1)
Else
Do Nothing

1Red Variable, 2Blue Variable, 3Teal Variable etc.)...
*variables cannot start with numbers, this rule applies to some programming languages too.*
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top