• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] Looking for a list of each unit's BTN Icon (And other values like Rawcode/Id)

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
I've searched around the forums with no luck, does anyone know of an organized list of each unit's respective icon? I mean something that's already filled out, not just a list of the filenames that you can pull from the mpq.

Edit: This is pretty useful: [Snippet] Ascii
It'd still be helpful to have a list of unit's Integer Id's and their Icons.

For example:
Code:
Archmage: Raw = (Hamg) Unit-Type Id = (123123123) Icon = ReplaceableTextures\CommandButtons\BTNHeroArchMage.blp
Bloodmage: Raw = (Hblm) Unit-Type Id = (123123123) Icon = ReplaceableTextures\CommandButtons\BTNHeroBloodElfPrince.blp
etc...

It would be great to have something like this:
Lua:
function UnitInfoList()
    Unit = {}

    local id = 123123123 --Let's say this is Archmage's Unit-Type Id
    Unit[id][RawCode] = "Hamg"
    Unit[id][BTN] = "ReplaceableTextures\CommandButtons\BTNHeroArchMage.blp"
    Unit[id][DISBTN] = "ReplaceableTextures\CommandButtonsDisabled\DISBTNHeroArchMage.blp"

    --etc...
end
I might be going about this the wrong way... But anyway, the idea is if you have a Unit then you can get it's Unit-Type Id
Lua:
local id = GetUnitTypeId(whichUnit)
and then plug that into
Lua:
Unit[id][RawCode]
to get it's RawCode. Same can be done for BTN, DISBTN, etc...
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
Not so much, but thanks anyways :p

I edited my post to be a bit more clear, also I found some decent tools to help with this.

That one I linked is cool, you can convert a unit's Unit-Type Id into it's Rawcode and vice versa, very useful.

I think I'll just make the list myself, although it's going to be a long and boring process and I'd like to make sure that someone else hasn't already done it.
 
Last edited:
RawCode string and unittype-id is very related. I don't use Lua, but depending on wc3's ised Lua version you might be lucky that there's a built-in logics, to get string of the ascii rawcode. Like 'Hfoo' (integer) will convert to "Hfoo" string. Or else, some external code might be used like [Snippet] Ascii.

For getting unit's icon path you might try out using Dynamically Retrieve Object Editor Fields. It doesn't work for all fields, though, so honestly I'm not sure it will work for icon.

I mean something that's already filled out, not just a list of the filenames that you can pull from the mpq.
Have you such an "external list" of the data you would need? If there's all data is such list we could provide the data statically, to fill a table at map start, so one could then retrieve the icon based on unit type, for exmple.
Edit: If there's such I could use a tool to generate code based from it, to fill the table
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
I'm not entirely sure if i'm using that Dynamically Retrieve cheat function properly, but after attempting to get the Paladin's "uico" (Art Field) it just displayed the standard tooltip for Aerial Shackles. I'm assuming it would have Set the tooltip to ReplaceableTexture/etc... if it had worked.

  • Custom script: call BJDebugMsg("Paladin Icon = " + GetObjectFieldString('Hpal', "Art"))
Edit: Hold on, testing "Art" now. No luck :( couldn't get any combination to work, also tried reducing the ability field Level since it's indexed starting at 0 (it was set to 1) but no luck either.

No, I don't have any list unfortunately.
 
Last edited:
Unsure what you wana do with that List. Blizzard provided with 1.29 an api to get the Icon/Tooltip/ExtendedTooltip of an Unit, Item, Ability or Tech objectEditor object. Sadly It does not work for Buffs, anyway it is great. Using this natives:
JASS:
native BlzGetAbilityIcon                           takes integer abilCode returns string
native BlzGetAbilityExtendedTooltip                takes integer abilCode, integer level returns string
native BlzGetAbilityTooltip                        takes integer abilCode, integer level returns string
Use 0 as Level for Unit, Item.

As soon one has the icon one can convert the enabled to the disabled-Version with some sub string concats actions.
A Lua function I wrote when i needed that. Although it fails when CommandButtons is written in a different case or if an Passive Button is used
Lua:
function getDisabledIcon(icon)
    --ReplaceableTextures\CommandButtons\BTNHeroPaladin.tga -> ReplaceableTextures\CommandButtonsDisabled\DISBTNHeroPaladin.tga
    return string.gsub(icon , "CommandButtons\\BTN", "CommandButtonsDisabled\\DISBTN")
end

string.pack(">I4", input) converts AHbz in number format to a String.

The weapon missile model one can get with
JASS:
native GetAbilityEffectById takes integer abilityId, effecttype t, integer index returns string
 
Can't test it now, but so you say
BlzGetAbilityIcon does bring correct icon paths if parameter abilcode is a unit rawcode
Indeed this is the case. In Jass BlzGetAbilityIcon('Hpal') returns the paladin's icon. In Lua it would be BlzGetAbilityIcon(FourCC('Hpal')). And it also works for Abilities, items, Unit and Tech Rawcodes.
 
Level 3
Joined
Aug 18, 2016
Messages
42
Indeed this is the case. In Jass BlzGetAbilityIcon('Hpal') returns the paladin's icon. In Lua it would be BlzGetAbilityIcon(FourCC('Hpal')). And it also works for Abilities, items, Unit and Tech Rawcodes.

So I've read all the posts on this page but i'm still not sure whats going on. What does all the code actually look like? I'm not a programmer per-say, but I'm super good at figuring things out. If I could see all the code then I could as questions about it. Perhaps there is some tutorial on this I could read? Where can I get more info? I'm trying to learn all this.
 
Level 3
Joined
Aug 18, 2016
Messages
42
It's already implemented in your map :p

Thank you Uncle. I think i found the code.

Ok I changed the code to look like this

function Setup_DM_Human_Units takes nothing returns nothing
//You'll need to run this Function in your Add Category trigger
//Human
set udg_DM_Index = udg_DM_Index + 1

set udg_DM_UnitType[udg_DM_Index] = 'H000'

set udg_DM_Index = udg_DM_Index + 1

set udg_DM_UnitType[udg_DM_Index] = 'H001'

set udg_DM_Index = udg_DM_Index + 1

set udg_DM_UnitType[udg_DM_Index] = 'H002'
//Human End
endfunction

But how do I give each player the ability to summon these units? Its currently setup for only player 1. Not only that but I need for these units to only be avaiable for each "Game Mode" because some game modes won't use classes.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
All of the code is in the Script, I forget the name but it won't look like a standard trigger it will have a green icon with binary on it.

Anyway, let's not keep posting in here unless of course you have something to say to the other guys.
 
Status
Not open for further replies.
Top