Miltiades Posted November 3, 2006 Author Share Posted November 3, 2006 Got a little problem with that. There are four cages which all bare the same name, tag, resref, everything. So I made (read: copied ) the script and attached it to my dialog. Result: Only one cage was turned off. On top of that, the sound didn't work, but that's normal because I haven't included the sound file in the .mod. But I don't know what sound file I have to include, because it should be the same as in the script, though I don't see any reference to a sound file in the script. Link to comment Share on other sites More sharing options...
stoffe Posted November 3, 2006 Share Posted November 3, 2006 Got a little problem with that. There are four cages which all bare the same name, tag, resref, everything. So I made (read: copied ) the script and attached it to my dialog. Result: Only one cage was turned off. So give the four placeable cages unique tags? That's the easiest solution IMHO, since you will need some way to uniquely identify each one if you are going to operate them independently. Sure, you could iterate through all objects with the same tag in the area, but then you'd need to keep track of in which order they are listed. Just giving each an unique tag is much easier. On top of that, the sound didn't work, but that's normal because I haven't included the sound file in the .mod. But I don't know what sound file I have to include, because it should be the same as in the script, though I don't see any reference to a sound file in the script. The script is working with a sound object, not a WAV or MP3 file directly. Sound objects are essentially sound emitters, placed in a specified location within an area and are created from .UTS template files. The .UTS files then keep track of things such as looping, sound volume, pitch, sound radius and which WAV/MP3 file(s) should be played. If you aren't familiar with how to create one I'd suggest opening one of the modules with existing force cages and grabbing the relevant .UTS file from there to use in your own module. The script grabs the sound object closest to the specified force cage and makes it start/stop playing its sound. Thus it doesn't matter what the sound object is called, so long as it's placed in the same spot as the force cage it belongs to (which it should be anyway since the sound will seem to come from that location). Link to comment Share on other sites More sharing options...
Darkkender Posted November 3, 2006 Share Posted November 3, 2006 I know this is detouring the thread in a miniscule fashion but has anybody thought about trying the new NWN Toolset that ships with NWN2 for the SWK area models? The reason I ask is because from all of the screenshots I've seen of NWN2 it looks like it is using 3d graphics that are about on par with the SWK games. I haven't had a chance to try it myself yet as I'm lacking Win XP untill I break down and buy it in a week. Link to comment Share on other sites More sharing options...
Miltiades Posted November 4, 2006 Author Share Posted November 4, 2006 So give the four placeable cages unique tags? That's the easiest solution IMHO, since you will need some way to uniquely identify each one if you are going to operate them independently. Sure, you could iterate through all objects with the same tag in the area, but then you'd need to keep track of in which order they are listed. Just giving each an unique tag is much easier. The problem with that is that I would need four different scripts, and if I want the cages to be turned off simultaneously, how can I have the four scripts to be activated in that one dialog node, which has only space for 2 scripts? The script grabs the sound object closest to the specified force cage and makes it start/stop playing its sound. Thus it doesn't matter what the sound object is called, so long as it's placed in the same spot as the force cage it belongs to (which it should be anyway since the sound will seem to come from that location). Okay, thanks. Link to comment Share on other sites More sharing options...
stoffe Posted November 4, 2006 Share Posted November 4, 2006 The problem with that is that I would need four different scripts, and if I want the cages to be turned off simultaneously, how can I have the four scripts to be activated in that one dialog node, which has only space for 2 scripts? Ah, why didn't you say so earlier? I thought you wanted a control panel type of dialog where you could turn on/off cages individually. Here is another variant of the same script that will go through all force cages with the specified Tag in the area and turn them on/off. void main() { string sTag = GetScriptStringParameter(); object oCage = GetObjectByTag(sTag); int iIdx = 0; while (GetIsObjectValid(oCage)) { object oSound = GetNearestObject(OBJECT_TYPE_SOUND, oCage); object oFF = GetNearestObjectByTag("ForceCageBlocker", oCage); if (GetScriptParameter(1) == FALSE) { SoundObjectStop(oSound); AssignCommand(oCage, PlayAnimation(ANIMATION_PLACEABLE_OPEN)); if (GetIsObjectValid(oFF) && (GetDistanceBetween(oCage, oFF) <= 1.0)) DestroyObject(oFF); } else { SoundObjectPlay(oSound); AssignCommand(oCage, PlayAnimation(ANIMATION_PLACEABLE_CLOSE)); if (!GetIsObjectValid(oFF) || (GetDistanceBetween(oCage, oFF) > 1.0)) CreateObject(OBJECT_TYPE_PLACEABLE, "plc_forcecageblk", GetLocation(oCage)); } oCage = GetObjectByTag(sTag, ++iIdx); } } Same dialog parameters as before, i.e. P1 determines if the cages should be turned on(1) or off(0), and String Param should be set to the Tag of the cage(s). Link to comment Share on other sites More sharing options...
Miltiades Posted November 4, 2006 Author Share Posted November 4, 2006 Oh, goody! Thanks. How you people can understand these scripts is beyond me. Anyway, compiling with Kotor Tool doesn't seem to work. It says the nwnnsscomp.exe isn't in the same folder as KT. I tried it when I saw it was possible with KT. @darkkender: Is that possible? NWN2 is using a new engine, isn't it? Or doesn't that change a thing? Link to comment Share on other sites More sharing options...
Darkkender Posted November 4, 2006 Share Posted November 4, 2006 @darkkender: Is that possible? NWN2 is using a new engine, isn't it? Or doesn't that change a thing? I don't know since I can't even fake it on my computer by changing registry entries I can't get it to install. I was looking at the graphics and how similiar they seemed to the SWK games that I was thinking maybe the Model format is closer to SWK. Since modding has never been officially supported that means there are elements like the model format that might be compatible between the 2 games that they just won't or can't mention for legal reasons. Maybe I'm just being hopeful that some of our dedicated modders would try to break it open to see if anything can be useful to us. Especially since the SWK 1 engine was a 3d upgraded version of NWN and the SWK 2 game developed by OE was an upgraded version of SWK 1 when it comes to the models and some of the other graphics. I figure maybe they used a new name on it for NWN2 as a way of protecting there legal rears from Lucasarts. Link to comment Share on other sites More sharing options...
Miltiades Posted November 4, 2006 Author Share Posted November 4, 2006 I'll get my copy of NWN2 soon, but I'm no expert at these kind of things. I'll keep my eyes open though. Anyway, I've got another question. I want to start from another location in the module than normal. With a map that is supported by KT, it isn't that difficult. But I can't seem to make it work. Link to comment Share on other sites More sharing options...
stoffe Posted November 4, 2006 Share Posted November 4, 2006 Anyway, I've got another question. I want to start from another location in the module than normal. With a map that is supported by KT, it isn't that difficult. But I can't seem to make it work. You can set the default starting location within a module in the module.ifo file by setting coordinates in the Mod_Entry_X, Mod_Entry_Y and Mod_Entry_Z fields. You can set which way the player faces when they enter the area by putting a direction vector in the Mod_Entry_Dir_X, Mod_Entry_Dir_Y and Mod_Entry_Dir_Z fields as well. Link to comment Share on other sites More sharing options...
Miltiades Posted November 4, 2006 Author Share Posted November 4, 2006 Didn't work. It still starts from the original starting location. Maybe I have to add/delete a waypoint or something? Edit: Wait. It did work, after I deleted all waypoints. Thanks Link to comment Share on other sites More sharing options...
Miltiades Posted November 4, 2006 Author Share Posted November 4, 2006 Okay, little problem. All NPCs I've placed in my module all look in exactly the same direction, although almost every orientation number is different. I tried both in the X-Orientation and Y-Orientation field. Can't seem to find what I've done wrong. Link to comment Share on other sites More sharing options...
Darth InSidious Posted November 4, 2006 Share Posted November 4, 2006 The Orientation number has to be made into two numbers - the X-Orientation and the Y-Orientation. Unfortunately, I have no idea which is which, myself... Link to comment Share on other sites More sharing options...
stoffe Posted November 4, 2006 Share Posted November 4, 2006 Okay, little problem. All NPCs I've placed in my module all look in exactly the same direction, although almost every orientation number is different. I tried both in the X-Orientation and Y-Orientation field. Can't seem to find what I've done wrong. What values have you been using in the X and Y orientation? As far as I know you do not specify the angle here directly, but rather a directional vector of a kind, from which the angle is derived. The range of values in those two fields go from -1.0 to 1.0. Imagine a coordinate system, where the character sits in the center. To specify which way they face, you specify a point on this coordinate system (where the character should face), where the Y value is the north facing and X value is the east facing. So for each basic 90 degree direction you get something like: X Y Facing --- --- ------------- 0.0 1.0 = North 1.0 0.0 = East -1.0 0.0 = West 0.0 -1.0 = South And with this in mind you get 45 degree directions something like: X Y Facing --- --- ------------- 1.0 1.0 = NorthEast 1.0 -1.0 = SouthEast -1.0 1.0 = NorthWest -1.0 -1.0 = SouthWest From this you get your exact facing by specifying a relation between N/S and E/W in the X and Y fields. See the attached image for an example, if you want the character to face slightly to the northnorthwest (the blue line marks the facing direction), you could set the values (x,y) to -0.5, 1.0 (the red dot represents the character): (I don't know the proper math terms in English, but hopefully you can understand what I mean ) Link to comment Share on other sites More sharing options...
Miltiades Posted November 4, 2006 Author Share Posted November 4, 2006 Oh, I used the orientation number that appeared when using the 'Where Am I' armband. This is much easier, IMO. Thanks. (I immediately thought of Trigonometric, and I've got some bad memories of it ) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.