Morrowind, Better Sitting Stool\Chair

Post » Wed Nov 30, 2011 3:34 am

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
Charlotte Buckley
 
Posts: 3532
Joined: Fri Oct 27, 2006 11:29 am

Post » Wed Nov 30, 2011 6:00 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
Katey Meyer
 
Posts: 3464
Joined: Sat Dec 30, 2006 10:14 pm

Post » Wed Nov 30, 2011 2:03 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
Queen Bitch
 
Posts: 3312
Joined: Fri Dec 15, 2006 2:43 pm

Post » Wed Nov 30, 2011 4:46 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
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Tue Nov 29, 2011 7:35 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
Raymond J. Ramirez
 
Posts: 3390
Joined: Sun Oct 14, 2007 8:28 am

Post » Tue Nov 29, 2011 9:34 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
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Tue Nov 29, 2011 10:44 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
Jimmie Allen
 
Posts: 3358
Joined: Sun Oct 14, 2007 6:39 am

Post » Wed Nov 30, 2011 4:37 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
A Dardzz
 
Posts: 3370
Joined: Sat Jan 27, 2007 6:26 pm

Post » Wed Nov 30, 2011 3:48 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
Maddy Paul
 
Posts: 3430
Joined: Wed Feb 14, 2007 4:20 pm

Post » Tue Nov 29, 2011 11:10 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
Daniel Lozano
 
Posts: 3452
Joined: Fri Aug 24, 2007 7:42 am

Post » Tue Nov 29, 2011 11:43 pm

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
Natasha Biss
 
Posts: 3491
Joined: Mon Jul 10, 2006 8:47 am

Post » Wed Nov 30, 2011 6:48 am

So, How would i fix this bouncing thing?
User avatar
Roanne Bardsley
 
Posts: 3414
Joined: Wed Nov 08, 2006 9:57 am

Post » Tue Nov 29, 2011 8:48 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
Alan Cutler
 
Posts: 3163
Joined: Sun Jul 01, 2007 9:59 am

Post » Tue Nov 29, 2011 9:35 pm

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
Lori Joe
 
Posts: 3539
Joined: Tue Jun 20, 2006 6:10 am

Post » Tue Nov 29, 2011 7:29 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
jaideep singh
 
Posts: 3357
Joined: Sun Jul 08, 2007 8:45 pm

Post » Wed Nov 30, 2011 1:55 am

I'm interested in this as well. Will there be any silly pants like in other mods?
User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Tue Nov 29, 2011 11:48 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
Yama Pi
 
Posts: 3384
Joined: Wed Apr 18, 2007 3:51 am

Post » Wed Nov 30, 2011 7:36 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
Joanne Crump
 
Posts: 3457
Joined: Sat Jul 22, 2006 9:44 am

Post » Tue Nov 29, 2011 11:13 pm

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
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Tue Nov 29, 2011 8:05 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
Charleigh Anderson
 
Posts: 3398
Joined: Fri Feb 02, 2007 5:17 am

Post » Tue Nov 29, 2011 9:57 pm

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
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Wed Nov 30, 2011 3:36 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
RAww DInsaww
 
Posts: 3439
Joined: Sun Feb 25, 2007 5:47 pm

Post » Tue Nov 29, 2011 10:54 pm

Would this work inside?
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Tue Nov 29, 2011 11:33 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
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm

Post » Tue Nov 29, 2011 7:03 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
djimi
 
Posts: 3519
Joined: Mon Oct 23, 2006 6:44 am

Next

Return to III - Morrowind