• 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.

Simple Custom Stats System v1.2 [GUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
- This system allows you to customize your Units !

- You can customize the Unit's Max Hp/MP, Damage, Armor, Sight Range and many more ! (will be as time passes)

- It's for GUI-friendly and easy to use !


External Instructions
- Copy all abilities inside the folder Special in the Object Editor.
- Open World Editor -> File - Preferences... -> General Tab -> Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Custom Stats System folder.
- Copy this code into your map header;
JASS:
function SimError takes nothing returns nothing
    local string msg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00Value is either too large or too small.|r"
    local player ForPlayer = GetTriggerPlayer()
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
        call StartSound(udg_Error)
    endif
    set ForPlayer = null
endfunction

function AddHP takes nothing returns nothing
    local integer i = 1
    local integer max = 16383
    if (udg_CS_Value > max) then
        call SimError()
        return
    else
    endif
    loop
        exitwhen i > udg_CS_MaxLoopingBase
        if udg_CS_LoopingBase[i] > udg_CS_Value then
        else
            call UnitAddAbility(udg_CS_Unit, udg_CS_AddHP[i])
            call IncUnitAbilityLevel(udg_CS_Unit, udg_CS_AddHP[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddHP[i])
            set udg_CS_Value = udg_CS_Value - udg_CS_LoopingBase[i]
        endif
        set i = i + 1
    endloop
endfunction

function RemoveHP takes nothing returns nothing
    local integer i = 1
    local integer min = -16383
    if (udg_CS_Value < min) then
        call SimError()
        return
    else
    endif
    loop
        exitwhen i > udg_CS_MaxLoopingBase
        if udg_CS_LoopingBase[i] > udg_CS_Value then
        else
            call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveHP[i])
            call IncUnitAbilityLevel(udg_CS_Unit, udg_CS_RemoveHP[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveHP[i])
            set udg_CS_Value = udg_CS_Value - udg_CS_LoopingBase[i]
        endif
        set i = i + 1
    endloop
endfunction

function AddMP takes nothing returns nothing
    local integer i = 1
    local integer max = 16383
    if (udg_CS_Value > max) then
        call SimError()
        return
    else
    endif
    loop
        exitwhen i > udg_CS_MaxLoopingBase
        if udg_CS_LoopingBase[i] > udg_CS_Value then
        else
            call UnitAddAbility(udg_CS_Unit, udg_CS_AddMP[i])
            call IncUnitAbilityLevel(udg_CS_Unit, udg_CS_AddMP[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddMP[i])
            set udg_CS_Value = udg_CS_Value - udg_CS_LoopingBase[i]
        endif
        set i = i + 1
    endloop              
endfunction

function RemoveMP takes nothing returns nothing
    local integer i = 1
    local integer min = -16383
    if (udg_CS_Value < min) then
        call SimError()
        return
    else
    endif
    loop
        exitwhen i > udg_CS_MaxLoopingBase
        if udg_CS_LoopingBase[i] > udg_CS_Value then
        else
            call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveMP[i])
            call IncUnitAbilityLevel(udg_CS_Unit, udg_CS_RemoveMP[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveMP[i])
            set udg_CS_Value = udg_CS_Value - udg_CS_LoopingBase[i]
        endif
        set i = i + 1
    endloop
endfunction

function AddDamage takes nothing returns nothing
    local integer i = 1
    local integer max = 16383
    set udg_CS_Key = GetHandleId(udg_CS_Unit)
    set udg_CS_DamageValue = LoadInteger(udg_CS_Hashtable, udg_CS_Key, 0)
    set udg_CS_DamageValue = (udg_CS_DamageValue + udg_CS_Value)
    if (udg_CS_DamageValue > max) then
        call SimError()
        return
    else
    endif
    if (udg_CS_DamageValue > 0) then
        call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 0, udg_CS_DamageValue)
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddDamage[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveDamage[i])
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            if (udg_CS_LoopingBase[i] > udg_CS_DamageValue) then
            else
                call UnitAddAbility(udg_CS_Unit, udg_CS_AddDamage[i])
                set udg_CS_DamageValue = (udg_CS_DamageValue - udg_CS_LoopingBase[i])
            endif
            set i = i + 1
        endloop
    else
        if (udg_CS_DamageValue < 0) then
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 0, udg_CS_DamageValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveDamage[i])
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                if (udg_CS_LoopingBase[i] > -udg_CS_DamageValue) then
                else
                    call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveDamage[i])
                    set udg_CS_DamageValue = (udg_CS_DamageValue + udg_CS_LoopingBase[i])
                endif
                set i = i + 1
            endloop
        else
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 0, udg_CS_DamageValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveDamage[i])
                set i = i + 1
            endloop
        endif
    endif
endfunction

