Morrowind, Better Sitting StoolChair

Post » Sun May 06, 2012 10:13 pm

Hey guys

I have a slight question here. I am wanting to make a morrowind sitting stool. I know that there is the sit-down-in-morrowind script, but as that requires a cellname and x,y,and Z co-ordinates, I wanted something easer. I want a chair that i can place in the world with out having to write co-ordinates. I asked Princess Stomper about it, and she told me it was best to use the furniture scripts, with an extra option to sit down in them. This way, the player could position his\her chair anywhere he\she wanted it, and be able to sit down in it! It sounds like a grand idea, however, how would the sit down part work. The Princess said that the player could be elevated over the chair, and placed into it. Does anybody have any ideas?
User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm

Post » Sun May 06, 2012 9:03 pm

The basic script would use an offset (and maybe some simplified trig). You have to know where the player should sit relative to the chair's position, depending on the chair's angle. Once you have that figured out, you can write a script to set the player to ( chairpos + 1 ), which will always work. I have a script to do that set up for my TC, but I don't have the code here.

The basic idea:
short sitMode; holds the stateshort initMe; sets up positionsfloat pXfloat pYfloat pZ; hold the player and chair positionsif ( onActivate )	if ( sitMode == 0 )		set sitMode To 1	else		set sitMode to 0	endifendifif ( initMe == 0 )	set pX to ( GetPos X + 10 )	set pY to ( GetPos Y )	set pZ to ( GetPos Z )	set initMe To 1endifif ( sitMode == 1 )	"player"->SetPos X pX	"player"->SetPos Y pY	"player"->SetPos Z pZendif
User avatar
Jordan Fletcher
 
Posts: 3355
Joined: Tue Oct 16, 2007 5:27 am

Post » Mon May 07, 2012 12:10 am

Such scripts (approach an object (static/activator/PC/NPC/creature) from a particular side/angle) have very broad application: e.g. hugging/kissing, laying on a bed/rag, etc.
It would be nice to have a clever generic documented solution that can be added to the MW Scripting Library (there is one but I am not able to incorporate it in my scripts).

:)
User avatar
Guinevere Wood
 
Posts: 3368
Joined: Mon Dec 04, 2006 3:06 pm

Post » Sun May 06, 2012 10:15 pm

Ok, so, I applied this script to a morrowind chair. and, when i activated it , i was placed right over the chair! :goodjob: and i could not move my player! I activated it again, and i was permitted to move once more! This Is just what i needed! The only problem being, i was about 2 feet over the chair. I tinkered with the script a little and accomplished nothing. :banghead: I am very sorry to bug you, but is there a way to adjust the Z pos to make my character's groin on the seat with the rest of the body over it, so in this way i could apply the sitting pants and not look like Vivec floating over a chair? But thanks for the script anyhow!
User avatar
Dean
 
Posts: 3438
Joined: Fri Jul 27, 2007 4:58 pm

Post » Mon May 07, 2012 2:45 am

Such scripts (approach an object (static/activator/PC/NPC/creature) from a particular side/angle) have very broad application: e.g. hugging/kissing, laying on a bed/rag, etc.
It would be nice to have a clever generic documented solution that can be added to the MW Scripting Library (there is one but I am not able to incorporate it in my scripts).

:)

There is a script somewhere, possibly in Scripting for Dummies, that has a simplified trig system. It's possible that could be used for an application like this.
The basis of the script I posted should do the trick, in most cases. It's pretty easy to modify, too (you could even change the pX and such to globals and use it for a riding script).


Ok, so, I applied this script to a morrowind chair. and, when i activated it , i was placed right over the chair! :goodjob: and i could not move my player! I activated it again, and i was permitted to move once more! This Is just what i needed! The only problem being, i was about 2 feet over the chair. I tinkered with the script a little and accomplished nothing. :banghead: I am very sorry to bug you, but is there a way to adjust the Z pos to make my character's groin on the seat with the rest of the body over it, so in this way i could apply the sitting pants and not look like Vivec floating over a chair? But thanks for the script anyhow!
PMed this to you a little bit ago (posting it so it's public knowledge), but just change the offsets on the p* variables:
if ( initMe == 0 )	set pX to ( GetPos X + 10 )	set pY to ( GetPos Y )	set pZ to ( GetPos Z - 20 )	set initMe To 1endif
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Sun May 06, 2012 7:14 pm

Ok, a little problem here. The script wont work on a chair with a collision because it would not allow the pc to be lowered into the chair.. So, i went into Gmax and disabled the collision and made a new nif without a collision. But when i tried that, it didn't work because the chair kept trying to keep me with it, and at the same time, the gravity would be trying to put my feet above the ground, resulting in a jerky movement between the ground and where i was supposed to be. :banghead: is there any way around this?
User avatar
ashleigh bryden
 
Posts: 3446
Joined: Thu Jun 29, 2006 5:43 am

Post » Mon May 07, 2012 9:54 am

Are you sure your new mesh doesn't have collision? Open it up in NifSkope and make sure.

I'm not sure if it's possible, though... You'd need to disable collision, but the only command to do that is TCL and that will allow NPCs to walk through walls and such (not good, obviously).
I'm really not sure. Search Scripting for Dummies for the word "collision," see if that comes up with anything.
User avatar
Alexander Lee
 
Posts: 3481
Joined: Sun Nov 04, 2007 9:30 pm

Post » Sun May 06, 2012 11:43 pm

The easiest way to disable mesh collision complete (on a nif level; TCL will disables it in the game for all objects) is to add Extra Data NiStringExtraData ? NCO to the chair root node in NifScope, see for instance original statics flora e.g. Flora_wickwheat_01.nif file.

:)
User avatar
Robyn Howlett
 
