Aller au contenu

Photo

Displaying quest status text on the PC


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

#1
Jezla

Jezla
  • Members
  • 173 messages
I have a quest in my mod in which the PC has to use five different placeables to complete it.  I'd like to display text over the PC when each one is used telling how many remain, similar to how it's done for finding militia members in the first part of the OC.

For example, if you use one of the placeables, floaty text appears that says "Placeables used 2/5" or something similar.

I've tried to see how this is done in the OC, but it's so complex it makes no sense how they did it.

#2
kamal_

kamal_
  • Members
  • 5 260 messages
local int on the pc (or global int if you need to do it that way), "quest_placeables". Then when the player uses a placeable, increment the local int and send a message to the player "Placeables Used " + IntToString(GetLocalInt(oPC, "quest_placeables") +"/5".

#3
Jezla

Jezla
  • Members
  • 173 messages
Thanks kamal!

#4
Shaun the Crazy One

Shaun the Crazy One
  • Members
  • 183 messages
It's pretty much like kamal said.  This script should do it, just put it in the "on used" proporty node of the placeables.

[code=auto:0]
void main()
{
    //Check to make sure script's activator is the PC
    object oPC = GetLastUsedBy();
    if (!GetIsPC(oPC)) return;
   
    //get local variable from the PC
    int iPlaceables = GetLocalInt(oPC,"quest_placeables");
    //create the local variable if it doesn't yet exist
    if(iPlaceables < 1) iPlaceables = 1;
    //increment it if it does
    else  iPlaceables++;
    SetLocalInt(oPC,"quest_placeables",iPlaceables);
    //Display floating text
    FloatingTextStringOnCreature(IntToString(iPlaceables) + "/5 Activated", oPC);
}

(edit: noticed a bug)

Modifié par Shaun the Crazy One, 25 janvier 2012 - 03:29 .


#5
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
SetNoticeText displays the yellow all-caps text at the top of the string. It's bit less intrusive than FloatingTextString, a little bit easier to ignore.

#6
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I usually use SetNoticeText() with SendMessageToPC(). This way the message goes on the screen and also in the message box so that you can scroll back and see what happened later.

#7
Jezla

Jezla
  • Members
  • 173 messages
Thanks for all the help! I think I can incorporate Shaun's code into my existing OnUsed script. Instead of using a different script for each placeable, I'm using a single script with a switch/case statement that depends on the number of placeables used to determine what code to run. I can use the same local integer in the FloatTextStringOnCreature function.