function RemoveDamage takes nothing returns nothing
    local integer i = 1
    local integer min = -16383
    set udg_CS_Key = GetHandleId(udg_CS_Unit)
    set udg_CS_DamageValue = LoadInteger(udg_CS_Hashtable, udg_CS_Key, 0)
    set udg_CS_DamageValue = (udg_CS_DamageValue - udg_CS_Value)
    if (udg_CS_DamageValue < min) then
        call SimError()
        return
    else
    endif
    if (udg_CS_DamageValue > 0) then
        call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 0, udg_CS_DamageValue)
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddDamage[i])
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            if (udg_CS_LoopingBase[i] > udg_CS_DamageValue) then
            else
                call UnitAddAbility(udg_CS_Unit, udg_CS_AddDamage[i])
                set udg_CS_DamageValue = (udg_CS_DamageValue - udg_CS_LoopingBase[i])
            endif
            set i = i + 1
        endloop
    else
        if (udg_CS_DamageValue < 0) then
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 0, udg_CS_DamageValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddDamage[i])
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveDamage[i])
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                if (udg_CS_LoopingBase[i] > -udg_CS_DamageValue) then
                else
                    call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveDamage[i])
                    set udg_CS_DamageValue = (udg_CS_DamageValue + udg_CS_LoopingBase[i])
                endif
                set i = i + 1
            endloop
        else
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 0, udg_CS_DamageValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddDamage[i])
                set i = i + 1
            endloop
        endif
    endif
endfunction

function AddArmor takes nothing returns nothing
    local integer i = 1
    local integer max = 16383
    set udg_CS_Key = GetHandleId(udg_CS_Unit)
    set udg_CS_ArmorValue = LoadInteger(udg_CS_Hashtable, udg_CS_Key, 1)
    set udg_CS_ArmorValue = (udg_CS_ArmorValue + udg_CS_Value)
    if (udg_CS_ArmorValue > max) then
        call SimError()
        return
    else
    endif
    if (udg_CS_ArmorValue > 0) then
        call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_ArmorValue)
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddArmor[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveArmor[i])
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            if (udg_CS_LoopingBase[i] > udg_CS_ArmorValue) then
            else
                call UnitAddAbility(udg_CS_Unit, udg_CS_AddArmor[i])
                set udg_CS_ArmorValue = (udg_CS_ArmorValue - udg_CS_LoopingBase[i])
            endif
            set i = i + 1
        endloop
    else
        if (udg_CS_ArmorValue < 0) then
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_ArmorValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveArmor[i])
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                if (udg_CS_LoopingBase[i] > -udg_CS_ArmorValue) then
                else
                    call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveArmor[i])
                    set udg_CS_ArmorValue = (udg_CS_ArmorValue + udg_CS_LoopingBase[i])
                endif
                set i = i + 1
            endloop
        else
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_ArmorValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveArmor[i])
                set i = i + 1
            endloop
        endif
    endif
endfunction

function RemoveArmor takes nothing returns nothing
    local integer i = 1
    local integer min = -16383
    set udg_CS_Key = GetHandleId(udg_CS_Unit)
    set udg_CS_ArmorValue = LoadInteger(udg_CS_Hashtable, udg_CS_Key, 1)
    set udg_CS_ArmorValue = (udg_CS_ArmorValue - udg_CS_Value)
    if (udg_CS_ArmorValue < min) then
        call SimError()
        return
    else
    endif
    if (udg_CS_ArmorValue > 0) then
        call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_ArmorValue)
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddArmor[i])
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            if (udg_CS_LoopingBase[i] > udg_CS_ArmorValue) then
            else
                call UnitAddAbility(udg_CS_Unit, udg_CS_AddArmor[i])
                set udg_CS_ArmorValue = (udg_CS_ArmorValue - udg_CS_LoopingBase[i])
            endif
            set i = i + 1
        endloop
    else
        if (udg_CS_ArmorValue < 0) then
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_ArmorValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddArmor[i])
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveArmor[i])
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                if (udg_CS_LoopingBase[i] > -udg_CS_ArmorValue) then
                else
                    call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveArmor[i])
                    set udg_CS_ArmorValue = (udg_CS_ArmorValue + udg_CS_LoopingBase[i])
                endif
                set i = i + 1
            endloop
        else
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_ArmorValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddArmor[i])
                set i = i + 1
            endloop
        endif
    endif
endfunction

function AddSight takes nothing returns nothing
    local integer i = 1
    local integer max = 16383
    set udg_CS_Key = GetHandleId(udg_CS_Unit)
    set udg_CS_SightValue = LoadInteger(udg_CS_Hashtable, udg_CS_Key, 1)
    set udg_CS_SightValue = (udg_CS_SightValue + udg_CS_Value)
    if (udg_CS_SightValue > max) then
        call SimError()
        return
    else
    endif
    if (udg_CS_SightValue > 0) then
        call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_SightValue)
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddSight[i])
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveSight[i])
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            if (udg_CS_LoopingBase[i] > udg_CS_SightValue) then
            else
                call UnitAddAbility(udg_CS_Unit, udg_CS_AddSight[i])
                set udg_CS_SightValue = (udg_CS_SightValue - udg_CS_LoopingBase[i])
            endif
            set i = i + 1
        endloop
    else
        if (udg_CS_SightValue < 0) then
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_SightValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveSight[i])
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                if (udg_CS_LoopingBase[i] > -udg_CS_SightValue) then
                else
                    call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveSight[i])
                    set udg_CS_SightValue = (udg_CS_SightValue + udg_CS_LoopingBase[i])
                endif
                set i = i + 1
            endloop
        else
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_SightValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveSight[i])
                set i = i + 1
            endloop
        endif
    endif
