#Createhero with facet
1 messages · Page 1 of 1 (latest)
for me working normal
Probably you passing old pre patch format, now they use some "FacetIDv2" that basicly packed hero id + old facet id into single int
#1375415550414426194 message
Wait, so what base variant number I should use?
Is this one in java?
What about lua?
WTF is Valve doing
It doesn't make sense, why make all this just to break it down again?
iWas posted js solution
Its to save network traffic and instead of sending 8 bytes (4 byte hero id + 4 byte facet id) they send 4 bytes (hero id + facet id in single int)
But I still don't undestand what to do on lua?
local facetId = 1
local heroId = 35
local facetIdV2 = (heroId << 32) + facetId)
I wrote that in web ide and this might not work in dota (<< might require 5.3 lua while dota have only 5.1 lua), but seems correct
I found a pure code to implement on version 5.1 to make bitwise operations.
Gotta hold to this one. I have a feeling I'll be using this a lot in the future
ask chatgpt to rewrite js to lua
function parseVariant(variant)
local num = tonumber(variant)
if not num then return nil end
local hex = string.format("%x", num)
hex = string.rep("0", 10 - #hex) .. hex
local last2 = string.sub(hex, -2)
return tonumber(last2, 16)
end
I'm still getting heroes with no facets
I have a list of all usable FacetIDs of all heroes, I made it manually considering deprecated facets.
I wan't heroes to spawn with random facets, I made a custom pick screen and everything
I printed everything and it returns all values correctly
Is this correct?
local hHero = PlayerResource:GetSelectedHeroEntity(0)
local hPlayer = PlayerResource:GetPlayer(0)
DebugCreateHeroWithVariant( hPlayer, "npc_dota_hero_pudge", 1, DOTA_TEAM_GOODGUYS, false,
function( hEnemy )
hEnemy:SetControllableByPlayer( 0, false )
hEnemy:SetRespawnPosition( hHero:GetAbsOrigin() )
FindClearSpaceForUnit( hEnemy, hHero:GetAbsOrigin(), false )
hEnemy:Hold()
hEnemy:SetIdleAcquire( false )
hEnemy:SetAcquisitionRange( 0 )
end )
copied from hero demo and working normal
