Morrowind, Better Sitting Stool\Chair

Post » Fri May 27, 2011 11:32 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
Antony Holdsworth
 
Posts: 3387
Joined: Tue May 29, 2007 4:50 am

Post » Sat May 28, 2011 4:20 am

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
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Sat May 28, 2011 7:17 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
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Sat May 28, 2011 3:41 am

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
sophie
 
Posts: 3482
Joined: Fri Apr 20, 2007 7:31 pm

Post » Fri May 27, 2011 9:11 pm

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
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Fri May 27, 2011 11:46 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
Celestine Stardust
 
Posts: 3390
Joined: Fri Dec 01, 2006 11:22 pm

Post » Fri May 27, 2011 10:25 pm

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
Steph
 
Posts: 3469
Joined: Sun Nov 19, 2006 7:44 am

Post » Sat May 28, 2011 5:06 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.

:)
User avatar
Kira! :)))
 
Posts: 3496
Joined: Fri Mar 02, 2007 1:07 pm

Post » Sat May 28, 2011 6:49 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
Stacey Mason
 
Posts: 3350
Joined: Wed Nov 08, 2006 6:18 am

Post » Fri May 27, 2011 10:51 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
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Sat May 28, 2011 1:32 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
leigh stewart
 
Posts: 3415
Joined: Mon Oct 23, 2006 8:59 am

Post » Sat May 28, 2011 10:11 am

So, How would i fix this bouncing thing?
User avatar
Bones47
 
Posts: 3399
Joined: Fri Nov 09, 2007 11:15 pm

Post » Fri May 27, 2011 7:05 pm

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
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Sat May 28, 2011 1:35 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
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Fri May 27, 2011 11:58 pm

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
Bad News Rogers
 
Posts: 3356
Joined: Fri Sep 08, 2006 8:37 am

Post » Sat May 28, 2011 2:14 am

I'm interested in this as well. Will there be any silly pants like in other mods?
User avatar
Dean Ashcroft
 
Posts: 3566
Joined: Wed Jul 25, 2007 1:20 am

Post » Fri May 27, 2011 7:20 pm

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
michael flanigan
 
Posts: 3449
Joined: Thu Jun 14, 2007 2:33 pm

Post » Sat May 28, 2011 7:57 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
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Sat May 28, 2011 10:22 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
Allison Sizemore
 
Posts: 3492
Joined: Wed Jul 19, 2006 6:09 am

Post » Fri May 27, 2011 9:55 pm

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
Marie
 
Posts: 3405
Joined: Thu Jun 29, 2006 12:05 am

Post » Sat May 28, 2011 7:34 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
Neliel Kudoh
 
Posts: 3348
Joined: Thu Oct 26, 2006 2:39 am

Post » Sat May 28, 2011 1:18 am

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
Jonathan Montero
 
Posts: 3487
Joined: Tue Aug 14, 2007 3:22 am

Post » Fri May 27, 2011 11:26 pm

Would this work inside?
User avatar
ONLY ME!!!!
 
Posts: 3479
Joined: Tue Aug 28, 2007 12:16 pm

Post » Fri May 27, 2011 9:16 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
Brian Newman
 
Posts: 3466
Joined: Tue Oct 16, 2007 3:36 pm

Post » Fri May 27, 2011 10:27 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
SWagg KId
 
Posts: 3488
Joined: Sat Nov 17, 2007 8:26 am

Next

Return to III - Morrowind