endfunction

function RemoveSight takes nothing returns nothing
    local integer i = 1
    local integer min = -16383
    set udg_CS_Key = GetHandleId(udg_CS_Unit)
    set udg_CS_SightValue = LoadInteger(udg_CS_Hashtable, udg_CS_Key, 1)
    set udg_CS_SightValue = (udg_CS_SightValue - udg_CS_Value)
    if (udg_CS_SightValue < min) then
        call SimError()
        return
    else
    endif
    if (udg_CS_SightValue > 0) then
        call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_SightValue)
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddSight[i])
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > udg_CS_MaxLoopingBase
            if (udg_CS_LoopingBase[i] > udg_CS_SightValue) then
            else
                call UnitAddAbility(udg_CS_Unit, udg_CS_AddSight[i])
                set udg_CS_SightValue = (udg_CS_SightValue - udg_CS_LoopingBase[i])
            endif
            set i = i + 1
        endloop
    else
        if (udg_CS_SightValue < 0) then
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_SightValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddSight[i])
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_RemoveSight[i])
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                if (udg_CS_LoopingBase[i] > -udg_CS_SightValue) then
                else
                    call UnitAddAbility(udg_CS_Unit, udg_CS_RemoveSight[i])
                    set udg_CS_SightValue = (udg_CS_SightValue + udg_CS_LoopingBase[i])
                endif
                set i = i + 1
            endloop
        else
            call SaveInteger(udg_CS_Hashtable, udg_CS_Key, 1, udg_CS_SightValue)
            loop
                exitwhen i > udg_CS_MaxLoopingBase
                call UnitRemoveAbility(udg_CS_Unit, udg_CS_AddSight[i])
                set i = i + 1
            endloop
        endif
    endif
endfunction

Internal Instructions
- To add max HP of a unit, simply set which unit to be added and the value to be added, example;
  • Actions
    • Set CS_Unit = Paladin 0000 <gen>
    • Set CS_Value = 1000
    • Custom script: call AddHP()
- Same goes for other function;
  • Custom script: call RemoveHP()
  • Custom script: call AddMP()
  • Custom script: call RemoveMP()
  • Custom script: call AddDamage()
  • Custom script: call RemoveDamage()
  • Custom script: call AddArmor()
  • Custom script: call RemoveArmor()
  • Custom script: call AddSight()
  • Custom script: call RemoveSight()
