DoctaSax Posted May 26, 2012 Posted May 26, 2012 Note (20130531): completely forgot about this. Things aren't quite as they were. Everything in this that says set SexoutNG.surfacevar to SexoutNG.surfacevar + somevalue/calculationshould now just neatly be set SexoutNG.surfacevar to somevalue/calculationin the old version. For NX, that'd be either actorref.NX_SetEVFl "Sexout:Start::surfacevar" somevalueor set somenewvariable to somecalculationand then actorref.NX_SetEVFl "Sexout:Start::surfacevar" thatvariableyoudeclaredbackthere And remember most of those sines and cosines parts are just meant for a generic approach, where you don't know which bed it'll end up on. Most modders doing this for a specific bed shouldn't really be reading beyond part 2 and just test it out a bit what the x,y directions are in that particular cell. I will update to all-nx when I can. Note: there can be problems with declaring variables in a result script, which this tutorial tells people to do in order to figure out the directions in which you'll be moving your toons on the beds. If at all possible, try to hold such variables elsewhere, like in a quest script. If not, make sure you read this post & this one. 1. Intro: what’s this for? In the natural course of complicating matters for my upcoming quest mod (don’t expect a release anytime soon ), I wanted to include a lot of sex on beds, maybe couches too. SexoutNG allows for that, but sometimes you need to tweak the positioning a bit. That's what this will help with if you want to have bed sex in a mod of your own.Exactly which tweaks to apply depends on what works for the anim as well as the bed, the presence of statics around you, and even personal taste. So we won’t go into that. What this tutorial does provide is a way of translating “move a bit to the headboard, footboard, left or right” into code. As with most things, it’s not as complicated as extensive description will make it sound like.Aside from needing NG, obviously, you’ll also need to have SCR (20120526.1 or later) loaded for some formlists we’ll use.2. The Basics: starting bed sex, and why you need position tweakingThere’s no reason to prance all over the bed with those dirty boots of yours, getting desert sand between the sheets and ruining the immersion. Prideslayer included just the variable for moving the action to a bed in the main SexoutNG script – refSurface – which needs to point to a persistent ref.So you load up the cell in the render window, doubleclick on that bed, flag it as persistent, give it an editorID, and save. Best make that eidtorID unique to your mod to avoid fubars – I’ll go with MyUniqueBedNameRef for the purpose of this little tutorial.In short: you add “set SexoutNG.refSurface to MyUniqueBedNameRef” to the dialogue result script or whatever that triggers the action.Like this: Set SexoutNG.ActorA to GetSelfSet SexoutNG.ActorB to playerSet SexoutNG.AnimA to 201Set SexoutNG.AnimB to 201Set SexoutNG.IsOral to 1Set SexoutNG.refSurface to MyUniqueBedNameRefCIOS SexoutNGBegin Now, that in itself may work properly for some anims, but for others it can get you messed-up stuff like floating in mid-air and having a cock shoved up your eyehole, sinking through the bed, people using the Force to push themselves up from the air, or permeable pillows. Floating, sinking, things just not looking right. Nobody’s fault; you can get similar misalignments doing it on the floor, especially if there’s stuff lying there. And of course, quite a few of those oral anims, and some 3-ways too, simply take up more physical space to cause problems.Most of these can be corrected by tweaking the positioning of the actors with fSurfaceX, fSurfaceY, fSurfaceZ and fSurfaceAngle in the same script. Without tweaking, those variables correspond to the x position, y position, z position and z rotation of the bed reference. Adjusting them is as easy as typing “set SexoutNG.fSurfaceX to SexoutNG.fSurfaceX + (some value)”, with the value being the distance you want to move, in game units.Lots of loading up the geck & ingame testing allowed me to make those messed-up anims look a lot better: no more eyepoking here(moved to headboard & to the left), no more sinking here(moved to footboard, the right, up & turned), no more levitation here(turned, moved to right and up), and avoided clipping here(moved to footboard & left). Maybe not 100% perfect, but a definite improvement.Changing the height is easy:set SexoutNG.fSurfaceZ to SexoutNG.fSurfaceZ + distance (+ = up, - = down)Turning your toons around is easy:set SexoutNG.fSurfaceAngle to SexoutNG.fSurfaceAngle + angle offset (+ = clockwise, - = counterclockwise)BUT: just because increasing the X value moved my toons toward the headboard and increasing Y moved them to the right on this particular bed in this particular cell, doesn’t mean it’ll do the same elsewhere, even on the same type of bed: it all depends on the z-angle at which it’s placed. Dang!Oh, how I wish I could just say “move 10 units to the headboard, and 30 to the left”, and let someone else figure out what that means in terms of x & y and all that confusing Beth-trigonometry bollocks...3. Doing all the work for youFrankly, translating “move a little to the left” into an x/y-adjustment doesn’t just rely on the z-angle at which the bed is placed, but also on what bed it is. Placing a “BedQueenBothSides” (that’s under furniture) at z-angle 0 will have the headboard in exactly the opposite direction of where it will be when you place a “HotelBedQueenBothSides” at the same angle. That’s because *they* just never make things easy.Luckily Halstrom agreed to add some formlists to SCR, so you can always use the following bit of code to determine the direction the headboard is in (aka where the head will be when an npc sleeps on it - for big heart-shaped beds, it's the opposite side of the pointy end): Float fAngleHead if MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ set fAngleHead to MyUniqueBedNameRef.GetAngle Z elseif MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ180 set fAngleHead to MyUniqueBedNameRef.GetAngle Z + 180 elseif MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ90 set fAngleHead to MyUniqueBedNameRef.GetAngle Z + 90 elseif MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ270 set fAngleHead to MyUniqueBedNameRef.GetAngle Z + 270 endif Now that we know what direction the headboard is in, we can figure out the other directions:set fAngleFeet to fAngleHead + 180 set fAngleLeft to fAngleHead + 270 set fAngleRight to fAngleHead + 90note: "left" is assumed to be on your left when you're looking at he bed standing at the footboard.You’ll have to declare those new float variables too, of course, that is if you need them. No point in declaring and setting a variable you’re not going to use. It’s unlikely you’ll want to move in opposite directions at the same time, after all. And if you already know you’re going to move to the footboard & not the headboard, you can derive fAngleFeet from those list calculations directly (add 180).So, now that we have the angles of our directions, let’s translate moving towards them into x & y positions:set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleHead) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleHead); toward headboard set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleFeet) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleFeet); toward footboard set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleLeft) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleLeft); to the left set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleRight) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleRight); to the right I’ve also found that even if you don’t want to turn your toons around, setting the angle to the fAngleHead will more likely result in people’s heads being towards the headboard, so let’s do that too:Set SexoutNG.fSurfaceAngle to fAngleHead (+ possible angle offset)4. Template for your regular dialogue result script (only use what you need)Float fAngleHead Float fAngleFeet Float fAngleLeft Float fAngleRight set sexoutNG.actorA to ... (eg GetSelf) ; standard NG stuff set sexoutNG.actorB to ... (eg player) set sexoutNG.animA to ... (eg 201) set sexoutNG.animB to ... set sexoutNG.IsOral/Vaginal/Anal to 1 set sexoutNG.refSurface to … (eg MyUniqueBedNameRef) if MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ set fAngleHead to MyUniqueBedNameRef.GetAngle Z elseif MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ180 set fAngleHead to MyUniqueBedNameRef.GetAngle Z + 180 elseif MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ90 set fAngleHead to MyUniqueBedNameRef.GetAngle Z + 90 elseif MyUniqueBedNameRef.IsInList SexoutSLFurnBedsHeadIsAngleZ270 set fAngleHead to MyUniqueBedNameRef.GetAngle Z + 270 endif set fAngleFeet to fAngleHead + 180 set fAngleLeft to fAngleHead + 270 set fAngleRight to fAngleHead + 90 set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleHead) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleHead) set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleLeft) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleLeft) set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleFeet) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleFeet) set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleRight) set sexoutNG.fSurfaceY to (sexoutNG.fSurfaceY + distance * cos fAngleRight) set sexoutNG.fSurfaceAngle to fAngleHead + angleoffset set sexoutNG.fSurfaceZ to (sexoutNG.fSurfaceZ + distance) CIOS SexoutNGBegin And you're all set Like I said before, you're not going to need all of that code because you won't be moving your toons in opposite directions. Also, if you already know what direction list the bed you're referring to belongs to, you can probably skip those IsInList checks and go straight to determining those angles. It's all good. 1
jaam Posted May 26, 2012 Posted May 26, 2012 I have been toying with the idea of having SexoutSex and SexoutHookups accepts a bed as a place to have sex. This will help a lot.
DoctaSax Posted May 26, 2012 Author Posted May 26, 2012 I have been toying with the idea of having SexoutSex and SexoutHookups accepts a bed as a place to have sex. This will help a lot. Great! In that case you'd probably have to bypass the need for a persistent ref. I'm guessing if you put your positioning code in a quest or spell script instead, you can point the refSurface to a declared ref. Possibly by somehow using the "find a bed" sleep package in NG to determine it. Not 100% about any of that, of course. I know prideslayer said somewhere it needs to be a persistent ref, but maybe he said that mostly with result scripts in mind. Also, what works for a big double bed probably won't work for a small single bed, so you might want to work with a few extra formlists of your own to determine which tweaks you'll use for which beds.
jaam Posted May 26, 2012 Posted May 26, 2012 The issue with "Find a bed" is that it can ignore the bed right next to you and end up at the other end of the cell! Sometime I wonder if Beth coded "find the farthest bed"! Instead I was thinking of using the bed under the cursor. Permanent ref in script is a requirement of scripts inside ESM. But avoiding temporary ref also means avoiding referencing ref not loaded in memory.
DoctaSax Posted May 26, 2012 Author Posted May 26, 2012 The issue with "Find a bed" is that it can ignore the bed right next to you and end up at the other end of the cell! Sometime I wonder if Beth coded "find the farthest bed"! Instead I was thinking of using the bed under the cursor. Permanent ref in script is a requirement of scripts inside ESM. But avoiding temporary ref also means avoiding referencing ref not loaded in memory. They probably did, just to annoy you. And sure enough, using the bed under crosshair is probably more elegant than what I suggested . For what I have in mind I only need 2 or 3 beds, which is easy enough to change, so I haven't given much thought to how it would work with non-persistents.
sen4mi Posted May 26, 2012 Posted May 26, 2012 And I would also like to remind everyone that you can use a quest stage in a dialog script, if you want to re-use code in multiple dialog topics. You just need to make sure you change the quest stage afterwords, so that it can be used again.
ChancellorKremlin Posted May 29, 2012 Posted May 29, 2012 This is really good, thanks DoctaSax! I have been toying with the idea of having SexoutSex and SexoutHookups accepts a bed as a place to have sex. This will help a lot. Indeed, that would be perfect, I often find it annoying we can't get NPC's to have sex on beds, it's only natural. Who likes having sex on dirt anyways? I remember animated prostitution, or wsex, allowed that option through dialogue, and it worked about 85% of the time.
KainsChylde Posted May 30, 2012 Posted May 30, 2012 I remember animated prostitution' date=' or wsex, allowed that option through dialogue, and it worked about 85% of the time. [/quote'] wsex, I'm using it now.
DoctaSax Posted May 30, 2012 Author Posted May 30, 2012 Indeed' date=' that would be perfect, I often find it annoying we can't get NPC's to have sex on beds, it's only natural. Who likes having sex on dirt anyways? [/quote'] Well, I don't mind a bit of dirt myself, but desert sand gets everywhere. And true enough, in a world left with little comfort, people would value it even more, I think. I'm wondering what more we can do with the whole refsurface thing. I've been thinking about involving couches & the like, of course, but also about other stuff, like on/against a table or kitchen counter, against a wall... Seems to me the more variety and the more situational, the better. There used to be a nice anim in Oblivion meant for being against a wall - probably from sexlivion - but I don't think it ever actually moved you to a wall so it ended up looking silly - a bit like a mime with that invisible wall thing. In FNV you have idle markers for standing against a wall though, so that might work if we could have a decent anim for it. As for on/against tables & counters, something could already be worked out by mixing & matching anims already in the system, but that would probably mean extra stuff to do in NG itself (some new anim numbers, relative positioning of the actors). Still, one can dream
sen4mi Posted May 30, 2012 Posted May 30, 2012 Permanent ref in script is a requirement of scripts inside ESM. But avoiding temporary ref also means avoiding referencing ref not loaded in memory. You could have a placeholder to use for the reference when it's not plugged in?
DoctaSax Posted November 15, 2012 Author Posted November 15, 2012 Updated OP with a caveat about declaring variables in result scripts.
BruceWayne Posted April 7, 2014 Posted April 7, 2014 Massive necro inbound... I have some trouble with getting my adjustments into the game. Declaring a bed works alright, but my adjustments don't show. I thought they were, but that were pose-specific circumstancial observations, unfortunately. This is probably due to me not getting the NX stuff right. My (new) code from SOWillow looks like this: playerRef.NX_SetEVFl "Sexout:Start::CallVer" 1 playerRef.NX_SetEVFo "Sexout:Start::ActorA" WillowREF playerRef.NX_SetEVFo "Sexout:Start::ActorB" playerRef playerRef.NX_SetEVFl "Sexout:Start::duration" Sexout.dfTime playerRef.NX_SetEVFl "Sexout:Start::isVaginal" 1 playerRef.NX_SetEVFo "Sexout:Start::refSurface" WillowHouseBedREF set fNewAngle to playerRef.NX_GetEVFl "Sexout:Start::fSurfaceAngle" set fNewSurfaceX to playerRef.NX_GetEVFl "Sexout:Start::fSurfaceX" set fNewSurfaceY to playerRef.NX_GetEVFl "Sexout:Start::fSurfaceY" set fNewSurfaceZ to playerRef.NX_GetEVFl "Sexout:Start::fSurfaceZ" playerRef.NX_SetEVFl "Sexout:Start::fSurfaceAngle" fNewAngle playerRef.NX_SetEVFl "Sexout:Start::fSurfaceX" fNewSurfaceX+400 playerRef.NX_SetEVFl "Sexout:Start::fSurfaceY" fNewSurfaceY+400 playerRef.NX_SetEVFl "Sexout:Start::fSurfaceZ" fNewSurfaceZ+400 playerRef.CIOS SexoutBegin Don't mind the strange values, I was trying to see if some of it sticks.
DoctaSax Posted April 7, 2014 Author Posted April 7, 2014 Hm, yeah, this was a while back, heh. Back when the nx calling method was still brand new, and I based it on the old syntax. There was also a change at some point during my first posting it and the caveat I posted at the top later on. I don't think you can NX_Set stuff like this: playerRef.NX_SetEVFl "Sexout:Start::fSurfaceX" fNewSurfaceX+400 but need to calculate the value separately first: let fNewSurfaceX := 400 NX_SetEVFl "Sexout etc" fNewSurfaceX Originally had you calculate the value as an offset (set newvalue to currentvalue + offset), but at some point in SO's development that got incorporated in the main code, I believe, so now you just stipulate the offset directly: set newvalue to offset. So the middle part of your code will actually make it so that everything is done twice. If I took the time to re-do SOFO's implementation of it, I'd hold the different values in separate array maps, with the anim numbers as keys, and construct a UDF with the sex type and anim number as parameters. scn myUDF int iAnal int iVag int iOral int iAnim ref rActorA ref rActorB Begin Function {iAnal iVag iOral iAnim rActorA rActorB} ; generic sexout code, setting actor refs, sex type vars, anim ; set refsurface let fXOffset := myXmap[iAnim] let fYOffset := myYmap[iAnim] let fZOffset := myZmap[iAnim] let fAngleOffset := myAnglemap[iAnim] ; nx_set x, y, z, angle vars CIOS SexoutBegin End And then just call it from dialog like: (implied ref.)call MyUDF 0 1 0 playerref willowref 604 (Also, most of the tut is meant to transpose specific per-anim offsets to different situations depending on how the bed is situated, I wager most of that isn't needed if you plan to do it for one specific bed in a cell. And setting duration to dftime is superfluous)
BruceWayne Posted April 7, 2014 Posted April 7, 2014 (edited) Thanks, that did the trick. I'm probably not going out of my way to make adjustments for all the animations, though. I'm totally fine with most of them running alright. It's a custom bed with an uneven surface, so that'll be probably overkill, since it wouldn't really be of use otherwise. Though if the wonkiness persists, I might place an invisible matress on the bed and make that my RefSurface (if that works of course). Actually the dftime bit is necessary if you have Lust. Since the ftb scene stages run on a timer (which is dftime+2 seconds long in this case), this ensures that sex always completes first before moving on with the next stage (dialogue, redressing, etc). Edited April 7, 2014 by BruceWayne
Guest tomm434 Posted April 8, 2014 Posted April 8, 2014 What am I doing wrong? My code is int fNewAngle aaamq05laREF.NX_SetEVFl "Sexout:Start::CallVer" 1 aaamq05laREF.NX_SetEVFo "Sexout:Start::Raper" aaamq05labman1ref aaamq05laREF.NX_SetEVFo "Sexout:Start::ActorA" aaamq05labman2ref aaamq05laREF.NX_SetEVFo "Sexout:Start::ActorB" aaamq05laREF set fNewAngle to playerRef.NX_GetEVFl "Sexout:Start::fSurfaceAngle" aaamq05laREF.NX_SetEVFl "Sexout:Start::anim" 632 aaamq05laREF.NX_SetEVFl "Sexout:Start::fSurfaceAngle" fNewAngle +180 aaamq05laREF.NX_SetEVFl "Sexout:Start::duration" 30' aaamq05laREF.CIOS SexoutBegin I need actors to turn around. Now male is standing with his back towards PC. I tried setting 45 instead of 180 and I get the same results.
DoctaSax Posted April 8, 2014 Author Posted April 8, 2014 The same thing as I told Bruce: you can't stipulate the adjustments as NX_SetEVFl "nxkey" somevariable + somevalue, only NX_SetEVFL "nxkey" somevalue
BruceWayne Posted April 8, 2014 Posted April 8, 2014 Here is my revised script, if that helps: playerRef.NX_SetEVFl "Sexout:Start::CallVer" 1 playerRef.NX_SetEVFo "Sexout:Start::ActorA" playerRef playerRef.NX_SetEVFo "Sexout:Start::ActorB" WillowREF playerRef.NX_SetEVFl "Sexout:Start::isVaginal" 1 playerRef.NX_SetEVFl "Sexout:Start::duration" Sexout.dfTime playerRef.NX_SetEVFo "Sexout:Start::refSurface" WillowHouseBedREF let fNewAngle := 50 let fNewSurfaceZ := 17 playerRef.NX_SetEVFl "Sexout:Start::fSurfaceAngle" fNewAngle playerRef.NX_SetEVFl "Sexout:Start::fSurfaceZ" fNewSurfaceZ playerRef.CIOS SexoutBegin
Guest tomm434 Posted April 9, 2014 Posted April 9, 2014 The same thing as I told Bruce: you can't stipulate the adjustments as NX_SetEVFl "nxkey" somevariable + somevalue, only NX_SetEVFL "nxkey" somevalue Sorry, it was difficult for me to understand. int fnewangle aaamq05laREF.NX_SetEVFl "Sexout:Start::CallVer" 1 aaamq05laREF.NX_SetEVFo "Sexout:Start::Raper" aaamq05labman2ref aaamq05laREF.NX_SetEVFo "Sexout:Start::ActorA" aaamq05labman2ref aaamq05laREF.NX_SetEVFo "Sexout:Start::ActorB" aaamq05laREF let fNewAngle := 30 aaamq05laREF.NX_SetEVFl "Sexout:Start::anim" 632 aaamq05laREF.NX_SetEVFl "Sexout:Start::fSurfaceAngle" fNewAngle aaamq05laref.NX_SetEVFl "Sexout:Start::duration" 30' aaamq05laEF.CIOS SexoutBegin aaamq05labman1ref.look aaamq05laref 1 aaamq05labman3ref.look aaamq05laref 1 BruceWayne, thanks. There is my code and this doesn't have an effect. I left only surface angle. Is that right? Should I use playerRef.NX_SetEVFo "Sexout:Start::refSurface" My surface for "angle" part to work?
Guest tomm434 Posted April 9, 2014 Posted April 9, 2014 You do need to set a refsurface, yes. Thanks a lot, it works. But thing just went more difficult - Now I have to tweak manually the location of actors. And I'm lucky that I use my own cell that I can give any reference to any block on the map. Oh wait.. I can use markers. This is better but I would still have to edit vanilla cell if I was using one.
Odessa Posted September 8, 2014 Posted September 8, 2014 Great tutorial, since its pretty long winded and we have NVSE4 now, I wrote a UDF to do all the work, does this look correct (probably only the bottom 'what movement was requested is worth looking at'? If so, perhaps Halstrom would be interested in adding it to SCR. scn GetBedOffsets ; * Returns a stringmap containing all the offsets for the passed bed. ; * Note, it does all the validity checking you need, so you don''t need ; * to bother doing that yourself. ; * Example Usage: ; ; array_var Bed_Offsets ; ... ; let Bed_Offsets := call GetBedOffsets MyBedRef, "some direction", SomeDistance ; if Bed_Offsets ; ; it worked, keys = "x", "y", "z", "a" (angle) ; call fnSexoutActSetRef "RefSurface", MyBedRef ; call fnSexoutActSetFloat "fSurfaceX", (SexoutNG.fSurfaceX + Bed_Offsets["x"]) ; call fnSexoutActSetFloat "fSurfaceY", (SexoutNG.fSurfaceY + Bed_Offsets["y"]0 ; call fnSexoutActSetFloat "fSurfaceZ", (SexoutNG.fSurfaceZ + Bed_Offsets["z"]) ; call fnSexoutActSetFloat "fSurfaceAngle", (SexoutNG.fSurfaceAngle + Bed_Offsets["a"]) ; else ; ; sorry, that furniture is invalid or unknown, you''ll have to screw in the dirt or make do. ; endif ; call fnSexoutActRun ; ; Written by Odessa based on the wisdom of DoctaSax (MD) ; * args ref rBed ; target furniture string_var direction ; "head", "left", "right", "feet", "vertical", "rotate" or "" (for just head angle) float Dist ; distance to move (or rotate) ; * local float AngleHead float AngleFeet float AngleLeft float AngleRight float OffsetX float OffsetY float OffsetZ float OffsetAngle Begin Function { rBed, direction, Dist } ; * Validity Checking if eval !(IsFormValid rBed) DebugPrint "GetBedOffsets failed- passed invalid form" return elseif eval !(IsReference rBed) DebugPrint "GetBedOffsets failed- passed a non-reference: %n (%i)" rBed, rBed return elseif eval !(rBed.IsPersistent) DebugPrint "GetBedOffsets failed- passed a non-persistent ref: %n (%i)" rBed, rBed return elseif eval (GetType rBed) != 39 DebugPrint "GetBedOffsets failed- passed a non-furniture: %n (%i)" rBed, rBed return endif ; * Is bed known? if rBed.IsInList SexoutSLFurnBedsHeadIsAngleZ let AngleHead := rBed.GetAngle Z elseif rBed.IsInList SexoutSLFurnBedsHeadIsAngleZ180 let AngleHead := rBed.GetAngle Z + 180 elseif rBed.IsInList SexoutSLFurnBedsHeadIsAngleZ90 let AngleHead := rBed.GetAngle Z + 90 elseif rBed.IsInList SexoutSLFurnBedsHeadIsAngleZ270 let AngleHead := rBed.GetAngle Z + 270 else DebugPrint "GetBedOffsets failed, unknown furniture: %n (%i)" rBed, rBed return endif let OffsetAngle := AngleHead ; * What movement was requested? if eval (direction == "") ; Pass elseif eval (direction == "Head") let OffsetX := Dist * (Sin AngleHead) let OffsetY := Dist * (Cos AngleHead) elseif eval (direction == "Left") let AngleLeft := AngleHead + 270 let OffsetX := Dist * (Sin AngleLeft) let OffsetY := Dist * (Cos AngleLeft) elseif eval (direction == "Feet") let AngleFeet := AngleHead + 180 let OffsetX := Dist * (Sin AngleFeet) let OffsetY := Dist * (Cos AngleFeet) elseif eval (direction == "Right") let AngleRight := AngleHead + 90 let OffsetX := Dist * (Sin AngleRight) let OffsetY := Dist * (Cos AngleRight) elseif eval (direction == "Vertical") let OffsetZ := Dist elseif eval (direction == "Rotate") let OffsetAngle += Dist else Print "GetBedOffsets: Error - passed an unknown direction: '" + direction + "' by script: " + $(GetCallingScript) return endif SetFunctionValue (Ar_Map "x"::OffsetX, "y"::OffsetY, "z"::OffsetZ, "a"::OffsetAngle) End One thing I am a bit unsure about:set sexoutNG.fSurfaceX to (sexoutNG.fSurfaceX + distance * sin fAngleRight) Is the bold bit still valid/necessary? (editted script slightly)
DoctaSax Posted September 8, 2014 Author Posted September 8, 2014 Probably not. In the earlier days of the refsurface functionality, you needed to add the offset but now you don't anymore. I think - been a while.
DoctaSax Posted September 8, 2014 Author Posted September 8, 2014 Also, I'm not sure why I stated the refsurface needs to point to a persistent ref. Chances are if you pass a bed ref from let's say a ref walk to a quest ref var, you can use that. Fairly certain I just wanted to avoid people setting the var directly to the result of a function, or set the nx var to an external quest ref var from a result script or something like that.
Odessa Posted September 8, 2014 Posted September 8, 2014 Thinking about it, RefSurface works on statics as well as furniture, I used it for a billiards table after someone requested it. I suppose the offsets would work if they were figured out and added to the form lists. Do you know if it is possible to change the angle in 3 dimensions? If so, I wonder if something similar could be used for uneven ground as well.
jaam Posted September 8, 2014 Posted September 8, 2014 Persistent ref are required by scripts in ESM. Unfortunately, other scripts can use non persistent ref, the kind that can disappear abruptly .
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now