Jump to content

Player won't stay at Sit Marker when being translated with TranslatetoRef()


Recommended Posts

I'm trying to make the Player Sit on my marker while it being being translated. But the player keeps on moving ( the player goes a bit to the left, like in real life, the momentum pushes the actor against the direction the translation goes, in this case right).

 

I already Tried using SetMotiontype with motion_keyframed or motion_fixed

 

Here's my Script:

 

Scriptname MovingChairScript extends ObjectReference Const
ObjectReference Property TranslateWho Auto Const
{Who to Translate?}
Event OnActivate(ObjectReference akActionRef)
Utility.Wait(5.0)
if (game.getplayer() == true)
Game.GetPlayer().SetMotionType(Game.GetPlayer().Motion_KeyFramed)
TranslateChair.SetMotionType(TranslateChair.Motion_KeyFramed)
TranslateWho.SetMotionType(TranslateWho.Motion_KeyFramed)
TranslateWho.TranslateToRef(TranslateDest, 500, 10)
TranslatePlayer.TranslateToRef(TranslateDest2, 500, 10)
TranslateChair.TranslateToRef(TranslateDest2, 500, 10)
Endif
EndEvent
ObjectReference Property TranslateDest Auto Const
ObjectReference Property TranslatePlayer Auto Const
ObjectReference Property TranslateChair Auto Const
ObjectReference Property TranslateDest2 Auto Const
The Chair is on a platform which moves with the chair which the player sits. The platform is referenced in my script as "TranslateWho".
I gave a marker for the player and chair and another marker for the platform, so the chair wont move from its position on the platform closer to the marker, and it goes on a straight line.
My issue is exactly like this guy had with the player "always falling": https://www.reddit.com/r/skyrimmods/comments/5sf2ee/problem_with_translateto_translatetoref_when_used/
Edited by aflaungos
Link to comment
Share on other sites

I did exactly this just recently. Actor kneeling on a platform and the platform and actor both being translated. I seem to recall having issues with TranslateToRef, which is why I did it the long way here.

function translate_to_ring()
        sd = servo_noise.play(self)
        objectreference mark = base.trolley_end_marker
;
;       get the angles for shorthand
;
        float ax = base.getAngleX()
        float ay = base.getAngleY()
        float az = base.getAngleZ()
;
;       translate the platform and actor together
;
        TranslateTo(mark.x, mark.y, mark.z, ax, ay, az+180, 35, 0)
        passenger.TranslateTo(mark.x, mark.y, mark.z, ax, ay, az+180, 35, 0)
;
;       wait for the translation to end
;
endfunction

Event OnTranslationComplete()
        sound.stopInstance(sd)
endevent

 

Link to comment
Share on other sites

It is way more complex to do, but if you want to do it right I suggest you to use a custom race that acts as mount (like a vertibird or a horse do) instead of a marker, then you will be able to translate it properly.

Link to comment
Share on other sites

Thanks for the answers guys. I'm not very experienced with Creation Kit scripting, could you explain why you had get these angles? also how do I create such a new race to use as a mount?

 

I tried including a static fence right next to my sit marker as a barrier, but the player goes right through during translation :wacko: :dry:

 

Also does anyone know how much impact on performance would tranlasting multiple characters cause?

Edited by aflaungos
Link to comment
Share on other sites

Thanks for the answers guys. I'm not very experienced with Creation Kit scripting, could you explain why you had get these angles?

I had a trolley on rails and I just wanted linear movement. TranslateTo needs angles, so I took the orientation the trolley started with and used that for the final position. Except, looking at the code there, I didn't, but rather took the rotation of the base the trolley was mounted upon. Which probably explains why it kept trying to rotate through 180 degrees when it moved. And because it was rotating, that's why I added the +180 to the Z value - good old trial and error.

 

I did the rideable race thing too. My hapless passenger then gets strapped to a ring and rotated horizontal, and the only way I could find to make that work for everyone was to make the ring into a vehicle.

 

It is complicated, but what I did was to take an eyebot and copy it. I also copied the race, and I gave it a new skin (which is an armor record, but acts as the skin of the race. A bit of fiddling with allowed extra races (no idea why - probably another stupid bug on my part) and I had a metal ring that thought it was an eyebot. Then I set the movement type to immobile so it wouldn't fly off, and deleted all its AI packages.

 

The 'bot has to function as furniture, so you need an idle animation. I already had one of those from previous attempts, but if all else fails the kneeling captive pose usually works for me. Set up a furniture keyword as explained here and probably test it on a chair or a mat or something and make sure it's working.

 

Then you need a node to attach to in the bot's skeleton. (This is why you need to copy the race - it needs an edited nif and you don't want to apply this to all existing eyebots or whatever). All you need to do, is set up a BSConnectPoint parent to the root bone. (Anywhere else and the passenger will bob with the movement that the eyebot would have been making) Call the point p-AttachPassenger.

 

In the 'bot Actor record, you need a few things. It needs a workshopobjectactorscript and a workshopobjectscript. In the Race record you need to add some keywords. It wants ap_attachPassenger, hasPassengerMounts, ap_AttachSlot1 (maybe not needed) and the a keyword you create to identify this as a type of vehicle using the idle you set up earlier.

 

You get all that done, the last thing is to set up a Subgraph record, like for the furniture, but also using the vehicle type keyword you created.

 

And if you get all that right, you should be able to ride the bot. The one remaining detail is that anyone you want to ride will need the keyword p-AttachPassenger adding to the actor record. Doesn't matter how they get the keyword, but if they don't have it. it won't work.

 

So yeah, it's complicated, even by CK standards. If you want to give it a shot, look at the Vertibird NPCs and Race in the CK and yhe Vertibird nifs. On the Nexus there's Rideable Bots which is one of the things I used as a reference when learning all this.

 

And if you want to see how I did it (and if you don't mind some NSFW content) look at the tattoo frame in Raider Reform School over on LoversLab.

 

And ... good luck!

Link to comment
Share on other sites

  • 4 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...