- I also included a demo trigger, you should know how to use it in less than 5 seconds.


  • CS Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local integer maxability = 140
      • Custom script: local integer i = 1
      • Custom script: local unit Dummy = CreateUnit(Player (0), 'hfoo', 0.00, 0.00, 0.00)
      • Custom script: set udg_Error = CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
      • Set CS_AddHP[1] = HP Add +8192
      • Set CS_AddHP[2] = HP Add +4096
      • Set CS_AddHP[3] = HP Add +2048
      • Set CS_AddHP[4] = HP Add +1024
      • Set CS_AddHP[5] = HP Add +512
      • Set CS_AddHP[6] = HP Add +256
      • Set CS_AddHP[7] = HP Add +128
      • Set CS_AddHP[8] = HP Add +64
      • Set CS_AddHP[9] = HP Add +32
      • Set CS_AddHP[10] = HP Add +16
      • Set CS_AddHP[11] = HP Add +8
      • Set CS_AddHP[12] = HP Add +4
      • Set CS_AddHP[13] = HP Add +2
      • Set CS_AddHP[14] = HP Add +1
      • Set CS_RemoveHP[1] = HP Remove -8192
      • Set CS_RemoveHP[2] = HP Remove -4096
      • Set CS_RemoveHP[3] = HP Remove -2048
      • Set CS_RemoveHP[4] = HP Remove -1024
      • Set CS_RemoveHP[5] = HP Remove -512
      • Set CS_RemoveHP[6] = HP Remove -256
      • Set CS_RemoveHP[7] = HP Remove -128
      • Set CS_RemoveHP[8] = HP Remove -64
      • Set CS_RemoveHP[9] = HP Remove -32
      • Set CS_RemoveHP[10] = HP Remove -16
      • Set CS_RemoveHP[11] = HP Remove -8
      • Set CS_RemoveHP[12] = HP Remove -4
      • Set CS_RemoveHP[13] = HP Remove -2
      • Set CS_RemoveHP[14] = HP Remove -1
      • Set CS_AddMP[1] = MP Add +8192
      • Set CS_AddMP[2] = MP Add +4096
      • Set CS_AddMP[3] = MP Add +2048
      • Set CS_AddMP[4] = MP Add +1024
      • Set CS_AddMP[5] = MP Add +512
      • Set CS_AddMP[6] = MP Add +256
      • Set CS_AddMP[7] = MP Add +128
      • Set CS_AddMP[8] = MP Add +64
      • Set CS_AddMP[9] = MP Add +32
      • Set CS_AddMP[10] = MP Add +16
      • Set CS_AddMP[11] = MP Add +8
      • Set CS_AddMP[12] = MP Add +4
      • Set CS_AddMP[13] = MP Add +2
      • Set CS_AddMP[14] = MP Add +1
      • Set CS_RemoveMP[1] = MP Remove -8192
      • Set CS_RemoveMP[2] = MP Remove -4096
      • Set CS_RemoveMP[3] = MP Remove -2048
      • Set CS_RemoveMP[4] = MP Remove -1024
      • Set CS_RemoveMP[5] = MP Remove -512
      • Set CS_RemoveMP[6] = MP Remove -256
      • Set CS_RemoveMP[7] = MP Remove -128
      • Set CS_RemoveMP[8] = MP Remove -64
      • Set CS_RemoveMP[9] = MP Remove -32
      • Set CS_RemoveMP[10] = MP Remove -16
      • Set CS_RemoveMP[11] = MP Remove -8
      • Set CS_RemoveMP[12] = MP Remove -4
      • Set CS_RemoveMP[13] = MP Remove -2
      • Set CS_RemoveMP[14] = MP Remove -1
      • Set CS_AddDamage[1] = Damage Add +8192
      • Set CS_AddDamage[2] = Damage Add +4096
      • Set CS_AddDamage[3] = Damage Add +2048
      • Set CS_AddDamage[4] = Damage Add +1024
      • Set CS_AddDamage[5] = Damage Add +512
      • Set CS_AddDamage[6] = Damage Add +256
      • Set CS_AddDamage[7] = Damage Add +128
      • Set CS_AddDamage[8] = Damage Add +64
      • Set CS_AddDamage[9] = Damage Add +32
      • Set CS_AddDamage[10] = Damage Add +16
      • Set CS_AddDamage[11] = Damage Add +8
      • Set CS_AddDamage[12] = Damage Add +4
      • Set CS_AddDamage[13] = Damage Add +2
      • Set CS_AddDamage[14] = Damage Add +1
      • Set CS_RemoveDamage[1] = Damage Remove -8192
      • Set CS_RemoveDamage[2] = Damage Remove -4096
      • Set CS_RemoveDamage[3] = Damage Remove -2048
      • Set CS_RemoveDamage[4] = Damage Remove -1024
      • Set CS_RemoveDamage[5] = Damage Remove -512
      • Set CS_RemoveDamage[6] = Damage Remove -256
      • Set CS_RemoveDamage[7] = Damage Remove -128
      • Set CS_RemoveDamage[8] = Damage Remove -64
      • Set CS_RemoveDamage[9] = Damage Remove -32
      • Set CS_RemoveDamage[10] = Damage Remove -16
      • Set CS_RemoveDamage[11] = Damage Remove -8
      • Set CS_RemoveDamage[12] = Damage Remove -4
      • Set CS_RemoveDamage[13] = Damage Remove -2
      • Set CS_RemoveDamage[14] = Damage Remove -2
      • Set CS_AddArmor[1] = Add Armor +8192
      • Set CS_AddArmor[2] = Add Armor +4096
      • Set CS_AddArmor[3] = Add Armor +2048
      • Set CS_AddArmor[4] = Add Armor +1024
      • Set CS_AddArmor[5] = Add Armor +512
      • Set CS_AddArmor[6] = Add Armor +256
      • Set CS_AddArmor[7] = Add Armor +128
      • Set CS_AddArmor[8] = Add Armor +64
      • Set CS_AddArmor[9] = Add Armor +32
      • Set CS_AddArmor[10] = Add Armor +16
      • Set CS_AddArmor[11] = Add Armor +8
      • Set CS_AddArmor[12] = Add Armor +4
      • Set CS_AddArmor[13] = Add Armor +2
      • Set CS_AddArmor[14] = Add Armor +1
      • Set CS_RemoveArmor[1] = Remove Armor -8192
      • Set CS_RemoveArmor[2] = Remove Armor -4096
      • Set CS_RemoveArmor[3] = Remove Armor -2048
      • Set CS_RemoveArmor[4] = Remove Armor -1024
      • Set CS_RemoveArmor[5] = Remove Armor -512
      • Set CS_RemoveArmor[6] = Remove Armor -256
      • Set CS_RemoveArmor[7] = Remove Armor -128
      • Set CS_RemoveArmor[8] = Remove Armor -64
      • Set CS_RemoveArmor[9] = Remove Armor -32
      • Set CS_RemoveArmor[10] = Remove Armor -16
      • Set CS_RemoveArmor[11] = Remove Armor -8
      • Set CS_RemoveArmor[12] = Remove Armor -4
      • Set CS_RemoveArmor[13] = Remove Armor -2
      • Set CS_RemoveArmor[14] = Remove Armor -1
      • Set CS_AddSight[1] = Add Sight +8192
      • Set CS_AddSight[2] = Add Sight +4096
      • Set CS_AddSight[3] = Add Sight +2048
      • Set CS_AddSight[4] = Add Sight +1024
      • Set CS_AddSight[5] = Add Sight +512
      • Set CS_AddSight[6] = Add Sight +256
      • Set CS_AddSight[7] = Add Sight +128
      • Set CS_AddSight[8] = Add Sight +64
      • Set CS_AddSight[9] = Add Sight +32
      • Set CS_AddSight[10] = Add Sight +16
      • Set CS_AddSight[11] = Add Sight +8
      • Set CS_AddSight[12] = Add Sight +4
      • Set CS_AddSight[13] = Add Sight +2
      • Set CS_AddSight[14] = Add Sight +1
      • Set CS_RemoveSight[1] = Remove Sight -8192
      • Set CS_RemoveSight[2] = Remove Sight -4096
      • Set CS_RemoveSight[3] = Remove Sight -2048
      • Set CS_RemoveSight[4] = Remove Sight -1024
      • Set CS_RemoveSight[5] = Remove Sight -512
      • Set CS_RemoveSight[6] = Remove Sight -256
      • Set CS_RemoveSight[7] = Remove Sight -128
      • Set CS_RemoveSight[8] = Remove Sight -64
      • Set CS_RemoveSight[9] = Remove Sight -32
      • Set CS_RemoveSight[10] = Remove Sight -16
      • Set CS_RemoveSight[11] = Remove Sight -8
      • Set CS_RemoveSight[12] = Remove Sight -4
      • Set CS_RemoveSight[13] = Remove Sight -2
      • Set CS_RemoveSight[14] = Remove Sight -1
      • Set CS_Ability[1] = Damage Add +1
      • Set CS_Ability[2] = Damage Add +2
      • Set CS_Ability[3] = Damage Add +4
      • Set CS_Ability[4] = Damage Add +8
      • Set CS_Ability[5] = Damage Add +16
      • Set CS_Ability[6] = Damage Add +32
      • Set CS_Ability[7] = Damage Add +64
      • Set CS_Ability[8] = Damage Add +128
      • Set CS_Ability[9] = Damage Add +256
      • Set CS_Ability[10] = Damage Add +512
      • Set CS_Ability[11] = Damage Add +1024
      • Set CS_Ability[12] = Damage Add +2048
      • Set CS_Ability[13] = Damage Add +4096
      • Set CS_Ability[14] = Damage Add +8192
      • Set CS_Ability[15] = Damage Remove -1
      • Set CS_Ability[16] = Damage Remove -2
      • Set CS_Ability[17] = Damage Remove -4
      • Set CS_Ability[18] = Damage Remove -8
      • Set CS_Ability[19] = Damage Remove -16
      • Set CS_Ability[20] = Damage Remove -32
      • Set CS_Ability[21] = Damage Remove -64
      • Set CS_Ability[22] = Damage Remove -128
      • Set CS_Ability[23] = Damage Remove -256
      • Set CS_Ability[24] = Damage Remove -512
      • Set CS_Ability[25] = Damage Remove -1024
      • Set CS_Ability[26] = Damage Remove -2048
      • Set CS_Ability[27] = Damage Remove -4096
      • Set CS_Ability[28] = Damage Remove -8192
      • Set CS_Ability[29] = Add Armor +1
      • Set CS_Ability[30] = Add Armor +1024
      • Set CS_Ability[31] = Add Armor +128
      • Set CS_Ability[32] = Add Armor +16
      • Set CS_Ability[33] = Add Armor +2
      • Set CS_Ability[34] = Add Armor +2048
      • Set CS_Ability[35] = Add Armor +256
      • Set CS_Ability[36] = Add Armor +32
      • Set CS_Ability[37] = Add Armor +4
      • Set CS_Ability[38] = Add Armor +4096
      • Set CS_Ability[39] = Add Armor +512
      • Set CS_Ability[40] = Add Armor +64
      • Set CS_Ability[41] = Add Armor +8
      • Set CS_Ability[42] = Add Armor +8192
      • Set CS_Ability[43] = Remove Armor -1
      • Set CS_Ability[44] = Remove Armor -1024
      • Set CS_Ability[45] = Remove Armor -128
      • Set CS_Ability[46] = Remove Armor -16
      • Set CS_Ability[47] = Remove Armor -2
      • Set CS_Ability[48] = Remove Armor -2048
      • Set CS_Ability[49] = Remove Armor -256
      • Set CS_Ability[50] = Remove Armor -32
      • Set CS_Ability[51] = Remove Armor -4
      • Set CS_Ability[52] = Remove Armor -4096
      • Set CS_Ability[53] = Remove Armor -512
      • Set CS_Ability[54] = Remove Armor -64
      • Set CS_Ability[55] = Remove Armor -8
      • Set CS_Ability[56] = Remove Armor -8192
      • Set CS_Ability[57] = HP Add +1
      • Set CS_Ability[58] = HP Add +1024
      • Set CS_Ability[59] = HP Add +128
      • Set CS_Ability[60] = HP Add +16
      • Set CS_Ability[61] = HP Add +2
      • Set CS_Ability[62] = HP Add +2048
      • Set CS_Ability[63] = HP Add +256
      • Set CS_Ability[64] = HP Add +32
      • Set CS_Ability[65] = HP Add +4
      • Set CS_Ability[66] = HP Add +4096
      • Set CS_Ability[67] = HP Add +512
      • Set CS_Ability[68] = HP Add +64
      • Set CS_Ability[69] = HP Add +8
      • Set CS_Ability[70] = HP Add +8192
      • Set CS_Ability[71] = HP Remove -1
      • Set CS_Ability[72] = HP Remove -1024
      • Set CS_Ability[73] = HP Remove -128
      • Set CS_Ability[74] = HP Remove -16
      • Set CS_Ability[75] = HP Remove -2
      • Set CS_Ability[76] = HP Remove -2048
      • Set CS_Ability[77] = HP Remove -256
      • Set CS_Ability[78] = HP Remove -32
      • Set CS_Ability[79] = HP Remove -4
      • Set CS_Ability[80] = HP Remove -4096
      • Set CS_Ability[81] = HP Remove -512
      • Set CS_Ability[82] = HP Remove -64
      • Set CS_Ability[83] = HP Remove -8
      • Set CS_Ability[84] = HP Remove -8192
      • Set CS_Ability[85] = MP Add +1
      • Set CS_Ability[86] = MP Add +1024
      • Set CS_Ability[87] = MP Add +128
      • Set CS_Ability[88] = MP Add +16
      • Set CS_Ability[89] = MP Add +2
      • Set CS_Ability[90] = MP Add +2048
      • Set CS_Ability[91] = MP Add +256
      • Set CS_Ability[92] = MP Add +32
      • Set CS_Ability[93] = MP Add +4
      • Set CS_Ability[94] = MP Add +4096
      • Set CS_Ability[95] = MP Add +512
      • Set CS_Ability[96] = MP Add +64
      • Set CS_Ability[97] = MP Add +8
      • Set CS_Ability[98] = MP Add +8192
      • Set CS_Ability[99] = MP Remove -1
      • Set CS_Ability[100] = MP Remove -1024
      • Set CS_Ability[101] = MP Remove -128
      • Set CS_Ability[102] = MP Remove -16
      • Set CS_Ability[103] = MP Remove -2
      • Set CS_Ability[104] = MP Remove -2048
      • Set CS_Ability[105] = MP Remove -256
      • Set CS_Ability[106] = MP Remove -32
      • Set CS_Ability[107] = MP Remove -4
      • Set CS_Ability[108] = MP Remove -4096
      • Set CS_Ability[109] = MP Remove -512
      • Set CS_Ability[110] = MP Remove -64
      • Set CS_Ability[111] = MP Remove -8
      • Set CS_Ability[112] = MP Remove -8192
      • Set CS_Ability[113] = Add Sight +1
      • Set CS_Ability[114] = Add Sight +1024
      • Set CS_Ability[115] = Add Sight +128
      • Set CS_Ability[116] = Add Sight +16
      • Set CS_Ability[117] = Add Sight +2
      • Set CS_Ability[118] = Add Sight +2048
      • Set CS_Ability[119] = Add Sight +256
      • Set CS_Ability[120] = Add Sight +32
      • Set CS_Ability[121] = Add Sight +4
      • Set CS_Ability[122] = Add Sight +4096
      • Set CS_Ability[123] = Add Sight +512
      • Set CS_Ability[124] = Add Sight +64
      • Set CS_Ability[125] = Add Sight +8
      • Set CS_Ability[126] = Add Sight +8192
      • Set CS_Ability[127] = Remove Sight -1
      • Set CS_Ability[128] = Remove Sight -1024
      • Set CS_Ability[129] = Remove Sight -128
      • Set CS_Ability[130] = Remove Sight -16
      • Set CS_Ability[131] = Remove Sight -2
      • Set CS_Ability[132] = Remove Sight -2048
      • Set CS_Ability[133] = Remove Sight -256
      • Set CS_Ability[134] = Remove Sight -32
      • Set CS_Ability[135] = Remove Sight -4
      • Set CS_Ability[136] = Remove Sight -4096
      • Set CS_Ability[137] = Remove Sight -512
      • Set CS_Ability[138] = Remove Sight -64
      • Set CS_Ability[139] = Remove Sight -8
      • Set CS_Ability[140] = Remove Sight -8192
      • Set CS_LoopingBase[1] = 8192
      • Set CS_LoopingBase[2] = 4096
      • Set CS_LoopingBase[3] = 2048
      • Set CS_LoopingBase[4] = 1024
      • Set CS_LoopingBase[5] = 512
      • Set CS_LoopingBase[6] = 256
      • Set CS_LoopingBase[7] = 128
      • Set CS_LoopingBase[8] = 64
      • Set CS_LoopingBase[9] = 32
      • Set CS_LoopingBase[10] = 16
      • Set CS_LoopingBase[11] = 8
      • Set CS_LoopingBase[12] = 4
      • Set CS_LoopingBase[13] = 2
      • Set CS_LoopingBase[14] = 1
      • Set CS_MaxLoopingBase = 14
      • -------- PRELOADING SPELLS --------
      • Custom script: loop
      • Custom script: exitwhen i > maxability
      • Custom script: call UnitAddAbility(Dummy, udg_CS_Ability[i])
      • Custom script: set i = i + 1
      • Custom script: endloop
      • Custom script: call RemoveUnit(Dummy)
      • Custom script: set Dummy = null
      • -------- PRELOADING SPELLS --------
      • Custom script: set udg_CS_Hashtable = InitHashtable()
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
- WaterKnight -> First modulo solution
- Halo7568 - Full credits to him for the code (modulo algorithm)
- Vexorian -> SimError
- Magtheridon96 - Showed me the new algorithm


