Author Topic: placeable.2da question  (Read 7384 times)

Legacy_Randomdays

  • Sr. Member
  • ****
  • Posts: 336
  • Karma: +0/-0
placeable.2da question
« on: February 27, 2013, 08:19:13 pm »


               I'm having a problem with the placeable.2da and I guess I'm missing something.I'm using a CEP 2da with some changes made to add items from other work on the vault and everything has run fine till now. I created a new placeable building and to get it in game I copied an existing line of another building and pasted it on a blank line. I changed 2 entries on the new line to match the new building, the new name in quotes and the name of the mdl file. I placed a small hak with the mdl and textures under the new 2da and ran the editor.

In the editor, I could make a placeable and see and select the new model to it and place it in the world fine. The problem is several already placed item types had their assigned model  changed. A lot of the rocks were changed to bookcases for example. I could pick each object and change the model back to the proper one okay, but when I tried to change the blueprint, it would keep going back to the wrong model after closing and opening the selection again. I also started getting a lot of  access violations errors on nwtoolset.exe as well.

Going back to the 2da and replaceing the new line with a blank line again fixed the problems, but the new item went away of course.

So, what am I doing wrong?  Hopefully its something obvious that I'm not aware of.

Thanks for any help
               
               

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
placeable.2da question
« Reply #1 on: February 27, 2013, 08:52:39 pm »


               

Randomdays wrote...

I created a new placeable building and to get it in game I copied an existing line of another building and pasted it on a blank line. I changed 2 entries on the new line to match the new building, the new name in quotes and the name of the mdl file.

In the editor, I could make a placeable and see and select the new model to it and place it in the world fine. The problem is several already placed item types had their assigned model  changed. A lot of the rocks were changed to bookcases for example.
So, what am I doing wrong?  Hopefully its something obvious that I'm not aware of.

Thanks for any help


That sounds like you inserted a line between two others.
That would change every single placeable after the one you inserted.
You either have to add the new line after the last line of the 2da or replace another 2da line which you don't need or which is a reserved line or padding.
If you insert it between two others all the following lines will have higher numbers. It doesn't matter what the first number of the line says, it is only there to make the file more readable.
If you insert a line between lines 9 and 10, line 10 will actually become line 11.

To fix this you'll have to remove the line you added and either add it after the last line in the 2da or replace one of the lines from 202 to 229 which are lines reserved for user added content. If the CEP or other placeables you use already used up all of those lines you'll have to add your line to the end of the file.
               
               

               


                     Modifié par Zwerkules, 27 février 2013 - 08:58 .
                     
                  


            

Legacy_Randomdays

  • Sr. Member
  • ****
  • Posts: 336
  • Karma: +0/-0
placeable.2da question
« Reply #2 on: February 27, 2013, 09:04:24 pm »


               Not sure what you mean about the 1st number of the line not meaning anything. I understand inserting a line would change things, but does copy paste count as an insert or a replace if I leave the original line number in place? If its an insert, how do you replace a padding line?

I used an existing line with no data in it, 6001 which said "user" , When I copied the old line from 1623 which was "structure log cabin", I copied everything but the old line number and pasted it to the new line number and changed the 2 data values, so isn't that considered replacing the line?

Sorry if I'm dense, not sure how else you would do it.
               
               

               


                     Modifié par Randomdays, 27 février 2013 - 09:05 .
                     
                  


            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
placeable.2da question
« Reply #3 on: February 27, 2013, 09:21:11 pm »


               

Randomdays wrote...

I used an existing line with no data in it, 6001 which said "user" , When I copied the old line from 1623 which was "structure log cabin", I copied everything but the old line number and pasted it to the new line number and changed the 2 data values, so isn't that considered replacing the line?

Sorry if I'm dense, not sure how else you would do it.


If the old line 6001 was completely replaced by your copied line you did it right, but then it shouldn't have affected any of the other placeables. What you described sounded as if some of the lines have moved.
This can happen if you insert a new line between two others or if you remove a whole line without replacing it by a new line.
You should check which placeables are affected by the changes you made.
For example the evil throne is on line number 184. If the evil throne is okay, then the error is somewhere after line 184. If the evil throne is replaced by another placeable, the error is somewhere before line 184.
Check if the placeable after the line you copied is still okay. Then check if the placeable after line 6001 is okay.

If your text editor shows on which line your cursor is, try placing it on line 6001. There are three lines at the beginning of the 2da file and the numbering starts with 0 so entry 6001 should be on line 6005. If it isn't, there's something wrong with the lines before 6001. If it is higher than 6005 there's one line too much somewhere, if it is lower, one line is missing.
               
               

               
            