Posts: 3332
Joined: Wed Aug 23, 2006 9:01 pm

Post » Mon May 07, 2012 5:52 am

The easiest way to disable mesh collision complete (on a nif level; TCL will disables it in the game for all objects) is to add Extra Data NiStringExtraData ? NCO to the chair root node in NifScope, see for instance original statics flora e.g. Flora_wickwheat_01.nif file.

:)
I thought changing the flags on the NiTriShape (I think that's the correct node) would fix it? The options include box, tris, and none, if I remember correctly.
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Sun May 06, 2012 9:58 pm

In case a nif has no RootCollisionNode branch (it contains NiTriShape nodes with collision geometry; not overlapping NiTriShape(s) in the nif will be considered as an empty space in the game) MW game engine creates collision structures automatically (btw not always correctly). NiTriShape nodes of a RootCollisionNode branch can be created in 3D application e.g. a chair without a sit.
NCO is not a flag but an extra data (NiStringExtraData) that instructs the game engine ? no collision for this object(nif).

I was talking about more complex/realistic script that takes angles(facing of both objects: NPC and chair) in consideration: with a wrong angle NPC can sit on it facing back planks.

:)
User avatar
Quick draw II
 
Posts: 3301
Joined: Thu Nov 08, 2007 4:11 pm

Post » Mon May 07, 2012 2:45 am

Uh, a lot of this is getting over my head, but yes, the collision on the chair was disabled. when i took it into gmax, it had these big blue boxes around the chair. I deleted those and exported it as a nif again, put it in game via tescs and in game, i could walk through it and so could the npcs. So yes, the collision was removed from the chair. :) So, is there any way around my gravity problem?
User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm

Post » Mon May 07, 2012 1:51 am

So, How would i fix this bouncing thing?
User avatar
Lewis Morel
 
Posts: 3431
Joined: Thu Aug 16, 2007 7:40 pm

Post » Mon May 07, 2012 8:11 am

What is this "bouncing thing" exactly?

I have worked a lot with similar game situations: collision of animated NPC with game objects and other NPCs. My experience is rather frustrating: pure math (scripted positioning) is not working in my hands. Animation tricks used by others (repositioning of "Bounding Boxes" in animation files) are not working as well. Interestingly, these mods are working as expected with my MW installation, but I was not able to reproduce authors' recommendations (when the solutions were disclosed by; few refused to share their knowledge and I have no time to dig in their eps and nifs/kfs, others retired). What works for me is the repositioning with animation keys of a model (Bip01 root) 300-600-900 units above the normal Z value for the entire animation and scripting this difference in positioning scripts (optimal script values are obtained in game via trial and error).

Drift aside of a sitting NPC can occur mainly for two reasons: some (can be tiny, another NPC IS able to go through an object (e.g. chair)) overlap of collision structures during animation; not clean animation data ? animation keys of the first time frame are not identical to the ones in the last time frame (this often occurs with Max CS biped).

Anyhow, without your files (nifs, kfs, esps, etc.) it is difficult to give a reasonable advice. Keep in mind that finding a working solution might take several days and many of us are busy with our own projects.

:)
User avatar
m Gardner
 
Posts: 3510
Joined: Sun Jun 03, 2007 8:08 pm

Post » Mon May 07, 2012 4:15 am

Ok, well, i just realized I could use levitate to defy the gravity bug, so, now im good! I cant believe i didnot think of that before, but thanks for your time and help guys!
User avatar
Mimi BC
 
Posts: 3282
Joined: Sat Oct 07, 2006 10:30 pm

Post » Mon May 07, 2012 7:10 am

Brilliant. I would never have thought of using that. Are you using the script to add/remove a levitate ability when the player uses the chair?
User avatar
Tasha Clifford
 
Posts: 3295
Joined: Fri Jul 21, 2006 7:08 am

Post » Mon May 07, 2012 8:35 am

I'm interested in this as well. Will there be any silly pants like in other mods?
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Mon May 07, 2012 6:54 am

Could you clarify you solution?
I do not understand: MW levitation uses walking/running animation sequences, how than you are adding the sitting sequence (I assume it is one of the idles).

:)
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Post » Mon May 07, 2012 10:23 am

@ peachykeen, yes, I have added it into the script to add\remove it and used slowfall instead of levitate. with levitate, it was still jerky, however, with slowfall it was not. I dont know why, but slowfall seems to work good so far.

@ A1x2E3I, I am using the morrowind sitting pants. I would like to make it using a sitting animation, however, i dont know how. And, i am using slowfall.