v1.0
- Initial release

v1.1
- Sound leak and player leak has been fixed
- Changed to new algorithm to base 2
- Added new customization, Damage and Armor
- Deleted some variables, replaced them with just local variables

v1.2
- Added new customization; Sight Range


Keywords:
defskull, custom, stats, system, add, hp, mp, remove, max, armor, sight, range, armor.
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 15:56, 18th Jul 2012 Magtheridon96: For starters, you can reduce the number of abilities. You can cut them in half if you use only one ability that gives negative stats. If the...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

15:56, 18th Jul 2012
Magtheridon96:

For starters, you can reduce the number of abilities.
You can cut them in half if you use only one ability that gives negative stats.

If the highest positive bonus is 8192, all you need is a -16384 ability.
 
Well, while it's called in GUI, the actual part you put in "triggers" is simply the preloading, right (as well as setting the powers of 10 to reach wanted values)? or atleast it looks that way, Eitherway I'd put the Jass script in the "Triggers" section and change the category, considering it's operation that's done in GUI (or Jass) but the actual key script is in Jass. Also, you could add the set-up of the variables into the jass section as well of this system, just to make it more compact.
 
I think I'll stick to my current trigger, your suggestion is just to improve the "eye-candy".

actually my suggesting to change category was to make the category correct, since the majority of this is Jass, not GUI. And compressing it for compacting is also to make it easier to use and so that people don't have to import waste
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
For the abilities are you using this method:
1-9, 10-90, 100-900, and so on?
Don't add MS tho, you can change that really easy in triggers xD
Yeah, I'm using a mod function which allows me to find appropriate value for each level such as 874, I would separate a +100 HP to level 8 | +70 HP to level 7 | +4 HP to level 4, therefore it would 800 + 70 + 4.
This algorithm is fully made by halo7568, full credits goes to him for that algorithm search.

