Jump to content

Proof that a player can fly in Skyrim well may be more like swimming


hex_ratt

Recommended Posts

Hi, I'm currently trying to get Porroones script from page 1 to work. I have put it on a ring. But when I equip that ring and run, nothing happens?

 

I was thinking about something, we do not have keypress, but we have onAnimationEvent. What if we search for animation events, I.E "ActionJump" or "JumpStandingStart", and as soon as that is registered, interrupt that animation and do something else?

Link to comment
Share on other sites

  • Replies 304
  • Created
  • Last Reply

Top Posters In This Topic

Been there, doesnt work, currently I made a system that detects w,a,s,d using magic effects inside an enchantment with the conditions GetMovementDirection(thanks DarkenDe for the idea :)), for example if my player is moving in the forward direction the magic effect "MoveForward" runs, this effect has an script that modifies a global variable on the events OnEffectStart and OnEffectFinish. Adding to all that my way to add new animations to the behavior, I could achieve a cool flight system with 5 different animations controlling the flight (one for standing, another to fly forward,left,right and back), there is still the problem with collisions, im not sure if its fixable since even Dragons dont collide with the world while in flight mode.
Link to comment
Share on other sites

I tried controlling flight with the movement directions before. I didn't like seeing my character run in midair though. I decided to make it so that I only fly in the direction my character is facing, and that toggling flight mode requires drawing/sheathing my weapon. The drawing/sheathing is because my character doesn't turn in 3rd person unless in combat mode.

 

EDIT: I haven't figured out how to detect collision though. I tried an idea someone mentioned about casting spells, creating explosions, and spawning activators but for some reason it doesn't work.

Edited by fg109
Link to comment
Share on other sites

Even if it does, anything that requieres checking constantly for some kind of triggering would be really expensive to do, im not sure how bad but if you have several scripts doing that kind of stuff would probably affect performance. Edited by porroone
Link to comment
Share on other sites

I updated my flying script to fly in different directions, so now if you press WASD it flies forward,back and strafes left/right. In order to do that I had to do some stuff I will explain later, if you are interested in recreating this, then follow the instructions:

First create 5 magic effects, we will call them: FlyingRing,FlyingFwd,FlyingBck,FlyingLft,FlyingRgt. This magic effects will have the next options:

Effect Archetype: Script

Casting Type: Constant Effect

Delivery: Self

Once we created the effects we go to the Object Window, Miscellaneous/Global, and we create 4 globals with the names; DirF, DirB, DirR, DirL.

Then we go back to the magic effects, lets start with the FlyingFwd, we add the following script to it:

GlobalVariable property DirF auto

Event OnEffectStart(Actor akCaster, Actor akTarget)
DirF.SetValueInt(1)
endEvent


Event OnEffectFinish(Actor akCster, Actor akTarget)
DirF.SetValueInt(0)
EndEvent

Pick the name you want and extend it on ActiveMagicEffect, then go to properties of the script and select DirF, look on the list for the global we created earlier or click autofill. Apply the same logic for the rest of the effects.

Then go to the FlyingRing effect and add the following script:

Scriptname __PlyFly extends activeMagicEffect

Armor property RingFF auto
Actor property Player auto
import utility
import form
import game
import debug
import ObjectReference
perk property NoFallDmg auto
Action property JumpS auto
GlobalVariable property DirF auto
GlobalVariable property DirB Auto
GlobalVariable property DirR auto
GlobalVariable property DirL Auto
float bearing
float elevation
float speed
float posx
float posy
float posz

Event OnEffectStart(Actor Player, Actor Caster)
Player = Game.GetPlayer()
Utility.SetIniFloat("fInAirFallingCharGravityMult:Havok",0)
if Player.IsEquipped(RingFF)
	while Player.IsEquipped(RingFF)
		Fly()
	endWhile
endIf
endEvent

