• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

custom unit value data base

Status
Not open for further replies.
Level 3
Joined
Jan 7, 2010
Messages
37
I'm still figuring out vJass and OOP and want to create a simple system that handles custom unit values, such as:
JASS:
library MyUnitSystem initializer OnInit

    globals
        public integer array Strenght
        public integer array Agility
        public integer array Intelligence
        public integer array Defense
        public integer array MagicResist
        public real array Damage
        public real array AttackSpeed
            //ect...
    endglobals

     function GetDamagePhysical takes integer id returns real
        local real r
            set r = I2R(Strenght[id]) * 2.5
        return r
    endfunction
    
            //...

   private function OnInit takes nothing returns nothing
        local trigger trig = CreateTrigger()
    endfunction
endlibrary

I want to be able to access and manipulate these values easily.

What would be the best approach? Arrays+AIDS? Structs? ...
 
Level 3
Joined
Jan 7, 2010
Messages
37
I don't want to use the "normal" values that that you can edit in the editor, but create my own, i.e. "Charisma" or "Wisdom", stuff like that. this would be a a custom stat system then?
 
i believe you are talking about a custom stat system yes.

Use a hashtable with GetHandleId() and store that units charisma and wisdom in the struct. Then load the struct by using the handle id of that unit.

Alternatively and a better solution.
Use the units custom value with bribes unit indexer and store the structs id in an array with the units custom value.
 
Status
Not open for further replies.
Top