User:Imbion/Sandbox/Common Script Actions: Difference between revisions
From PMDOWiki
< User:Imbion | Sandbox
No edit summary |
|||
| Line 9: | Line 9: | ||
A simple example of dialogue: | A simple example of dialogue: | ||
<nowiki> | |||
<nowiki> | |||
UI:ResetSpeaker() -- run this first so the text box for sure has no speaker | UI:ResetSpeaker() -- run this first so the text box for sure has no speaker | ||
UI:WaitShowDialouge("These words are spoken by nobody.") | UI:WaitShowDialouge("These words are spoken by nobody.") | ||
Latest revision as of 18:44, 17 August 2025
(wip successor to Scripting Cheat Sheet)
A list of actions commonly done using lua scripting, with sample scripts of how to perform them.
Displaying Text
Text is displayed using the function WaitShowDialouge. Extra features of the text, such as instant text display, the speaker, and whenever the text sound plays, are controlled by calling other functions. Clearing these variables to their default is done by using the function ResetSpeaker.
We can also use text tags to change the behaviour of the text as it displays, such as highlighting certain words in a colour, having text pause for a bit, and changing the speaker's portrait emote.
A simple example of dialogue:
UI:ResetSpeaker() -- run this first so the text box for sure has no speaker
UI:WaitShowDialouge("These words are spoken by nobody.")
local player = CH('PLAYER') --we can access the player any time with this
-- let's make the player speak by setting them as the speaker
UI:SetSpeaker(player)
UI:WaitShowDialouge("But I'm talking now.[pause=0] Pretty cool, right?")
-- now make them emote
UI:SetSpeakerEmotion("Happy")
UI:WaitShowDialouge("It makes me happy that I can speak!")
For more details on how to display dialogue, see Text Guide.
