Aller au contenu

Photo

SetPortraitResRef


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
kalbaern

kalbaern
  • Members
  • 824 messages
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 .


#2
Squatting Monk

Squatting Monk
  • Members
  • 446 messages
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 .


#3
WhiZard

WhiZard
  • Members
  • 1 204 messages
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.