Hi!

I have a pretty complex thing I'm trying to make here. When loot is dropped on the ground, I have a text that floats above the gameobject displaying it's name. But I'm having trouble showing that name properly.

The first problem I have is actually getting the name of the item that was dropped. What I'm doing right now is:string name = parent.GetComponent<InteractionForwarder> ().baseInteraction.gameObject.name;
string cutName = name.Replace ("_ItemDrop:", "");

Because for some reason this: baseInteraction.dropItem.id always returns item ID 0. Even if the dropped item is ID 50 for example.

Now the second problem is parsing text codes. Is there a method that automatically parses the text codes for me into a string? My item names have text codes like colors, but also variables.

Or better, is it some how possible to use the ORK flying text for this?
  • Even better, you can use the Object type HUD (added in ORK 2.27.0) for that.

    Set up an Object HUD and add an Object HUD component on your item prefabs (or do that via scripting).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 2020
    gamingislove said: Even better, you can use the Object type HUD (added in ORK 2.27.0) for that.

    Set up an Object HUD and add an Object HUD component on your item prefabs (or do that via scripting).
    Ahh, brilliant! That saves me a lot of work.

    Only problem is that it doesn't seem to display the correct name of the item. My items Init event changes the items name and colour according to one of it's variables. The text colour seems to work. But the added variable is not displayed.

    For instance if the item has a string variable with key "quality" and value "Poor", the "Poor" text is added to the items name with "Change Selected Data Name" node. Like this: #text.color3##varstringquality# %n. So then the name should be "Poor Copper Sword".

    But the Object HUD seems to only display the added colour.

    Edit: I actually also just noticed this is how it works in console HUD as well. When an item is acquired it doesn't show the added variables, but does show the colour of the name.
    Post edited by pesukarhu on
  • edited January 2020
    I'll do some tests.

    So, that name change is done in the item's Init Game Event, without any wait node/time before it (in the event)?

    Edit: Tested it - the issue is that you're setting the name to use the variable text code, when the name is used, that'll be replaced by a global variable, not an item variable of the item.
    I'll look into adding options to use the actual content of the variable when changing the name via the node instead of just adding the text code :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • gamingislove said:
    Edit: Tested it - the issue is that you're setting the name to use the variable text code, when the name is used, that'll be replaced by a global variable, not an item variable of the item.
    I'll look into adding options to use the actual content of the variable when changing the name via the node instead of just adding the text code :)
    Ahhh, I see! That makes sense. It does work in tooltips though, those show the variables properly from the item. But yes using the actual content seems a lot nicer anyways.
Sign In or Register to comment.