(flavor text) How to (and best way) to put a message when the PC steps into a certain location?
ListenMirndt
Member Posts: 24
So I am sure this is pretty simple... digging around the toolset for a feature but not sure where to look 
All I want to do is send a message either in the dialog box, or could be above the PC's head... with some flavor text - IE, "you have entered what looks to be an ancient barracks, now in ruin"
What would be the nicest/best way (and how to) do this? thanks!!
All I want to do is send a message either in the dialog box, or could be above the PC's head... with some flavor text - IE, "you have entered what looks to be an ancient barracks, now in ruin"
What would be the nicest/best way (and how to) do this? thanks!!
0
Comments
This goes into the OnEnter script for either the Area or a trigger that your draw. Fortunately the script is the same!
To the combat-log
To floating text
FloatingTextStringOnCreature("Put your message in Speech Marks Here", GetEnteringObject(), FALSE);If you have any issues or questions, Ask away.
// OnEnter script for flavor triggers -- it will float the contents of the // trigger's local string "FloatingText" over anyone who enters (once per PC). // This will be private text unless the local integer "FloatingPublic" is set // on the trigger. void main() { object oEnterer = GetEnteringObject(); object oSelf = OBJECT_SELF; // Only fire for PCs. if ( !GetIsPC(oEnterer) ) return; // See if there is a message to display. string sMessage = GetLocalString(oSelf, "FloatingText"); if ( sMessage == "" ) // Nothing to do! return; // Only fire once per creature. if ( GetLocalInt(oSelf, "FloatingText_DoOnce_" + ObjectToString(oEnterer)) ) return; SetLocalInt(oSelf, "FloatingText_DoOnce_" + ObjectToString(oEnterer), TRUE); // Float the message. FloatingTextStringOnCreature(sMessage, oEnterer, GetLocalInt(oSelf, "FloatingPublic")); }And:
And Old_Gith... that's incredibly helpful - screenshots and everything? you kind of rock!
TR
// Alternative generic fire-once flavour text routine // for single-player modules only // // Place this function in the OnEnter event slot of a generic trigger // To use create a local string variable on the trigger with the name // "MySpeech" (without the quotes) and populate it with the flavour // text you want displayed at that point. void main(() { object oPC = GetEnteringObject(); // PC Object string sSpeakThis; // will hold flavour/error text if(GetIsPC(oPC)) { sSpeakThis = GetLocalString(OBJECT_SELF, "MySpeech"); // Get actual text to speak if(sSpeakThis == "") // Oooops! You either forgot to create the local variable or it is empty sSpeakThis = "Debug message - Nothing to say"; // so give an error message instead AssignCommand(oPC, SpeakString(sSpeakThis)); // speak it DestroyObject(OBJECT_SELF, 1.0); // permanently remove the trigger - // removes possibility for flavour text to show more than once } }Hope you find this useful.
TR
void main() { object oPC = GetEnteringObject(); { if(GetIsPC(oPC)) { if(GetLocalInt(OBJECT_SELF, "DO_ONCE") != 1) { FloatingTextStringOnCreature("FlavorText", oPC); SetLocalInt(OBJECT_SELF, "DO_ONCE", 1); } else return; } else return; } }Super basic and simple but it works, of course I create a template of this and add it all over the place only thing I need to do then is change the flavor text itself. Keep in mind though this is only good for single player mods, all the more complicated ones above probably best for multi player mods
void main() { object oPC = GetEnteringObject(); if(GetIsPC(oPC)) { if(!(GetLocalInt(OBJECT_SELF, "DO_ONCE"))) { FloatingTextStringOnCreature("FlavorText", oPC); SetLocalInt(OBJECT_SELF, "DO_ONCE", TRUE); } } }Question - Did you even bother to read the code, including the comments, that @Old_Gith and I posted or did you just count the number of lines?
TR
void zTalk(); { ClearAllActions(TRUE); ActionStartConversation(oPC, sConversation, FALSE, FALSE); ActionDoCommand(SetCommandable(TRUE)); SetCommandable(FALSE); }At the moment, this is especially important in the Android version, where floating text is not displayed at all if the highlight button is on and the menu buttons are toggled over the log window (which is my normal mode of play). I guess that could be a bug, which might be fixed one day, but still...
Well it compiles for me so not sure why it doesn't for you? Maybe I put a typo in the example above and if you copy pasted it... You get the idea (having looked at it I see I did make an error, oops my bad)
As for my method bloating a module... Well, fair point but is that really a concern for the hardware of today?
void main() { object oPC = GetEnteringObject(); if(GetIsPC(oPC)) { FloatingTextStringOnCreature("FlavorText", oPC); DestroyObject(OBJECT_SELF, 1.0); } }Using DestroyObject() in this way removes the need for your second if and also the need to get and set a local variable.
TR
Do you have any examples? I don't find this very likely.
As long as the triggers are on flat ground there is no need for them to be 3d, but once the ground is uneven they even have to be 3d to not disappear under the terrain in places (and have always worked reliably for me).
Two versions, one fires on a PC only once, the other every time. Description goes in the name field of the trigger, so that's the only typing that you absolutely have to do each time, although it's good to change the trigger tag to something descriptive.