Author Sticky: Post Working Scripts Here
Ayath the Loafer Posted: Saturday, 27 July 05:57PM
At last.  I have done it.
This script is mine. I made it. It is far from finished but to tell you the truth - I'm really proud of it.

I actually managed to make something of my own. And all thanks to Celowin. Without his great tutorials I would never have attempted functions.

1. The script is called "Tale Telling" because that is what it does.

However - this is different.
In my new module (the one I'm still working on and had to restart because of the thing crashing on the conversation) I have the PC doing stuff in an Inn and ending up agreeing to tell the story about how he lost his fingers.
When he sits in a specific chair he starts telling the story and at the end he gets transited to a village where the PC then starts acting out the Tale.

There will of course be a condition on the chair so that the Tale Telling only starts when all information has been had from the NPC's. But that's for later.

The Tale Intro gets shown above the PC's head as this fancy floating text that fades away.

The function that controls the lot has four parameters that control what text to show, the creature that speaks, the pause for next line and wether or not the text is shown for other members of the same faction.

void Floattxt(object oCreature, string sTextToFloat, float fSeconds, int bShowFaction=TRUE)

Here's the script - it needs more work but I just couldn't wait to make my little contribution to the forum's.

NWScript:
// script name: in_chair_tale

// The script goes in OnUsed in a chair with the

// tag CHAIR_TALE

// When PC sits in chair he starts telling his story.

// At end of intro he gets transited to new area

// where his story starts

// Written by: Ayath The Loafer

// Greatly inspired by Celowin aka James Foxglove - thanks a lot!

// Updated: 27.7.2002

//

#include "NW_I0_GENERIC"

//

// function Floattxt starts here

void Floattxt(object oCreature, string sTextToFloat, float fSeconds, int bShowFaction=TRUE)

// this function displays floating text (sTextToFloat)

// above a creatures (oCreature) head where it fades out.

// Will it show to faction members? (sShowFaction) TRUE or FALSE

// How long pause after the text for next action (fSeconds)

{

ActionDoCommand(FloatingTextStringOnCreature(sTextToFloat,oCreature,bShowFaction));

ActionWait(fSeconds);

}

// function Floattxt ends here

//

void main()

{

    int nChair = 1;

    object oPlayer = GetLastUsedBy ();

    object oChairPC;

    oChairPC = GetNearestObjectByTag ("CHAIR_TALE", oPlayer, 0);

    AssignCommand (oPlayer, ActionSit (oChairPC));



//if ( GetLocalInt ( oPlayer, "Tell_Tale" )==1)

//{

    //SpeakString("I will tell you the tale of my lost fingers.");

//DelayCommand(8.0f,(SpeakString("My tale takes us back eight years to the time around midsommer of 1874 - by the Zedacian calendar - when I was travelling to King's Reinham in the duchy of Stivenor, some leagues sousth-west of here. I had a break in the village of Long Combe. I arrived in time for the Midsommer festival and I heard of the Legend that was the cause of the festival.")));

ActionDoCommand(Floattxt(oPlayer,"I will tell you the tale of my lost fingers.",3.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"My tale takes us back eight years",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"to the time around midsommer of 1874",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"- by the Zedacian calendar -",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"when I was travelling to King's Reinham",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"in the duchy of Stivenor,",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"some leagues sousth-west of here.",3.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"I had a break in the village of Long Combe.",2.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"I arrived in time for the Midsommer festival",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"and I heard of the Legend",1.0,TRUE));

ActionDoCommand(Floattxt(oPlayer,"that was the cause of the festival.",0.0,TRUE));

//

// Get PC to stand. Otherwise he will be sitting in

// mid air on enter next area

// MoveTo Waypoint helps making sure he is standing

// at arrival.

//

// Also there is a strange problem without these two.

// The PC arrives at new area and starts running to

// lower left corner.

DelayCommand(17.0f,(AssignCommand(oPlayer,ClearAllActions())));

DelayCommand(17.0f,(AssignCommand(oPlayer,ActionMoveToObject(GetNearestObjectByTag("WP_TALE_TELLING")))));

//

// Jump to new location

DelayCommand(18.0f,(AssignCommand(oPlayer, JumpToLocation(GetLocation(GetWaypointByTag("WP_TALE_START"))))));

}



I have a feeling that this is the tecnique I will be using when I get some of my NPC's to chat amongst themselves when triggered by the PC's presence.

Ohh - I can't wait....
I'm hooked. Thanks Celowin!


Ayath The Loafer
_________________
sic gorgiamus allos subjectatos nunc
We gladly feast on those who would subdue us