![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 |
Dracolisk
![]() Join Date: March 21, 2001
Location: Europe
Age: 40
Posts: 6,136
|
Does anyone know how to make an NPC fire a random Speakstring OnHeartbeat (or every x seconds)? I'm asking, because triggers will work only once and I'm working on part of an MP mod.
Thanks in advance. |
![]() |
![]() |
![]() |
#2 | |
Jack Burton
![]() Join Date: May 31, 2002
Location: Ireland
Posts: 5,854
|
I ain't sure whether by 'random' you mean from a list of assigned strings or you just have the one string that you want the NPC to speak. Either way the one I made for you has only one string in it (you can add more if you wish).
Quote:
I don't know exactly what you arte wanting to do but maybe if you call the script from the Onperceived lines it will work better for you (that is everytime a PC is seen by an NPC he/she will utter the string of text). Let me know if this is what you need and i'll make one up for you.
__________________
Still I feel like a child when I look at the moon, maybe I grew up a little too soon... |
|
![]() |
![]() |
![]() |
#3 |
Galvatron
![]() Join Date: June 24, 2002
Location: aa
Posts: 2,101
|
nRandom = Random(4)
switch(nRandom) { case 0: SpeakString(""); break; case 1: SpeakString(""); break; case 2: SpeakString(""); break; case 3: SpeakString(""); break; } edit: wrong function. you can add any number in Random(), results are the value in random - 1, so 4 would give results 0,1,2,3 [ 06-01-2003, 03:57 PM: Message edited by: philip ] |
![]() |
![]() |
![]() |
#4 |
Dracolisk
![]() Join Date: March 21, 2001
Location: Europe
Age: 40
Posts: 6,136
|
Thanks guys. I'll test them as soon as possible [img]smile.gif[/img]
|
![]() |
![]() |
![]() |
#5 | ||
Jack Burton
![]() Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 40
Posts: 5,459
|
I'd actually try changing the OnSpawn script by deleting the '//' in front of the 'SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT);' line, then editing the OnUserDefined script as follows.
Quote:
Quote:
Second, I'm using a random giving 5 answers instead of just three. That's because you probably do not want to have a new line on every single OnHeartbeat event. You can change it to higher numbers and that will decrease the frequency even further. Third, this script only works when you are near the NPC, within 25 meters in this case. Fourth, you'll need to define a speaker (just insert the tag of the NPC there) and an 'oPC'. SpiritWarrior's definition is rather complete, and also includes the distance factor which means you could leave it out here. Fifth, I had to type 'smaller than symbol' because IW wouldn't allow the symbol in what it recognises to be html. Not even in the text down here. Virus protection, I assume. It's the V with the opening to the right, should you be unaware of what it looks like. Third key left of the rightshift. Finally, it's put in the OnUserDefined script rather than inserted directly into the OnHeartbeat script. That's because I have found the OnHeartbeat script may cause your game to stutter when you put lines into it (like a ClearAllActions() for everyone every six seconds), whereas this should not. Using the UserDefined events is also the more organised way of doing things (although the switch is also more organised than the if-then-else procedure, you may want to mix the two of them). [ 06-02-2003, 02:20 PM: Message edited by: Legolas ] |
||
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CEP Weapons Script... | Mozenwrathe | NWN Mod: Escape from Undermountain | 30 | 04-23-2007 12:28 PM |
i need some help about set items script | deeper | NWN Mod: Escape from Undermountain | 8 | 07-06-2004 04:26 PM |
A Script Request ~Chapter 6 Spoilers~ | Dundee Slaytern | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 3 | 02-22-2003 04:36 PM |
Script help | Lord Splynncryth | Dungeon Craft - RPG Game Maker | 2 | 09-15-2002 11:35 PM |
Script | Wedin | Icewind Dale | Heart of Winter | Icewind Dale II Forum | 3 | 04-06-2002 02:14 PM |