You are here

A poem with SpeakString function?

10 posts / 0 new
Last post
Vermillion
A poem with SpeakString function?

Can I make NPC to speak a poem with SpeakString function (not in dialog) but with quotation marks and with several lines of text?

 

  • up
    50%
  • down
    50%
andgalf

Yes, I think you can. Something like this perhaps? If you paint a Generic Trigger, and once you enter the area of the trigger you run a script like this:

 

/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3

For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625    */

//Put this script OnEnter
void main()
{

object oPC = GetEnteringObject();

if (!GetIsPC(oPC)) return;

AssignCommand(GetObjectByTag("talking_guy"), ActionSpeakString("'Bla bla bla'"));

DelayCommand(2.0, AssignCommand(GetObjectByTag("talking_guy"), ActionSpeakString("'Bla blu blu'")));

DelayCommand(5.0, AssignCommand(GetObjectByTag("talking_guy"), ActionSpeakString("'The End.'")));

}

 

  • up
    50%
  • down
    50%
kevL's

// 'testpoetry'

void main()
{
    object oBard = OBJECT_SELF; // define

    DelayCommand( 0.f, AssignCommand(oBard, SpeakString("<c=red>Roses are red ...</c>")));
    DelayCommand( 5.f, AssignCommand(oBard, SpeakString("<c=blue>Violets are blue ...</c>")));
    DelayCommand(10.f, AssignCommand(oBard, SpeakString("<c=green>I forget the next line ...</c>")));
    DelayCommand(15.f, AssignCommand(oBard, SpeakString("<i>love is true.</i>")));
}

 

i don't think double-quotes can be used in a string. (at least not with a simple escape-code) Single-quote marks are okay tho.

  • up
    50%
  • down
    50%
Vermillion
Well the problem is how to make all this in one message, instead of three:
 
'Bla bla bla
Blu blu blu
The end'
 
​And btw is it impossible to use such "quatetion marks" with string data?
  • up
    50%
  • down
    50%
andgalf

Do you mean like this?

 

/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3

For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625    */

//Put this script OnEnter
void main()
{

object oPC = GetEnteringObject();

if (!GetIsPC(oPC)) return;

AssignCommand(GetObjectByTag("talking_guy"), ActionSpeakString("'Roses are red. Violets are blue. I forget the next line. Love is true.'"));

}
 

  • up
    50%
  • down
    50%
kevL's

to break lines, use the newline char: \n

"Roses are red ...\nViolets are blue ...\nI forget the next line ...\nlove is true."

Single quotes are allowed, eg:

"'Roses are red ...\nViolets are blue ...\nI forget the next line ...\nlove is true.'"

but double-quotes are not.

  • up
    100%
  • down
    0%
Vermillion

You make my day, kevL's!

  • up
    50%
  • down
    50%
Tarot Redhand

If it had been the PC that the poen was to hover over then there is an entirely different approach that you could have taken. However this approach would require you to have a little graphics skill. What you would need to do is make or use an image of an open scroll and write your poem onto it. This image would have to be 256 x 256 pixels in size. Then all you would have to do is download my packahe "Micro Maps Version 2" and follow the detailed instructions on making your own. To see the poem in game after you had done that, the player would merely have to use it in their inventory.

But as it was for an NPC, I see that it has been solved. So good luck with your module.

TR

  • up
    100%
  • down
    0%
Vermillion

Well, display picture instead of text is unusual but interesting - maybe I'll use such approach for another situation. Thx Tarot!

 

  • up
    50%
  • down
    50%
Tarot Redhand

Actually, having thought on it a little more I think that the Illustrated Book idea is a better fit.Small quick download (under 1 meg). Run the demo to get the idea. If you need help with this in the future pm me as I don't think I put explicit instructions with it.

<edit>

Dang. I did it again! Obviously my NwN custom content won't work in NwN2. Sorry about that. Hope the idea is of use to you though.

TR

  • up
    100%
  • down
    0%