actually my suggesting to change category was to make the category correct, since the majority of this is Jass, not GUI. And compressing it for compacting is also to make it easier to use and so that people don't have to import waste
Ohhh change it from GUI -> JASS ?
I prefer not, cause' I want this system to be in favor for GUI-users, if I change it to JASS category, I'm afraid I would scare them away before they actually download and test it >.>"
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Like 2 4 8, such as computer's memory ?
I don't really get that how to do it, like +2 damage, and then +4 damage, how do you want to +3 damage ?
I know they did it in base 2 and it's perfect, but how it is executed ?
But never mind, I'll stick to this method for now.
 
It's very efficient with powers of 2.

Let's say I want to add 3847 damage.

I have a list of powers of 2:

1,2,4,8,16,32,64,128,256,512,1024,2048,4096

I'm going to loop over this list:

4096 > 3847 ---- Do nothing
2048 < 3847 ---- Add the +2048 damage ability
=> 3847 - 2048 = 1799 != 0, so we continue...
1024 < 1799 ---- Add the +1024 damage ability
=> 1799 - 1024 = 775 != 0, so we continue...
512 < 775 ---- Add the +512 damage ability
=> 775 - 512 = 263 != 0, so we continue...
256 < 263 ---- Add the +256 damage ability
=> 263 - 256 = 7 != 0, so we continue...
128 > 7 ---- Do nothing
64 > 7 ---- Do nothing
32 > 7 ---- Do nothing
16 > 7 ---- Do nothing
8 > 7 ---- Do nothing
4 < 7 ---- Add the +4 damage ability
=> 7 - 4 = 3 != 0, so we continue
2 < 3 ---- Add the +2 damage ability
=> 3 - 2 = 1 != 0, so we continue
1 = 1 ---- Add the +1 damage ability
=> 1 - 1 = 0, so we stop.

