More on Wearables
wooterslw
05 Jul 2019, 10:16Is there a option that lets you change "(worn)" that shows after a wearable displayed in your inventory with something else? Preferably by item? So my inventory might show "Leather armor (worn)" and "Sword (wielded)". I mean in the grand scheme it's not horrible showing"Sword (worn)" but if there is an option to change it, I'd like to use it.
mrangel
05 Jul 2019, 20:24If an object has a string attribute named wornmodifier
, this will be used.
It doesn't look like this attribute appears on the 'wearable' tab in the editor, so I think you'll just need to create the attribute yourself.
hegemonkhan
06 Jul 2019, 01:30(filler for getting my edited post, updated/posted)
how its done (generally/conceptually) )by the library/"behind-the-scenes", my own quick examples only:
the trick is using the built-in 'GetDisplayName' or 'GetDisplayAlias' and then concatenating whatever string/text format you want to it:
create ("unarmed")
unarmed.alias = "unarmed"
unarmed.alias_old = "unarmed" // for use when you 'unequip' it, to change its display from 'unarmed (equipped)' back to 'unarmed', via: unarmed.alias = unarmed.alias_old, or: player.right_hand.alias = player.right_hand.alias_old
unarmed.damage = 1
------------
create ("katana")
katana.alias = "katana"
katana.alias_old = "katana" // for use when you 'unequip' it, to change its display from 'katana (equipped)' back to 'katana', via: katana.alias = katana.alias_old, or: player.right_hand.alias = player.right_hand.alias_old
katana.damage = 50
---------------------
// for your 'equip' Script Attribute / Verb, for your 'katana' Object:
// ---------------------------------
// see the 'unequip' code below for why we need to do this stuff:
player.right_hand.alias = player.right_hand.alias_old
player.right_hand.equipped = false
// --------------------------------
player.right_hand = katana
player.right_hand.equipped = true
player.right_hand.alias = GetDisplayAlias (player.right_hand) + " (equipped)"
// player.right_hand.alias = [ GetDisplayAlias (player.right_hand) ] + [ " (equipped") ]
// player.right_hand.alias = [ "katana" ] + [ " (equipped)" ]
msg (player.right_hand.alias)
// displayment:
// katana (equipped)
-----------------------
// for your 'unequip' Script Attribute / Verb, for your 'katana' Object:
player.right_hand.alias = player.right_hand.alias_old // we need to do this, before we then change it to storing the new weapon Object ('unarmed'), as done/seen in a few lines further below
// katana.alias = "katana" // instead of 'katana (equipped)'
player.right_hand.equipped = false // [ katana.equipped = false ] // we need to do this, before we then change it to storing the new weapon Object ('unarmed') seen in the line directly below
player.right_hand = unarmed
player.right_hand.equipped = true
// unarmed.equipped = true
player.right_hand.alias = GetDisplayAlias (player.right_hand) + " (equipped)"
// player.right_hand.alias = [ GetDisplayAlias (player.right_hand) ] + [ " (equipped") ]
// player.right_hand.alias = [ "unarmed" ] + [ " (equipped)" ]
msg (player.right_hand.alias)
// displayment:
// unarmed (equipped)