Legacy_Nissa_Red

  • Full Member
  • ***
  • Posts: 121
  • Karma: +0/-0
placeable.2da question
« Reply #4 on: February 27, 2013, 09:22:03 pm »


               What Zwerkules said is 100% correct.

Basically, NWN identifies placeables not by the number that is present on the row that declares them, but by the ACTUAL sequential number of the row.

Let me give you a short example :

placeables.2da

<header> (should never be altered)
0 Armoire
1 Bookshelf
2 Box1

will produce exactly the same result in the toolset/game than :

<header>
10 Armoire
29 Bookshelf
27 Box1

because NWN will always "semantically" read it as the former. If you insert a new row between existing placeables, like this :

<header>
0 Armoire
1 <new custom placeable>
2 Bookshelf
3 Box1

everything past your custom placeable will be shifted in place, which is why you don't recognize your areas anymore, and/or experience crashes.

So what can you do ? Either you find a padding line, to replace it with the definition of your custom placeable, or you add a new line at the very end of your placeables.2da file, so that existing placeables remain untouched (which is still the safest option) :

<header>
0 Armoire
1 Bookshelf
2 Box1
...
<whatever> <new custom placeable>
               
               

               


                     Modifié par Nissa_Red, 27 février 2013 - 09:28 .
                     
                  


            

Legacy_painofdungeoneternal

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +0/-0
placeable.2da question
« Reply #5 on: February 27, 2013, 09:37:40 pm »


               Or look at the line number in the status bar of your text editor, if it says the actually line number is 5, subtract 4, as the 2da should say 1 on the left. If it gets confusing, you can at least do this in your head using most text editors to easily correct the current line number without touching the rest of the file, or use the reverse of this to determine where a line should be pasted. ( and is a lot easier than fixing every line in the file too )

