Is it possible to give a certain unit type a specific value - like point value in wc3

X-maul

AKA: Demtrod
Reaction score
201
I'm creating an income system that, surprisingly, gives resources to a player every 30th second.
My problem is that I want to increase the income value every time i train a unit:
like
Zerg +1
Marine +2
Marauder +3
..and so on..
But I want to keep it as simple as possible, so I want to give the marine unit type a value (1), so that I can just call that value everytime a unit is trained and increase by that value, instead of checking if it's a marine, marauder or zerg every time.
 

Rainther

I guess I should write something of value here...
Reaction score
61
Can you give Unit Types a value in Warcraft 3?

I'd suggest either a trigger with spawn event and an Action Switch containing all the Unit Types, and raising an income value for that player depending on what type it is.
That, or make 2 array with one having the Unit Type and one having the Income value, both having the same key value to combine them.
 

X-maul

AKA: Demtrod
Reaction score
201
Is it realy the only way.. so if I got 100 different units, I'll have to put 100 different conditions :S
 

Rainther

I guess I should write something of value here...
Reaction score
61
I'd say Switch would easen the process a bit.

You'd still end up editing values 100 times. Why not through triggers?
 

X-maul

AKA: Demtrod
Reaction score
201
uhm, there's no problem in it really, I just like to keep my triggers simple, and I hate having like 100 "If/then/else" in 1 trigger. I just wanted to know if it's possible, but if not, I'll just keep to my current method.
 

Rainther

I guess I should write something of value here...
Reaction score
61
"If/then/else" is really messy. In this case you can use "Switch" with "cases", and it will look a lot more cleaner.

Example:

Switch (GetUnitType(GetTriggeringUnit())) {
case "Zerglin":
set Income = Income + 1
case "Marine":
set Income = Income + 2
case "Zealot":
set Income = Income + 3
...etc...
}
 
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