News   About   FAQ   Statistics   Player Options   Downloads   Gallery   Forums   Donate   Wiki   Staff   Jobs   Links   Contact Us

Go Back   Sundren Forums > Neverwinter Nights 2 > Neverwinter Nights 2 General Discussion > Neverwinter Nights 2 Scripting
Register Members List Calendar Search Today's Posts Mark Forums Read

Neverwinter Nights 2 Scripting Neverwinter Nights 2 scripting discussions.


Welcome to the Sundren Forums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2007
gulpy gulpy is offline
Commoner
 
Join Date: Feb 2007
Posts: 9
Rep Power: 0
gulpy will become famous soon enough
Door Scripting

For an area I'm making, I need to assign each door in the area to a "number" (I have over 35 doors). Now I need to script it so when say door one opens, every second door closes. I'm making sort of a maze type of thing. Any help would be appreciated.
Reply With Quote
  #2  
Old 03-05-2007
Saulus's Avatar
Saulus Saulus is offline
Developer
 
Join Date: Sep 2006
Location: Waterloo, Ontario
Posts: 7,225
Rep Power: 50
Saulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond repute
Easiest way would be to make an onopen script that would first get the door tag and use findsubstring to seperate the last half of the tag, increment it, and use that to get the next door in sequence. After that it's just a matter of executing the doorclose function.
__________________
The very existence of flame-throwers proves that some time, somewhere, someone said to themselves, You know, I want to set those people over there on fire, but I'm just not close enough to get the job done.

George Carlin
Reply With Quote
  #3  
Old 03-05-2007
gulpy gulpy is offline
Commoner
 
Join Date: Feb 2007
Posts: 9
Rep Power: 0
gulpy will become famous soon enough
*eye twitches* Okay, uhmm.... there is also a way to open every door in the current area when a certain lever is activated correct?
Reply With Quote
  #4  
Old 03-05-2007
Saulus's Avatar
Saulus Saulus is offline
Developer
 
Join Date: Sep 2006
Location: Waterloo, Ontario
Posts: 7,225
Rep Power: 50
Saulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond repute
Offhand without double checking you could just loop through the doors if there is a function for that. Otherwise you could just increment through the tags using GetObject and assigning a door open action.
__________________
The very existence of flame-throwers proves that some time, somewhere, someone said to themselves, You know, I want to set those people over there on fire, but I'm just not close enough to get the job done.

George Carlin
Reply With Quote
  #5  
Old 09-03-2007
Ouroboros's Avatar
Ouroboros Ouroboros is offline
Adventurer
 
Join Date: May 2007
Location: Melbourne, Australia
Posts: 80
Rep Power: 129
Ouroboros will become famous soon enough
Pseudo code for possible solution

I can think of a few Coding methods this could be done, this one seems more appropriate:

Pseudocode (more VB script style)


ASSUMPTIONS:
- It is possible to retrieve a container object that refers to all objects.
- The scripting / programming functionality has an ewffective String search function that can return a value if one string is found within another.

openDoors(connectDoors as string)
{
Variable Object
Variable doorArray = ObjectContainer
For Each Object in DoorObjects
if Object.type = "Door Type" then
if Object.Name is in the string connectDoors then
call doAction_openDoor(Object)
end if
end if
Next Object
}

calling connectDoors("Door1Door2Door4") will have the "doAction_openDoor" method called for and Object thats name appears in the provided string. This way, the function is very portable (in C++, it will work well with VOID object types) because you can simply build the string with what you want done. I'm not sure the entire power of the NWN2 toolset, but I'm pretty sure it has a strong C++ element in it.
__________________
Calini Anna'Des - Resentful of the Law's values and troubled with her Past.

"The life of the creative person is lead, directed and controlled by boredom. Avoiding boredom is one of our most important purposes." - Saul Steinberg

"Opportunity is missed by most people because it comes dressed in overalls and looks like work" - Thomas Edison
Reply With Quote
  #6  
Old 09-04-2007
Saulus's Avatar
Saulus Saulus is offline
Developer
 
Join Date: Sep 2006
Location: Waterloo, Ontario
Posts: 7,225
Rep Power: 50
Saulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond reputeSaulus has a reputation beyond repute
You do realize that nwscript doesn't support arrays and nothing about that code is valid?
__________________
The very existence of flame-throwers proves that some time, somewhere, someone said to themselves, You know, I want to set those people over there on fire, but I'm just not close enough to get the job done.

George Carlin
Reply With Quote
  #7  
Old 09-04-2007
GodBeastX's Avatar
GodBeastX GodBeastX is offline
Developer
 
Join Date: Oct 2006
Posts: 4,794
Rep Power: 50
GodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant futureGodBeastX has a brilliant future
And you do realize this was posted in March and the original poster isn't even active anymore?
__________________
Reply With Quote
  #8  
Old 09-04-2007
Ouroboros's Avatar
Ouroboros Ouroboros is offline
Adventurer
 
Join Date: May 2007
Location: Melbourne, Australia
Posts: 80
Rep Power: 129
Ouroboros will become famous soon enough
*Ouroboros ducks his head in shame and retreats to his little hole. Looks over his old programming books and mutters to himself about how awesome arrays are*
__________________
Calini Anna'Des - Resentful of the Law's values and troubled with her Past.

"The life of the creative person is lead, directed and controlled by boredom. Avoiding boredom is one of our most important purposes." - Saul Steinberg

"Opportunity is missed by most people because it comes dressed in overalls and looks like work" - Thomas Edison
Reply With Quote
  #9  
Old 06-07-2008
Dustiness's Avatar
Dustiness Dustiness is offline
Adventurer
 
Join Date: Apr 2007
Location: England
Posts: 73
Rep Power: 131
Dustiness will become famous soon enough
Well, going off the assumption that you want to make a puzzle that's a little like Lights Out (although it's hard to say from your description :P), what I'd do is make a pattern for the doors. Let's say you have a 9 by 9 grid of doors, the top left door will be 11, the bottom left, 91, the top right, 19, the bottom right, 99 and the middle, 55.

In other words:
11 21 31 41 51 61 71 81 91
12 22 32 42 52 62 72 82 92
13 23 33 43 53 63 73 83 93
14 24 34 44 54 64 74 84 94
15 25 35 45 55 65 75 85 95
16 26 36 46 56 66 76 86 96
17 27 37 47 57 67 77 87 97
18 28 38 48 58 68 78 88 98
19 29 39 49 59 69 79 89 99

That's enough for 81 doors, so you won't need that many. You'll probably use 35 that look like this:

11 21 31 41 51
12 22 32 42 52
13 23 33 43 53
14 24 34 44 54
15 25 35 45 55
16 26 36 46 56
17 27 37 47 57

So set your door tags up as shown above, just like coordinates. You can then get these tags and use string manipulation to get the last two digits and assign them to x and y integers. From there you can use simple maths (+1, -1, to each integer) and each time get a new door according to the grid (using more string manipulation to recreate a door tag). If the x integer is over 5 or under 1, ignore it, if the y is over 7 or under 1, ignore it.

Each time you'll need to get the status of the door and open / close as required, but that's easy to do. If you know anything about coding you should be able to work this idea out, but I admit it is complex, which is why I'm just giving the theory :P
__________________
"Gentlemen, you can't fight in here! This is the War Room!"

Last edited by Dustiness; 06-07-2008 at 09:39 AM. Reason: "And you do realize this was posted in March and the original poster isn't even active anymore?" DAMNIT!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Sundren - Archive - Top  
All times are GMT -4. The time now is 09:14 AM.
Sundren.org Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
All content of this website is property of its respective owners: Webmaster