Author Topic: SetPortraitResRef  (Read 309 times)

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
SetPortraitResRef
« on: October 20, 2013, 05:20:44 am »


               Can this be set on a PC IG?

If so, how would I capture the chat line input and set it on the PC from a placeables convo?

I'd like to be able to let folks reset their Portraits to a custom one they use rather than have to manually LETO them.
               
               

               


                     Modifié par kalbaern, 20 octobre 2013 - 04:22 .
                     
                  


            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
SetPortraitResRef
« Reply #1 on: October 20, 2013, 05:41:14 am »


               Yes, this works on PCs. Here's a simple example to illustrate using chat commands to set a portrait, though you'd surely want a more robust chat command system handling this. Just put this OnPlayerChat and, ingame, type "!portrait x", where x is the name of the portrait. Remember to put everything but the trailing size letter (i.e., po_aragorn_, not po_aragorn_h).

void main()
{
    object oPC   = GetPCChatSpeaker();
    string sChat = GetPCChatMessage();

    // See if the PC's trying to change his portrait
    if (GetStringLeft(sChat, 10) == "!portrait ")
    {
        string sResRef = GetStringRight(sChat, GetStringLength(sChat) - 10);
        SetPortraitResRef(oPC, sResRef);
        SetPCChatMessage();
    }
}

EDIT: to do this from a placeable's conversation, you could have the placeable set a local int on the player and them have the OnPlayerChat script check for the int before attempting to check for the portrait command.

EDIT 2: It's probably a good idea to store the PC's current portrait, just in case they mess something up and need it reset.
               
               

               


                     Modifié par Squatting Monk, 20 octobre 2013 - 04:45 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
SetPortraitResRef
« Reply #2 on: October 21, 2013, 03:42:27 pm »


               When changing a portrait mid conversation, the portrait information is retrieved before the "TextAppearsWhen" script is performed.  So if you want the next conversation line to reflect a different portrait, change the portrait in the "ActionsTaken" script of the previous conversation line.