We are done.

So, we added the following:

2048 + 1024 + 512 + 256 + 4 + 2 + 1 = 3847


The powers of 2 algorithm is the fastest you can have.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Hahaha I forgot there is +1 damage initially, I thought it started with 2 LOL.
Hmmm I'll try to change the algorithm.


But to think that, each ability will have like 13 levels ? (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096)

And if I use base 10, I would only need 4 abilities (but each has 9 levels) = 36

Which is more efficient ? (Proven)

Having many abilities (low level quantity) or having low abilities (high level quantity) ?

Also, to perform that check and looping, really, I think it has same efficiency ?

Well, if you prove me, that's nicer, like why is this more efficient than previous, I would be glad :)

Also, if you convince me enough, I might change the algorithm.
 
Level 10
Joined
Aug 21, 2010
Messages
316
Do not change anything just because someone does not like the way you did it.
After all why should you changed something that works just fine?
Can it be done better or can it be done differently? Of course you can!!!


But what it means?
For example:

If I told you now.This is not done well, do this and it will be better(And let's say your system is working perfectly) this means that from my point of view,something better,but this does not mean that it will be better for everyone(that's just my dissenting opinion)

And what now?

Just because I think it is something better or faster or whatever,you should change something that already works perfectly.Well maybe just someone interested only in that the system is quite stable and not a speed or whatever.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I can't argue with your statement, as long as the system is non-laggy and stable (does not cause weird bugs that could ruin gameplay, etc) but I was afraid that mods would not approve this, that's all.

