How can I change the tooltip of an item-type (not item)?

Status
Not open for further replies.
Level 13
Joined
Feb 5, 2018
Messages
567
Code:
call BlzSetItemExtendedTooltip( GetItemOfTypeFromUnitBJ(GetEnumUnit(), udg_ItemType), "Test"

This worked at least for units from a unit group. Maybe if you can somehow track the itemtypes in the shop and then reference them?
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
BlzGetAbility functions work with 1-index, while the BlzSetAbility functions work with 0-index, so you need to get at level of ability, while you set the tooltip at level of ability - 1.
Hmm, I don't think so. Funny thing is that BlzGetAbilityExtendedTooltip after using BlzSetAbilityExtendedTooltip it returns me the updated text even if the actual tooltip didn't change.
 
Level 12
Joined
Nov 13, 2010
Messages
277
Warcraft 3 JASS scripting doesn't provide direct access to modify the tooltips of item types. Instead, you can use workarounds to achieve similar effects
try somthing like this
JASS:
constant integer ITEM_TYPE_SWORD = 'I001'
constant integer ITEM_TYPE_ARMOR = 'I002'

// Initialize trigger
function InitTrig_CustomItemTooltip
    local trigger customTrigger = CreateTrigger()
    call TriggerAddAction(customTrigger, function Trig_CustomItemTooltip_Actions)
endfunction

// Define trigger actions
function Trig_CustomItemTooltip_Actions
    local item i = GetSoldItem()
    if GetItemTypeId(i) == ITEM_TYPE_SWORD then
        call BlzSetItemExtendedTooltip(i, "This is a custom tooltip for swords.")
    elseif GetItemTypeId(i) == ITEM_TYPE_ARMOR then
        call BlzSetItemExtendedTooltip(i, "This is a custom tooltip for armor.")
    endif
endfunction

// Call the initialization function
call InitTrig_CustomItemTooltip()
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
Warcraft 3 JASS scripting doesn't provide direct access to modify the tooltips of item types. Instead, you can use workarounds to achieve similar effects
try somthing like this
JASS:
constant integer ITEM_TYPE_SWORD = 'I001'
constant integer ITEM_TYPE_ARMOR = 'I002'

// Initialize trigger
function InitTrig_CustomItemTooltip
    local trigger customTrigger = CreateTrigger()
    call TriggerAddAction(customTrigger, function Trig_CustomItemTooltip_Actions)
endfunction

// Define trigger actions
function Trig_CustomItemTooltip_Actions
    local item i = GetSoldItem()
    if GetItemTypeId(i) == ITEM_TYPE_SWORD then
        call BlzSetItemExtendedTooltip(i, "This is a custom tooltip for swords.")
    elseif GetItemTypeId(i) == ITEM_TYPE_ARMOR then
        call BlzSetItemExtendedTooltip(i, "This is a custom tooltip for armor.")
    endif
endfunction

// Call the initialization function
call InitTrig_CustomItemTooltip()
Oh I see, thanks, but this is not what I want, I want to edit the tooltip that appears in the shop when I wanna buy it
Are you doing this to an ability or to an item?
On an item-type.
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
Oh I see, thanks, but this is not what I want, I want to edit the tooltip that appears in the shop when I wanna buy it

On an item-type.
As far as I know you can't do that. Instead what you can do is use an ability to resemble the item in the store, and when that ability is cast, create the item.

You can base the ability on Charge Gold and Lumber to get appropriate gold cost for the 'item'.
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
Before you ask, HerlySQR: Reveal and Charge Gold & Lumber are the only abilities you can use with a gold/lumber cost. CG&L can have its base order changed like Channel can to avoid order collisions and allow more instances of that ability on the same unit.
Transformation abilities can also require cost, but they have other issues - but they do let an ability have a food cost as well, so there's that. :)
 
Status
Not open for further replies.
Top