So row 6001 is what you need to paste in, go to line 6005 ( 4 more than what it's labeled as ) in the file and paste in your entry on this line.

If you are on line 6005, subtract 4, and the label should say 6001.

( For notepad think the show line number is an option in the menu if it's not there already )
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
placeable.2da question
« Reply #6 on: February 27, 2013, 11:47:24 pm »


               One very common error (guilty sooo many times ('^_^') )  is that when you paste in your new line, you accidentally insert the data instead of overwriting it. The quick way to check on this one is to put you cursor at the start of the line (make sure there is no line wrapping going on) and press the end key. If you cannot see data above the cursor, this is probably the cause. Whether or not this would cause your problem I'm not sure, but it's worth checking anyway.

TR
               
               

               
            

Legacy_Randomdays

  • Sr. Member
  • ****
  • Posts: 336
  • Karma: +0/-0
placeable.2da question
« Reply #7 on: February 28, 2013, 12:21:59 pm »


               I want to thank everyone for their help.

The reason the model kept reverting back to the wrong one in the blueprint turned out to be that the blueprint was part of the cep haks so it couldn't be changed without making a copy of it.

I'm just using notepad so I don't have the actual line number to look at, but I understand what you're saying that the actual line number is off a few lines from the one you see. I also get get (now) that I could add a line between 10 and 11 and call it anything, like 4000, but it would still just be the new 10. But since I was going to an existing padding line and pasting over everything BUT the number, I don't think that was it.

I'm not sure what the problem was but I was able to fix it. The cep 2da has a lot of what I'm pretty sure are padding lines - lines with nothing but the 4 astericks groups except where the model should be where it says "user", "cep reserved",etc. I was copying the data from the last entry of a line for an item (static column)  back to the last space before the line number, keeping only that. I pasted it to the padding line, changed the data for the item name and mdl name I was adding, saved the 2da and got the error. I had done this before with 2da's to add items from other haks by copy/pasting their data and it worked just fine. The new items appeared in the toolset without affecting any of the other items.

No matter what I tried with copy / paste, it wouldn't work. Somehow I must have been inserting a line,extra spaces of something, since as you guys said, everything after the line was changed.Maybe the way Tarot was saying.

I finally got it to work by clicking on the last asterick of each group of 4 on the padding line I was using, backspacing to erase each group and entering the data by typing it in for each column that needed it. The maps look normal and I checked the blueprint on the last used item on the 2da and it was correct.

Thanks again for all the help and interest.

Instead of starting a new thread, I've got a couple of quick questions ;

The meshes I'm working with have alternate sets of textures (IE normal and snow). I assume that I would need to set up two different mdls and there's no way to swap textures out on a single mdl with scripting?

Using a walkthru I set up a dummy object, added the pwk extension to it, gave it the placable proprty and assigned a plane to it to actually set the walkable area. Can you assign more that 1 plane to the dummy to have more control over blocking areas of the mdl?

Last, some of the mdls I'm converting have common, shared textures (IE two bushes using the same leaf texture) . Would there be a problem in game with this - do I need to rename the shared texture to different unique names so that each mesh has its own version of the texture?

Sorry if I seem a bit pesty. Hopefully it will lead to some new content that can add to the game.
               
               

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
placeable.2da question
« Reply #8 on: February 28, 2013, 03:47:15 pm »


               

Randomdays wrote...
The meshes I'm working with have alternate sets of textures (IE normal and snow). I assume that I would need to set up two different mdls and there's no way to swap textures out on a single mdl with scripting?

There is a way to use different textures on one model by using on and off animations. Let's say your model is a house with a red tile roof and you want to replace the roof texture by a texture with a little snow. You can't change the texture itself (unless you use NWNCX or whatever the name of that client extension was) so what you can do is
make the roof a separate mesh if it isn't already. Then  clone that mesh and apply the snow texture to the cloned mesh and change the alpha to 0.0. Then you'll need animations that change the alpha of the red roof to 0.0 and of the roof with snow to 1.0 and vice versa.
That way the red tile roof disappears when the placeable is turned on and the roof with snow appears and it is the other way round when the placeable is turned off. You'll probably also need a default animation which has the alpha of the red roof set to 1.0 and the other one to 0.0.

Last, some of the mdls I'm converting have common, shared textures (IE
two bushes using the same leaf texture) . Would there be a problem in
game with this - do I need to rename the shared texture to different
unique names so that each mesh has its own version of the texture?

That is not neccessary. Many placeables can share the same texture. If you retexture one of them, the others will change, too. If you don't want that to happen, you'll need unique textures for each one.
               
               

               


                     Modifié par Zwerkules, 28 février 2013 - 03:50 .
                     
                  


            

Legacy_Nissa_Red

  • Full Member
  • ***
  • Posts: 121
  • Karma: +0/-0
placeable.2da question
« Reply #9 on: February 28, 2013, 03:54:44 pm »


               

The meshes I'm working with have alternate sets of textures (IE normal and snow). I assume that I would need to set up two different mdls and there's no way to swap textures out on a single mdl with scripting?


There would be a way, but it's quite sophisticated, and I don't think it's worth the trouble (compared to adding two distinct placeables instead). It could be achieved through the "on" and "off" animations of your placeable.

For academical purposes, you would create your placeable to include the two textured versions at the same time. With the "off" animation, you would show the non-snowy geometry and the snowy geometry would disappear far under ground. Vice-versa with the "on" animation. Unlike doors, PWKs cannot be animated (to my knowledge), so the non-snowy and snowy versions would need to have the same ground geometry of course.

It's far easier, and just as efficient in most situations, to just script this behavior with two distinct placeables.

Using a walkthru I set up a dummy object, added the pwk extension to it, gave it the placable proprty and assigned a plane to it to actually set the walkable area. Can you assign more that 1 plane to the dummy to have more control over blocking areas of the mdl?


Placeables can only have one PWK, and it has to be a flat plane too (again, to my knowledge).

Last, some of the mdls I'm converting have common, shared textures (IE two bushes using the same leaf texture) . Would there be a problem in game with this - do I need to rename the shared texture to different unique names so that each mesh has its own version of the texture?


No, you're actually quite encouraged to reuse the same textures whenever they exist. Unless really justified, it's quite bad practice to rename textures, creating duplicate versions.

Also, please don't forget to set "use" nodes, and (ideally) destroy animations, if your placeables justify it. I had to discard so many nice looking placeables (containers mostly, but also siege weapons and various other furniture) because once set to "useable", they couldn't really be used in game.

Good luck to you.

EDIT : Zwerkules just beat me to it again ':lol:'. Please forgive my lazyness in not editing my post ^.^
               
               

               


                     Modifié par Nissa_Red, 28 février 2013 - 03:56 .
                     
                  


            

Legacy_Randomdays

  • Sr. Member
  • ****
  • Posts: 336
  • Karma: +0/-0
placeable.2da question
« Reply #10 on: February 28, 2013, 08:54:03 pm »


               Thanks guys.

Nissa, not sure about setting up use nodes and destroy animations. Are those set up in gmax or in game? None of the walkthrus I've read over so far has mentioned them. I understand what you're saying about being able to use an object in game or seeing pieces fly off when its destroyed for example. Can you load up n existing mdl that has an animation and "steal" it for yours with a copy/ paste action?
               
               

               
            

Legacy_Nissa_Red

  • Full Member
  • ***
  • Posts: 121
  • Karma: +0/-0
placeable.2da question
« Reply #11 on: February 28, 2013, 09:53:58 pm »


               "Use" nodes are set up very quickly and easily, yet they are pretty often forgotten by custom content creators, which is a really a shame, since it leads characters to helplessly bump into placeables with a large or complex PWK each time they're marked as useable. This happens because the game doesn't find any "use" node, and therefore replaces it with the center position of the object, which if it's not reachable can make the placeable useless as anything but static decoration.

If your placeable is a pseudo-tile, like a house, it probably won't matter that much, but it's still so simple to do that I tend to recommend it as standard practice. You never know how builders (or yourself) will use your placeables in the future ^.^

Anyway, to prevent this from happening, the process is fairly straightforward. Create a simple dummy node with NWmax, parent it to the PWK, and suffix it with "_use01" , like this :

 node dummy H07_pwk_use01
   parent PLC_H07_pwk
 endnode


Place and orient it wherever you like the player to stand and face when using your placeable. That's it, you're all done. In theory, there exists a second use node ("_use02"), but I am not sure what it's used for by the engine, sorry. I always finish creating it anyway.

Finally, the best practice to learn I found is to look at how Bioware made their placeables, by exporting a chair or a barrel ("plc_h07") for example (EDIT : You can do that with NWNexplorer by the way). You should be able to copy the emitters and nodes directly over to your placeable model file. This will make it so that your placeable doesn't simply vanish into thin air upon destruction. The process is almost the same if your placeable has any light emitters (flames, candlefires, etc.).

In my opinion, these are but slight alterations to your models, but really help to give your placeables a more "professional/Bioware-like" finishing touch to them.
               
               

               


                     Modifié par Nissa_Red, 28 février 2013 - 10:07 .
                     
                  


            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
placeable.2da question
« Reply #12 on: March 01, 2013, 12:53:31 pm »


               

Nissa_Red wrote...

In theory, there exists a second use node ("_use02"), but I am not sure what it's used for by the engine, sorry. I always finish creating it anyway.


Since the use node is the place where the PC/NPC should stand when using the placeable, there is a second use node for placeables that can be used from two sides like benches without a backrest. If you have a bench with a backrest, one use node is enough because the placeable has a front, but if there's no backrest, the PC could aproach the bench from one side or the other when trying to use it.

Maybe a bench is not such a good example because a PC could also sit on it and there's probably only one direction the PC would face when sitting on the bench even if there are two use nodes.
               
               

               
            

Legacy_Nissa_Red

  • Full Member
  • ***
  • Posts: 121
  • Karma: +0/-0
placeable.2da question
« Reply #13 on: March 01, 2013, 02:20:30 pm »


               I understand, thank you very much, Zwerkules ^.^

I am glad I finally got to learn what it was good for after all this time. Better late than never as they say, yes ?
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
placeable.2da question
« Reply #14 on: March 01, 2013, 02:43:02 pm »


               <blocking out...>

Re PWK: this is a non-rendering geometry that *can* do two things.
Where it intersects the tile WOK, it tells the engine "can't walk here". But it also - if tall enough - blocks vision & targeting.

As an example, both the Homonculus Bottle (just remembered I  changed this one) I made for the Jan CCC and the trees I'm working on for the Feb CCC (Lord Sullivan's & a surprise entry) have cylinders rising up from the ground. This means creatures behind the placeable would not 'see' or be seen or be targetable.

Another note on 3d PWKs - one that used to get Bannor Bloodfist all hot - is that the WOK is not always a flat plane. What if your placeable center is on a tiny bump, just an inch above the surrounding terrain? That puts your flat plane PWK hovering uselessly in the air (a bug I've just discovered in my Treasure Chests :-/ ) because it doesn't intersect the WOK.

Best practice is to extrude the PWK both above and below the assumed WOK.

As long as I'm mentioning thing I *should* be doing... Make your PWK as blocky as possible! Every corner is a pathfinding decision! Make a column with 4 sides, simple for engine to go around. Make a cool, smooth shape with a zillion sides and watch the NPCs slow to a crawl. OTR made a great video showing this behavior. Normally I try for a 6-sided PWK. And 3-sided shadow casters...

Ok, stopping now. :-/

<...bits he wants to save>
               
               

               


                     Modifié par Rolo Kipp, 01 mars 2013 - 02:48 .