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

SetUnitBaseScale [MemoryHack]

Status
Not open for further replies.
Level 2
Joined
Jul 24, 2021
Messages
5
Hello everyone, does anyone have a memhack function SetUnitBaseScale or Unit Base Scale offset? Very necessary.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
There's an Action for it in 1.31+
  • Unit - Set Unit: (Triggering unit)'s Real Field: Scaling Value ('usca') to Value: 2.00
But is a memhack function even necessary on the older versions? Can't you just use this and some clever math?
  • Animation - Change (Triggering unit)'s size to (100.00%, 100.00%, 100.00%) of its original size
 
Level 2
Joined
Jul 24, 2021
Messages
5
Bro it's simple Scale , it scale only unit you put here. I need BaseScale => All units with same rawcode will get this scale number.
 
Level 2
Joined
Jul 24, 2021
Messages
5
Found needed offset, so here is what i wanted.

JASS:
function GetWidgetUIDefById takes integer wid returns integer
    local integer addr= GameDLL + 0x32C880
    if addr != 0 and wid != 0 then
        return this_call_1(addr , wid)
    endif
    return 0
endfunction

function GetUnitBaseUIDataById takes integer uid returns integer
    local integer addr= GameDLL + 0xAB58D4
    if addr != 0 and uid != 0 then
        return GetWidgetUIDefById(uid)
    endif
    return 0
endfunction

function GetUnitBaseUIDataByIdCaching takes integer uid returns integer
    // DEF_ADR_UNIT_UI = 3
    local integer pUnit= 0
    if uid > 0 then
        if HaveSavedInteger(htObjectDataPointers, 3, uid) then
            return LoadInteger(htObjectDataPointers, 3, uid)
        endif
        set pUnit=GetUnitBaseUIDataById(uid)
        if pUnit > 0 then
            call SaveInteger(htObjectDataPointers, 3, uid, pUnit)
        endif
        return pUnit
    endif
    return 0
endfunction

function SetUnitBaseScaleById takes integer uid, real scale returns nothing
    local integer pData= 0
    if uid > 0 then
        set pData=GetUnitBaseUIDataByIdCaching(uid)
        if pData > 0 then
            call WriteRealFloat(pData + 0xB0 , scale)
        endif
    endif
endfunction

function SetUnitBaseScale takes unit u,real scale returns nothing
    call SetUnitBaseScaleById(GetUnitTypeId(u) , scale)
endfunction
 
Status
Not open for further replies.
Top