function Fly()
if DirF.GetValueInt() == 1 || DirB.GetValueInt() == 1 || DirR.GetValueInt() == 1 || DirL.GetValueInt() == 1 
	posx = Player.GetPositionX()
	posy = Player.GetPositionY()
	bearing = Player.GetAngleZ()
	elevation = Player.GetAngleX()
	posz = Player.GetPositionZ()
	if Player.IsSprinting()
		speed = 2000
	else
		speed = 1000
	endIf
	if DirF.GetValueInt() == 1
		posx += math.sin(bearing)*speed
		posy += math.cos(bearing)*speed
		posz -= math.sin(elevation)*speed
	elseif DirB.GetValueInt() == 1
		posx -= math.sin(bearing)*speed
		posy -= math.cos(bearing)*speed
		posz += math.sin(elevation)*speed
	elseif DirL.GetValueInt() == 1
		posx += math.sin(bearing - 90)*speed
		posy += math.cos(bearing - 90)*speed 
		posz -= math.sin(elevation)*speed
	elseif DirR.GetValueInt() == 1
		posx += math.sin(bearing + 90)*speed 
		posy += math.cos(bearing + 90)*speed
		posz -= math.sin(elevation)*speed
	endIf
	Player = Game.GetPlayer()
	Player.TranslateTo(posx,posy,posz,bearing,0,elevation,speed,1)
else
	Player.StopTranslation()
endIf
endFunction

Event OnEffectFinish(Actor Player, Actor Caster)
Player.StopTranslation()
Utility.SetIniFloat("fInAirFallingCharGravityMult:Havok",1.35)
endEvent

Go to properties of this script and press auto-fill all.

Once you have all the effects with all the scripts, go to enchanments, look for an enchant that fortifies something, duplicate it, remove the content and add the 5 magic effects. Now in order to detect if you are moving forward,back, left or right I use the conditional functions the enchantment window provides, so when you add the FlyingFwd effect to the enchant, add the GetMovementDirection conditional == to 1, this way the effect will only trigger if you are moving forward.

1 = Forward; 2 = Right; 3 = Back; 4 = Left

And thats it, I made this to get my head away from the behavior stuff for a while, and it works perfect.

Edited by porroone
Link to comment
Share on other sites

Cool, will try it out :D

 

Edit: right on, makes it like your walking on a collision box in mid air at whatever height you managed to get yourself to before you started flying :D Works as advertised.

 

I guess it was supposed to be obvious, based on the property name, but the ring it's to be attached to, assuming you use auto fill is RingFF. I don't think that was in the explanation. Good stuff.

 

Goofy standing there, periodically (slowly) dropping a few units(like down the side of a mountain slow).. then a second later, dropping again, and again lol.

Edited by SinderionsBones
Link to comment
Share on other sites

Cool, will try it out :D

 

Edit: right on, makes it like your walking on a collision box in mid air at whatever height you managed to get yourself to before you started flying :D Works as advertised.

 

I guess it was supposed to be obvious, based on the property name, but the ring it's to be attached to, assuming you use auto fill is RingFF. I don't think that was in the explanation. Good stuff.

 

Goofy standing there, periodically (slowly) dropping a few units(like down the side of a mountain slow).. then a second later, dropping again, and again lol.

 

Run and you'll be able to go up and down by looking up or down.

Cool script by the way. Helped me with some bugs I had with my own scripts :)

Link to comment
Share on other sites

Here's an idea I haven't tested fully, but it might be fun to play with. The game considers you swimming if a water plane is above the camera. You can alter the underwater imod to look sort of like normal view but it's still different looking. Another issue is that you can't see the surface of water while you are "underwater". Anyway here is the idea...

 

Create a spell, ability, whatever that has a script that teleports an object reference of a water plane above the 3rd person camera (force third person on effect start too.) and forces it to follow the third person camera, staying above the camera.

 

That's really it. Make sure the water is small and the height relative to the camera is high so it's out of view and you're swimming wherever you want with collisions. I haven't done a follow script for the water yet but the concept is sound.

 

If anyone can alter the swim animations to flight and remove the imod for swimming it'd be perfect (edit: change swim speed too?), still no fighting while flying here though.

Edited by dontkeepscore
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...