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

[Solved] Does "call BlzSetUnitRealField(whichunit,ConvertUnitRealField('umvh'),whichreal)" even work?

Status
Not open for further replies.
So I'm trying to get the move height of a unit and transfer it to its related dummies.

Everything in this code below works, except "call BlzSetUnitRealField(tar,ConvertUnitRealField('umvh'),Usrc.ht)".

I tested it out, no matter which real value I set the argument to, it displays "0.000" in debug messages, and it also seems like Warcraft 1.31 doesn't allow access to 'umvh' field at all, as the result of "call utils_pr(R2S(BlzGetUnitRealField(whichunit,ConvertUnitRealField('umvh'))) )" shows, a zero comes out. at least on my end.

What is the problem here? Is it on me or Warcraft?
JASS:
struct U
  unit u
  real fswm
  real bswm
  real lx
  real ly
  real lz
  real lzs
  real imz
  real imzs
  real sca
  real ht

  static method create takes unit u returns U
    local U newobj = U.allocate()
    set newobj.u = u
    set newobj.fswm = BlzGetUnitRealField(u,ConvertUnitRealField('ucpt'))
    set newobj.bswm = BlzGetUnitRealField(u,ConvertUnitRealField('ucbs'))
    set newobj.lx = BlzGetUnitRealField(u,ConvertUnitRealField('ulpx'))
    set newobj.ly = BlzGetUnitRealField(u,ConvertUnitRealField('ulpy'))
    set newobj.lz = BlzGetUnitRealField(u,ConvertUnitRealField('ulpz'))
    set newobj.lzs = BlzGetUnitRealField(u,ConvertUnitRealField('ulsz'))
    set newobj.imz = BlzGetUnitRealField(u,ConvertUnitRealField('uimz'))
    set newobj.imzs = BlzGetUnitRealField(u,ConvertUnitRealField('uisz'))
    set newobj.sca = BlzGetUnitRealField(u,ConvertUnitRealField('usca'))
    set newobj.ht = BlzGetUnitRealField(u,ConvertUnitRealField('umvh'))
    return newobj
  endmethod
endstruct

library utils
  public function transferunitdata takes unit src, unit tar returns nothing
    local U Usrc = U.create(src)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('ucpt'),Usrc.fswm)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('ucbs'),Usrc.bswm)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('ulpx'),Usrc.lx)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('ulpy'),Usrc.ly)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('ulpz'),Usrc.lz)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('ulsz'),Usrc.lzs)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('uimz'),Usrc.imz)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('uisz'),Usrc.imzs)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('usca'),Usrc.sca)
    call BlzSetUnitRealField(tar,ConvertUnitRealField('umvh'),Usrc.ht)
  endfunction

  public function randchars takes integer num returns string
    local integer i
    local string output
    local string randstrs
    local integer randint
    set output = ""
    set randstrs = "ABCDSE!d2!D12d131dd1d2d1!@DQWD@!d12sd12"
    set i = 0
    loop
      exitwhen i == num
      set randint = GetRandomInt(1,StringLength(randstrs))
      set output = output + SubStringBJ(randstrs, randint, randint)
      set i = i + 1
    endloop
    return output
  endfunction

  public function pr takes string msg returns nothing
    call DisplayTextToForce( GetPlayersAll(), randchars(3)+" - "+msg )
  endfunction
endlibrary
 
Last edited:
Status
Not open for further replies.
Top