December 21, 2003, 00:03
|
#1
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
NWN Scripting Question
Just wondering, in neverwinter nights, how do you get a NPC to move from point A to point B in scripting?
I was playing aroudn with the tool, but the compiler kept telling me that I was messing up and couldn't go from Area001 to Area002 with the commands I was giving... or even from Point A to Point B.
Any help would be appreciated!
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
December 21, 2003, 17:44
|
#2
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Ah, I think I may be just the person to ask
First, place the NPC on the map.
Second, r-click on the NPC and place a waypoint.
Third, r-clivk on the way point and look at the name of the waypoint. It should be something like WP_NPCname_00
Fourth make a NEW way point where you want the NPC to walk to.
Call the new waypoint WP_NPCname_01
Add waypoints always using the same system.
The NPC will automatically walk its waypoints as soon as it is spawned, in the order 00,01,02,03 untill the last one, then it works through them in reverse.
To make the NPC NOT walk untill you want it to add ClearAllActions() to the end of the on-spawn script. To make it walk add ActionWalkWaypoints() to the script when you want it to do so.
If that doesn't work, tell me exactly what you want, and I'll try and make a script for it.
-Jam
|
|
|
|
December 21, 2003, 18:10
|
#3
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Okay, thanks, I'll try that!
(I think I may have finally stabilized NWN to run on my computer after about a year of tinkering with it... so hopefully I can start enjoying the game!
(the game has both graphics errors and program errors... and for some reason its files fragment themselves when I install the program ... very buggy thing... very buggy...) especially for an XP computer with 512 MB ram and 1.68 GhZ speed
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
December 21, 2003, 18:35
|
#5
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Oh, and another life-saver. If you want NPCs to walk about randomly a bit, instead of standing still, replace the onspawn script with :
Code:
|
void main()
{
AssignCommand (OBJECT_SELF, ActionRandomWalk());
} |
Simple
-Jam
|
|
|
|
December 21, 2003, 19:59
|
#6
|
Deity
Local Time: 07:57
Local Date: November 2, 2010
Join Date: Feb 2000
Location: Las Vegas
Posts: 17,354
|
what graphics card do you have?
__________________
Focus, discipline
Barack Obama- the antichrist
|
|
|
|
December 22, 2003, 00:26
|
#7
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Quote:
|
what graphics card do you have?
|
I've been trying to figure that out myself...
-
I have Directx 8.1, by the way.
-
thanks for the links
-
As for the patches, - all I have to do now is to find someone I know with DSL and a CDRW... and believe me, that isn't easy where I live oh well
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
Last edited by DarkCloud; December 22, 2003 at 00:37.
|
|
|
|
December 22, 2003, 22:24
|
#8
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Thank you Jamski, the waypoints on spawn work... but I'm still having trouble with getting the character to walk to point X during a certain point in the conversation (I want him to lead the characters to point x)
and I also want him to be able to go through area transitions with the character.
Thanks in advance!
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
December 23, 2003, 01:14
|
#9
|
King
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2002
Location: Go sneer at that cow creamer!
Posts: 1,305
|
Just FYI, I think he'll be away through christmas.
__________________
cIV list: cheats
Now watch this drive!
|
|
|
|
December 23, 2003, 11:52
|
#10
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
That's all right- I can wait. I've waited over a year to play the game since I first bought it... so I can wait some more
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
December 27, 2003, 14:05
|
#11
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Bumping for help from Jamski...
*please*
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
December 28, 2003, 09:33
|
#12
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Back again.
Hmmm.... you want them to follow through area transitions... not so easy.
Here's a workaround. At a certain point in the conversation when you want them to leave the area add the standard script nw_d2_leaverun to the actions in the dialoge editor. Place a waypoint called NW_EXIT where you want them to leave the area.
Upon reaching this point in the converstaion the NPC will now turn and run to the exit where you placed NW_EXIT - and destroy itself
Now comes the second part. Place a floor trigger on the other side of the area transition, so that the player will stand on it as soon as they come through the door/gate/whatever and make this transition spawn a copy of the NPC (make sure it only does it once ) Give the copy of the NPC a different file name and also different dialogue. Its a bit clumsy, but trying to get NPCs to go through area transitions is almost impossible.
Tell me if it works.
-Jam
|
|
|
|
December 29, 2003, 09:49
|
#13
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
And... any luck?
-Jam
|
|
|
|
December 30, 2003, 13:24
|
#14
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Well Jamski, I can't even seem to get the character able to move to a waypoint in the middle of a conversation tree.
(I know very little of C++...)
But here's the best I could do; after the void main()
{
AssignCommand (OBJECT_SELF, ActionWalkWaypoints(WP_caretaker_05);
}
and it told me that (ActionWalkWaypoints) was an undefined identifier.
-
After I work out his movements, I'll try the screen-to-screen thing
Just wondering since the NWN site says that this is possible:
-
Quote:
|
3. What if I want part of the circuit to cross an area transition... like going into a house or something?
As I understand it (according to a recent conversation with Preston, who wrote the AI), this works fine. I suspect you would have to have a regular area transition created by the wizard, however.
I recently tried this out, creating a peasant who walked four waypoints, two of them being in another area (inside a house). I then planted a house tile in the main area and connected the two with a door. He left the door open after he used it the first time, but otherwise it worked fine.
|
Do you think that it might be possible to create a cleaner transition in-conversation movement between the areas?
Since it does seem that they can move between screens?
Also about waypoints- can I make a character stop at one and wait until he is approached by the player.
-
and another question on conversations: can I get my character to OnSpawn go to the player and talk to him if he sees the character...
In the module the character is in one room and the caretaker is in another... the caretaker takes a circuit and I want him to say hello when he sees the player.
I've been reading through the guides, but am sill looking for how to do this.
---
um... if I'm overburdening you, please say so- I'm registered on the NWN boards (but find it difficult to psot there because of thread loading times... I do save threads from here however, thanks to your advice)
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
December 30, 2003, 16:57
|
#15
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Hmm, I need to think about this a moment. I'll get back to you soon. It CAN be done that the NPC sees the player and comes up and starts a conversation.... just must remember how...
Give me an hour to try a few ideas out.
-Jam
|
|
|
|
December 30, 2003, 17:02
|
#16
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Making NPCs Initiate Dialogue (untested, but should work)
When the NPC sees a PC, he or she will walk up to the PC and start a conversation.
This will not work if the PC starts visible to the NPC (no OnPercieve event fires).
Create an OnSpawn (by editing the standard OnSpawn) with: SetSpawnInCondition (NW_FLAG_PERCIEVE_EVENT); uncommented.
In your NPC's dialogue file, go to the very first line where he starts his dialogue with
the PC. If you only want him to start this with any given PC once, add the following script
into Actions Taken:
Code:
|
void main()
{
SetLocalInt(GetPCSpeaker(), "Dlg_Init_" + GetTag(OBJECT_SELF), TRUE);
} |
This sets the variable that is used in the script you were using, so the dialogue
isn't done more than once. Now create a new script in the OnUserDefined event for your NPC.
You can put that second script in here, as follows:
Code:
|
void main()
{
int nEvent = GetUserDefinedEventNumber();
if (nEvent == 1002) // OnPerceive event
{
object oPC = GetLastPerceived();
if(GetIsPC(oPC) && GetLocalInt(oPC, "Dlg_Init_" + GetTag(OBJECT_SELF)) == FALSE && !IsInConversation(OBJECT_SELF))
{
ClearAllActions();
AssignCommand(oPC, ClearAllActions());
ActionMoveToObject(oPC);
ActionStartConversation(oPC);
}
}
} |
Now the first time the NPC COMES INTO SIGHT of the player, he should apporach and start his conversation. By adding a second conversation branch, you can mek him say someting else when the PC come up to him later.
Should work *crosses fingers*
As for making them move....
-Jam
|
|
|
|
December 30, 2003, 17:13
|
#17
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Ok... WalkWayPoints is NOT ActionWalkWayPoints. ActionWalkWayPoints does nothing in Aurora. That's what you did wrong. It (for some dumb reason) doesn't have the standard "Action" prefix.
So :
Code:
|
void main()
{
ClearAllActions() ;
WalkWayPoints(WP_caretaker_05) ;
} |
Placed in the "actions taken" slot of the dialogue tree.
That could work...
-Jam
|
|
|
|
December 30, 2003, 17:16
|
#18
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Or...
Code:
|
void main ()
{
AssignCommand (OBJECT_SELF, WalkWayPoints(WP_caretaker_05);
} |
Although I'm not sure its needed to assign the command, as waypoints are tied to specific NPCs anyway.
-Jam
|
|
|
|
December 31, 2003, 23:01
|
#19
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Thank you, I'll try those sometime soon!
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
January 2, 2004, 20:32
|
#20
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Jamski,
Thank you for your scripting help.
The script for having the NPC approach the character worked Perfectly!
I am amazed by it and was so giddy, I couldn't stop smiling for a time...
However, the most important problem with my game... the one that I find essential to the plot of my little campaign is still having difficulties. I might be missing files or something because "WalkWayPoints" does not show in the Funcitons list and when I try either suggestion you gave me...
the problem states that there is an "error:UnidentifiedIdentifier- "WalkWayPoints") The same thing seems to happen with ActionWalkWaypoints in the other place.
Do you know any way to fix this?
Just one more question for today...
1.) Do you know how to make the NPC stop approaching the character after the first time? The NPC kept approaching me after a lull of about 30 seconds...
Thank you again!
-DarkCloud
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
January 3, 2004, 08:55
|
#21
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Make the script only trigger if a variable = 0. Add a line to the end of the script that changes the variable to 1. I'm sure you can manage that
I don't have the compiler open at the moment... Perhaps WalkWayPoints needs to be "WalkWaypoints" Look at the default OnSpawn script on a standard goblin or something, and copy and paste whatever command it is that makes the goblin walk its waypoints. That's what I always do if I'm stuck.
I'm glad the approach script worked though
-Jam
|
|
|
|
January 4, 2004, 07:08
|
#22
|
Emperor
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Sep 2000
Location: The Taste of Japan
Posts: 9,611
|
Walkwaypoints isn't a standard function in the game. It is found in a script library instead. You'll have to include that library into your script. Just type #include "x0_i0_anims" before the void main function, and you should be able to use walkwaypoints(). This script may be different if you don't have an expansion or haven't upgraded to 1.61.
__________________
“As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
Civ V Civilization V Civ5 CivV Civilization 5 Civ 5 - Do your part!
|
|
|
|
January 4, 2004, 10:32
|
#23
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Doh!
I feel stupid now.
-Jam
|
|
|
|
January 4, 2004, 17:54
|
#24
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Thank you DaShi, I'll try that next time I work on the game!
I wonder why none of the sites I visited mentioned that particular quirk? Maybe it was fixed in a later patch?
-
by the way, I think I have version 1.10... without any patches, the basic basic basic version...
-
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
January 5, 2004, 11:29
|
#25
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
Get the patches or at least the first XP. They improve the editor's stabilty, add more creature models and area textures and basically make everything a little less stressful.
-Jam
|
|
|
|
January 5, 2004, 17:31
|
#26
|
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Jul 2000
Location: Deity of Lists
Posts: 11,873
|
Maybe I'll get the expansion *sigh*...
Do you think that If I get Gold Edition, I would still need to download the Shadows of Undrentide Patch?
__________________
-->Visit CGN!
-->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944
|
|
|
|
January 6, 2004, 10:04
|
#27
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
The gold edition is pre-patched to v.1.31
You'd still need to get v.1.61 (well, not NEED, but this patches it up with the fixes in HOTU, it works fine without though)
-Jam
|
|
|
|
January 6, 2004, 11:30
|
#28
|
Emperor
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Sep 2000
Location: The Taste of Japan
Posts: 9,611
|
Quote:
|
Originally posted by Jamski
Doh!
I feel stupid now.
-Jam
|
Don't worry. That's nothing compared to the mistakes that I often make. I'd probably work on my mod more, if I didn't have to keep rewriting scripts on the time.
__________________
“As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
Civ V Civilization V Civ5 CivV Civilization 5 Civ 5 - Do your part!
|
|
|
|
January 7, 2004, 18:38
|
#29
|
Deity
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
|
I've finally realised how scripts really work. I was doing a few dumb things. Now I'm ready for any challenge.
-Jam
|
|
|
|
January 8, 2004, 05:35
|
#30
|
Emperor
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Sep 2000
Location: The Taste of Japan
Posts: 9,611
|
Good, I need help.
I have a locked door. I want the player to be able to open it by switching four switches. When all 4 are set to the 'on' position, the door unlocks.
I've altered Ceolowin's version in his tutorial on the bioware forums by adding objects and integers for four switches and changing the end result to unlocking my door. For some reason, this doesn't work. Debuging indicates that all but the last switch switched is activated. But no matter how many times I switch it, it doesn't activate. It seems so simple, but it has been frustrating me for months.
__________________
“As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
Civ V Civilization V Civ5 CivV Civilization 5 Civ 5 - Do your part!
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
All times are GMT -4. The time now is 10:57.
|
|