Skip to content

SetDescription on items is very unreliable

I can only get it to work maybe 20% of the time, and I have no idea what causes it to fail.
object oUser = GetLastUsedBy();
object oWeap = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oUser);

if(GetIsObjectValid(oWeap)) SetDescription(oWeap, "LOOK AT THIS FANCY DESCRIPTION THAT DOESN'T WORK");

Even this only works maybe 1 in 5 times, whether it's set to change the identified description or not. I don't remember this being an issue in 1.69, anyone have any tips here?

Comments

  • BalanorBalanor Member Posts: 176
    Hmm...not sure what might be causing it to simply fail as your script snippet looks OK to me. I do know that in 1.69 if you copied an item that had its description modified with that function, the new copy would have the original description (which was very annoying). I haven't seen anything to indicate that Beamdog changed/fixed this rather undesirable behavior in EE.

    Later on in this script, you're not perhaps making a copy of the item in the weapon slot, are you? Because that could be the cause then.
  • ProlericProleric Member Posts: 1,281
    What is the context in which you're issuing GetLastUsedBy()? If you're using a door or placeable, fine, but in other contexts the result is unpredictable. Unless oUser is valid, oWeap will be invalid, so renaming will fail.
  • EzRemakeEzRemake Member Posts: 15
    The code snippet was just something I made to test the function, I just threw it on a useable placeable.
Sign In or Register to comment.