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.
Displaying quest status text on the PC
Débuté par
Jezla
, janv. 25 2012 02:17
#1
Posté 25 janvier 2012 - 02:17
#2
Posté 25 janvier 2012 - 02:22
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
Posté 25 janvier 2012 - 03:16
Thanks kamal!
#4
Posté 25 janvier 2012 - 03:24
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)
[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
Posté 25 janvier 2012 - 12:14
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
Posté 25 janvier 2012 - 12:19
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
Posté 25 janvier 2012 - 01:00
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.





Retour en haut







