Advanced - need a costs table.

FannyShaver

Well-Known Member
Reaction score
31
I am trying to make my own resource system. Lumber, gold, stone etc etc with all resources stored in variables. Gathering works fine, though I did it my own way. Now the construction part. Instead of creating a new trigger for each player for each building I am thinking of making a table that will automatically check associated variable with a costs for such structure from the table, i.e:

lumber stone
build1 100 200

now it would have to check, if [variable] redstone and redlumber is high enough to start the construction/upgrade for such structure from the table, subtract resources and allow construction or cancel it.

Any ideas?
 

Solu9

You can change this now in User CP.
Reaction score
216
I actually wanted a similar system in a map of mine. But I was unable to find a way to cancel a construction,training or upgrade if the player did not meet the requirements, so I had to skip it.

So if you find a solution before anyone answers, please post it here :)
 

FannyShaver

Well-Known Member
Reaction score
31
You can cancel upgrade and construction at any time. I can do it my way, but it will be extremely long way. I am positive there's a good way to shorten the process.
 

denmax

You can change this now in User CP.
Reaction score
155
What I can think of is using a Unit-Type Array and two Integer Arrays for each resource.

You can use a condition which states that if they are building unit-type stored in array 1, then it requires the resources greater than on integer stored in array 1

you'd have to set the initial values on a separate trigger (probably in map initialization)

e.g.

UnitTypeArray[1] = a bunch of bricks
lumber[1] = 25
stone[1] = 100
UnitTypeArray[2] = basket of poopy joes
lumber[2] = 10000000
stone[2] = 0

You can use Looping from 1 (or 0) to the total amount of buildings / unit-type arrays

e.g.

loop integer a from (0 to 10)
if unit type equal to UnitTypeArray[Integer A]
then if playerStone[owner of triggering unit(?)] greater than stone[Integer A]
----- if playerLumber[owner of triggering unit(?)] greater than lumber[Integer A]
----- then do something
----- else poop
 
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