Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > Other Games-Archive > NWN Scripting Question
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
Post  Old Post 21-12-2003 09:03 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
NWN Scripting Question Support Apolyton, pre-order Civilization IV

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!

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 22-12-2003 02:44
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

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

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 22-12-2003 03:10 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

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

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 22-12-2003 03:14
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Put an end to popups!

Ah, you do have the lastest patches, yes? They really increase stability.
Helpful links :
http://faqs.neoseeker.com/Games/PC/..._dm_builder.txt
http://nwn.bioware.com/forums/viewforum.html?forum=46

Both of these pages are life-savers

-Jam

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 22-12-2003 03:35
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton buy from Amazon

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

Dis is offline Dis
Emperor
Las Vegas, Nevada
Feb 2000
time: 21:32
  Old Post 22-12-2003 04:59 Visit Dis's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton buy from Amazon

what graphics card do you have?

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 22-12-2003 09:26 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton buy from Amazon

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

Last edited by DarkCloud on 22-12-2003 at 09:37

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 23-12-2003 07:24 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Civilization 2

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!

MattH is offline MattH
King
Go sneer at that cow creamer!
Jul 2002
time: 05:32
  Old Post 23-12-2003 10:14
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton

Just FYI, I think he'll be away through christmas.

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 23-12-2003 20:52 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Full PM-box? Change here!

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

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 27-12-2003 23:05 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Full PM-box? Change here!

Bumping for help from Jamski...

*please*

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 28-12-2003 18:33
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Avatar Enlargement: We've got the solution

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

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 29-12-2003 18:49
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Inflate your Upload Space

And... any luck?

-Jam

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 30-12-2003 22:24 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Browse Apolyton AD-FREE

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)

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 31-12-2003 01:57
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Increase the size of your Attachments

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

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 31-12-2003 02:02
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Suffering from ads?

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

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 31-12-2003 02:13
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Remove this text

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

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 31-12-2003 02:16
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Help yourself to an AD-FREE life

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

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 01-01-2004 08:01 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Support Apolyton buy from Amazon

Thank you, I'll try those sometime soon!

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 03-01-2004 05:32 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

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

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 03-01-2004 17:55
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Increase Your PM Length

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

DaShi is offline DaShi
Prince
The Taste of Japan
Sep 2000
time: 05:32
  Old Post 04-01-2004 16:08
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Avatar Enlargement: We've got the solution

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.

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 04-01-2004 19:32
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Support Apolyton buy from Amazon

Doh!
I feel stupid now.

-Jam

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 05-01-2004 02:54 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Increase the size of your Attachments

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...
-

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 05-01-2004 20:29
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Suffering from ads?

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

DarkCloud is offline DarkCloud
Civ3 Stories Editor
of Lists
Jul 2000
time: 05:32
  Old Post 06-01-2004 02:31 Visit DarkCloud<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Full PM-box? Change here!

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?

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 06-01-2004 19:04
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

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

DaShi is offline DaShi
Prince
The Taste of Japan
Sep 2000
time: 05:32
  Old Post 06-01-2004 20:30
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Remove this text

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.

Jamski is offline Jamski
Deity
lol ED&D is officially full PvP LOL
May 2002
time: 05:32
  Old Post 08-01-2004 03:38
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Put an end to popups!

I've finally realised how scripts really work. I was doing a few dumb things. Now I'm ready for any challenge.

-Jam

DaShi is offline DaShi
Prince
The Taste of Japan
Sep 2000
time: 05:32
  Old Post 08-01-2004 14:35
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Tired of ads?

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.

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:32.
Apolyton Time is 00:32.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum 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
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0673 seconds (93.27% PHP - 6.73% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net