An approve system looks more appeal you know.

Also, as I already stated to mag, I need him to prove me first how would his approach is better and does he have a solid prove on that ?

Perhaps some benchmark or something ?

Because as I think deeper, it would be the same, having 13 levels of ability per customization VS having 4 abilities (9 levels each).

Current Update:
Preparing to upload v1.2, added Armor and Damage customization.
 
@zv27: It's not my opinion, it's the fact that the current algorithm isn't the best one.
Well, not exactly that, it's the fact that there is an algorithm that is way better. The current algorithm is fine, but it is possible to make a much better one for Warcraft III.

@defskull:
Actually, having more abilities and less levels is the right way to go.
Plus, it's way more efficient at the level of the code.

The reason it's more advantageous to have more abilities rather than more levels is because abilities with 4 or less levels can be converted into xml files, thus decreasing the size of the map.

And no, I'm not asking you to make 1 ability with 13 levels, but 13 abilities with 1 level each :p (You don't need 13 abilities for all of them, damage only needs about 10 abilities because you're never going to need to add more than 1023 damage)

This is up to the user though.
 
Level 10
Joined
Aug 21, 2010
Messages
316
@zv27: It's not my opinion, it's the fact that the current algorithm isn't the best one.
Well, not exactly that, it's the fact that there is an algorithm that is way better. The current algorithm is fine, but it is possible to make a much better one for Warcraft III.

@defskull:
Actually, having more abilities and less levels is the right way to go.
Plus, it's way more efficient at the level of the code.

The reason it's more advantageous to have more abilities rather than more levels is because abilities with 4 or less levels can be converted into xml files, thus decreasing the size of the map.

And no, I'm not asking you to make 1 ability with 13 levels, but 13 abilities with 1 level each :p (You don't need 13 abilities for all of them, damage only needs about 10 abilities because you're never going to need to add more than 1023 damage)

This is up to the user though.

Again, doing the same thing but no matter.
Of course it is possible to do even better algorithm,but this is your very far from being the best.

And after all, defines the man.First you say that the best, and soon after that, maybe it's not so and finally say you can do even better.So what you told us a new(NOTHING) Of course you can better.We know that without you.
 
What are you trying to argue here?
Just because he did it using a working method means that he should keep it the way it is?
That's the complete opposite of progress my friend.

Also, no one in this thread mentioned how the optimizer can compress abilities with levels lower than 5 to xml files, so you're argument is invalid. I did present new information.
 
Level 10
Joined
Aug 21, 2010
Messages
316
What are you trying to argue here?
Just because he did it using a working method means that he should keep it the way it is?
That's the complete opposite of progress my friend.

Also, no one in this thread mentioned how the optimizer can compress abilities with levels lower than 5 to xml files, so you're argument is invalid. I did present new information.

I think I was clear enough
 
And after all, defines the man.

First you say that the best, and soon after that, maybe it's not so and finally say you can do even better.

Broken English

So what you told us a new(NOTHING)

False

but this is your very far from being the best.

More broken english

And yet:

I think I was clear enough

No, you were not clear enough.

I'm not trying to offend you here, and I don't want to start an argument (I'm not that type of person), but really, I'm only giving him a few tips and showing him the best known algorithm for what he is trying to achieve and why the method that I'm presenting is faster. I'm not forcing him to use my method, I'm showing him how the method I'm outlining is better. He chooses whether or not he wants to implement it.

And yes, I /can/ do better, and we all know that, but I'm not even going to try, so I might as well help defskull ameliorate his script.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It supports a maximum of 16383 to a minimum of -16383 stats.
I might wanna list that for each function in the next update.
It's not the same applies to all customization.

This value is applied to Max HP/MP / Damage / Armor but not will apply to Attack Speed because as we all know the maximum Attack Speed in Warcraft III is around 400% ? (correct me if I'm wrong) so there's no use to add a 16383 of Attack Speed to a unit.

For the current customization, all customization are limited to that values (-16383 ~ 16383).
And this value is not part of configurable because it relates with the abilities in Object Editor.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Still, if I change to base 2, you would need a tiring job to copy paste like 40++ abilities.
I'm looking for a solution that is able to export/import those abilities without replacing the custom data inside Object Editor.

Apparently, if you use the Import/Export All Object Data, it will replace custom data inside Object Editor, and you don't want that eh ?

In order for you not to replace those custom data, is to copy and paste those abilities one by one... it's tiring, but hey, at least it does not replace the Raw ID.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Am... i placed the abilities one by one and the Raw ID problem occured? o_O
If you copy one by one (140++ times you switch between maps), the problem will never occur as it does not replace the ID of the object.

Like, if you already have custom ability with ID 'A000', and when you copy the ability from the system with ID 'A000' too, and when you paste it, it will automatically turns its ID to 'A001'.

Defskull, you should make it support a little bit more for the life. 16k is quite low tbh.
I am thinking for the solution to import/export those abilities all at a time without replacing custom object that is already in that map, it's tiring for a person to repeat the process for 140++ times.
After I found the solution, I can easily make it support more values.
 
Top