I have just one last problem, though, you guys were right after all about the collision on the chair. When i took the chair into gmax, i saw these big blue and purple boxes around the chair. I deleted those boxes, and assumed i had removed the collision. I was wrong, however, and must have had TCL on when i was able to walk through the chair. Is there any way to take off collision using nifscope? Anyhow, thanks for your help and encouragement! :)
User avatar
Harry Leon
 
Posts: 3381
Joined: Tue Jun 12, 2007 3:53 am

Post » Mon May 07, 2012 9:20 am

Nif collision branch (RootCollisionNode) is working in the following way:
it store NiTriShape nodes (geometry) that represents actual collision volumes, geometry represented in other NiTriShape nodes that do not overlap with these NiTriShape nodes (stored in RootCollisionNode branch) is considered by the game engine as empty space.
The easiest way to remove collision in a nif is to set "NCO" NiStringExtraData to the nif scene root (see e.g. flora); another option is to copy RootCollisionNode branch from a working nif and scale it down to some nonsense e.g. 0.01 (as well as to reposition it to zeros).

:)
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm

Post » Mon May 07, 2012 7:44 am

Are you saying that I can place a flora nif (like ashland grass) into the the same scene with the model, scale it down to invisibility, and export it all as a .nif and it will remove the collision?
User avatar
aisha jamil
 
Posts: 3436
Joined: Sun Jul 02, 2006 11:54 am

Post » Mon May 07, 2012 1:04 am

Oh, no! I am sorry for being so unclear and delay (my rig crashed).

All operations should be performed in NifScope.

MW flora models/nifs often have no collision. That is achieved by setting "NCO" NiStringExtraData to scene root in their nif files. You can do that with you nif (model). Check in NifScope such original flora nif and recreate "NCO" NiStringExtraData in your file. This can be done by simple copy/paste operation of "NCO" NiStringExtraData and setting "Extra Data" ("Block Details" window) of the scene root node to the node number of the copied NiStringExtraData node. You will do that faster than I am typing this.

Another approach to reduce collision on a nif level: copy/paste RootCollisionNode branch from any working nif and scale it down, as well as reposition to 0,0,0.

:)
User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Sun May 06, 2012 9:46 pm

Ok, so, I made it a Misc item to take off collision, and the slowfall effect doesn't want to work now. I even tried levitating manually. It keeps me in the chair for half a second, and then shoots me to the ground for another half second. and, It wont let my real feet go under the ground outside. It could just be an unavoidable prob, but are there any other ideas i have not svcked out of you? I was also wondering, would it be possible to use the animkit by liztail to replace the group idle 4 or somthing with a sitting one, and then script a animation change for that? I have tried, and i have utterly failed. :( I mean, with a sitting anim, the player would actually be sitting and it would work outsides. But anyhow, thanks for the help so far!
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Mon May 07, 2012 8:53 am

Would this work inside?
User avatar
Latino HeaT
 
Posts: 3402
Joined: Thu Nov 08, 2007 6:21 pm

Post » Sun May 06, 2012 8:54 pm

Hey, Xargoth

In case you're still working on this:

- I assume you have had a look at the MadMaxx "horse riding" scripts (and other variations of it) - just the sections for getting the positioning of the horse and placing/unplacing the player in the riding position? The script uses (what I would call) a "simplified trigonometry" system (e.g., getting/setting facings to the 8 cardinal compass directions, and placing the Player facing the same direction as the horse, which is "good enough"). Understand that in these the Player is placed HIGHER than the surrounding "ground," so may have to do somethig else to place the Player LOWER in a chaor, bench, etc.

- Experimenting with GhanBuriGhan's "sitting NPCs" (from "The Regulars" mod) in days gone by, I often ran into the same "floating above the chair" problem that you described.
I found that I could fix it (for these essentially static NPCs, placed in the Construction Set, on an existing, non-modified vanilla MW chair) by placing a small, invisible collision box UNDER the floor/ground at about where their normal (but now invisible) feet would be. Don't know theoretically/programming-wise why this works, but it did for me (figured it was a Game Engine thing) and so I stopped experimenting. Dunno if this is helpful to you, but you could try it (script an invisible collision box at z=whereever PC's feet would normally be, without the "sittin' pants") and see what happens (and see if you need to do anything to account for Nords and Wood Elves being inherently different heights, etc.)

DARoot
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Sun May 06, 2012 11:11 pm

I have a question:
If you can perfect this, will you release it as a modder's resource?

I can think of so many mods that would benefit from this!
In a player-owned castle mod, you could sit on the throne.
Players could actually sit and relax in chairs while they read the in-game books.

With NOM, if you decide to dine at the Food of the Gods restaurant, you can sit at a table.
(Imagine that... A paying customer actually being able to sit down... at a table! Gasp!) :D

If this works out properly, when you release this, I'd like to make some of my mods compatible with it.
(I could give each of my house mods at least one chair for the player to sit in.)

You simply must finish this!
I've always wanted to be able to actually sit down in Morrowind. :)
User avatar
barbara belmonte
 
Posts: 3528
Joined: Fri Apr 06, 2007 6:12 pm

Next

Return to III - Morrowind