Area Ambience
This scripting forum is to discuss scripting and for those needing help scripting to get help from others.

Moderators: Mermut, rdjparadis

Post Reply
User avatar
Winterhawk99
Posts: 1629
Joined: Thu Oct 08, 2009 12:00 am
ctp: Yes
nwnihof: Yes
Location: Pa.
Contact:

Area Ambience

Post by Winterhawk99 »

Hi everyone,

As promised since I've started doing quests and working on mods I want to beef up the scripting forum. Now I have to admit that I'm sort of a gorilla scripter which means I make it work but it can get pretty messy so if someone out there has a better suggestion than what I'm writing your more than welcome to post a better way of doing things.

Ok This one is pretty common place to NWN Persistent worlds. Sometimes a player goes into an area and you want to give them some information on what's going on. Maybe there's some tracks on the ground, The air smells bad, The air is really thin and the pc has a hard time breathing, etc....


So I'll show you how to do a floating text. When the PC hits a certain trigger text pops up above his head telling him something about the area. lets start with a script.


Code: Select all

/::///////////////////////////////////////////////
//:: Name 06_Ant_Ambi01
//:://////////////////////////////////////////////
/*
    Relates enviormental conditions to pc
*/
//:://////////////////////////////////////////////
//:: Created By: Winterhawk99
//:: Created On: November 24 2018
//:://////////////////////////////////////////////
void main()
{
  object oEnter=GetEnteringObject();
  if (!GetIsPC(oEnter)) return;

  AssignCommand(oEnter, DelayCommand(1.0,SpeakString("As you enter the air smells of an acrid moldiness")));
  AssignCommand(oEnter, DelayCommand(3.5,SpeakString("The aroma assaults your senses and stings your nose")));
}
First draw your trigger. Open up its properties and click on the OnEnter tab to create your script. The next thing you do is make sure that only pcs will trigger the floating text. You see that in the first two lines (Object oEnter, and If(!GetIsPC.

This tells the engine that only PCs can make the trigger work.

The rest is easy write the first thing you want to say:

AssignCommand....(oEnter: This is your PC as defined in line 2).......1.0(this is your delay)........SpeakString(Your telling the engine to make a floating text above the PCs head.


its that simple. If you want to add more to the text so its not completely across the pcs area of view. make enough of a delay for the player to read the next line just like i did here with the 3.5 delay.


A really simple script that easily understood to add some charactor to the areas you're making. :)[/color]
CTP team member
http://www.harvestmoonconsortium.com
Chief cook and bottle washer for Harvest Moon

Post Reply