Jump to content

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


hex_ratt

Recommended Posts

@porroone:

Can i ask you some help ?

I try to use functions "Player.TranslateTo(0,0,0, 0,0,90, 100,90)" and "sendAnimationEvent(myPlayer,"AttackStart")" on my Actor an on NPC.

 

Player.TranslateTo(): work fine on NPS, but on Actor it only move but don't rotate him.

sendAnimationEvent(): it seems it doesn't work at all :(

 

What i need to check to make it work ?

Do I need SKSE for those functions to get it work ? (I don't use SKSE by now...)

Where i can look for animation graph event names like "AttackStart" ? (this name i get from Bethethda CK function example)

Link to comment
Share on other sites

  • Replies 304
  • Created
  • Last Reply

Top Posters In This Topic

Ok, neither the translation rotation or the SetAngle function will rotate your character, so forget about that, not happening. Then attackstart is an event that leads to other events which probably carries no animation, you need to try something like AttackStartLeftHand. You can find all the animation events defined on the CK's animation tab, go to character and under each action there are events defined, like ActionMoveStart ->anim-> moveStart. This last one is the one you need to call on the sendAnimationEvent.
Link to comment
Share on other sites

@porroone:

I found those event definitions you mentioned, but it strange that not all of them works. I try "JumpStandingStart","SpectatorClap" and it works, but "moveStart","AttackStartLeftHand" and many other doesn't. :(

(PS: maybe i do something wrong? I link my script on Trigger with event "OnTriggerEnter" and, when i stay on some point, my script begin to try to animate Actor or my summoned NPC)

 

I am confused - you say those function will not rotate my character, but in your script you use "TransleteTo()" to set direction of the flying man !

Why it work for you and doesn't work for me ??? :(

Link to comment
Share on other sites

Ok there are events on the graph that no matter how much u try to call them, they will either not work or crash your game, that is because those events are called from other events inside the behavior, and I really dont know a way around it ( I am trying something similar aswell with my dragon mount project ). With my script I do set the direction but if you check closely the character doesnt rotate itself, it stays always on the same angle, its the position that changes depending on the camera angle, so If I look up the character will move up at the same time it moves forward.
Link to comment
Share on other sites

Now i begin to understand something, thank you for your answer.

 

I would like to try to make some simple cut-scene with camera/actor movement. But it seems impossible to make it by now. It is sad.

Link to comment
Share on other sites

  • 2 weeks later...

Hello again folks, with the tools I have now I am getting to some crazy s***, I could say im scripting my own behavior now, so as always I like to make my work public and get some input, I will leave my latest script here:

Scriptname __PlyFly extends activeMagicEffect

Armor property RingFF auto
Armor property IceRingFF auto
Armor property FireRingFF auto
Armor property ShockRingFF auto

Actor property Player auto

import utility
import form
import game
import debug
import ObjectReference
import Math
import input
import CombatStyle
import spell
import ActorBase
imagespacemodifier property WarpDrive auto
int property Forward = 0x11 auto
int property Back = 0x1F auto
int property Left = 0x1E auto
int property Right = 0x20 auto
int property Up = 0x39 auto
int property Down = 0x1D auto
int property slow = 0x2A auto
int property fast = 0x38 auto
int property keepit = 0x2E auto
int property attackswitch = 0x13 auto
int property attackleft = 0x100 auto
int property attackright = 0x101 auto
int property combatstart = 0x2C auto
int property keepmoving = 0x2E auto

spell righthand
spell lefthand
spell property explodePlayer auto

int isfwdanim
int sprintanimc
int backanimc
int leftanimc
int rightanimc
int keepgoing
int attackaniml
int attackanimr
int attackanimd
int attackmode
int flyfwdup
int flyfwddw
float castingtime
float ringmagicka
float ringhealth
float ringstamina
float damage
float anglez
perk property NoFallDmg auto

float bearing
float elevation
float speed
float posx
float posy
float posz
float imagetime

bool flyup
bool flydown
bool idleplay
bool combatplay
bool removeperknow
bool checkbearing

float inctest
float realtime

Event OnEffectStart(Actor Player, Actor Caster)
Player = GetPlayer()
Player.AddPerk(NoFallDmg)
Notification(Player.GetActorBase().GetCombatStyle())
SetIniFloat("fInAirFallingCharGravityMult:Havok",0)
EnablePlayerControls()
ringmagicka = Player.GetAV("Magicka")
ringhealth = Player.GetAv("health")
if Player.IsEquipped(RingFF) || Player.IsEquipped(FireRingFF) || Player.IsEquipped(IceRingFF) || Player.IsEquipped(ShockRingFF)
	RegisterForSingleUpdate(0.1)
endIf
endEvent

Event OnUpdate()

if IsKeyPressed(Keepit)
	Keepgoing += 1
	if Keepgoing > 1
		Keepgoing = 0
		ReleaseKey(keepgoing)
	endIf
endIF
if Player.IsDead()
	DestroyRing()
endIF
if IsKeyPressed(Forward) || IsKeyPressed(Fast) || IsKeyPressed(Back) || IsKeyPressed(Left) || IsKeyPressed(Right) || IsKeyPressed(Up)  || IsKeyPressed(Down) || IsKeyPressed(KeepIt) || keepGoing == 1
	Player.SetAnimationVariableFloat("PitchManualOverride", Elevation)
	ToggleAnimAndMove()
else
	Player.StopTranslation()
	ReleaseKey(keepgoing)
endIf
if (IsKeyPressed(attackleft) || IsKeyPressed(attackright)) && attackmode == 1
	Combat()
else
	attackaniml = 0
	attackanimd = 0
	attackanimr = 0
	castingtime = 0
	Player.InterruptCast()
endIf
if !IsKeyPressed(Right) && !IsKeyPressed(Forward) && !IsKeyPressed(Left) && !IsKeyPressed(Back) && !IsKeyPressed(Up) && !IsKeyPressed(Down) && !Keepgoing && !IsKeyPressed(attackleft) && !IsKeyPressed(attackright)
	if IsKeyPressed(attackswitch)
		attackmode += 1
		if attackmode > 1
			attackmode = 0
		endIf
	endIf
	if attackmode == 1
		holdKey(combatstart)
		if combatplay == false
			sendAnimationEvent(Player, "eFlyingCombatIdle")
			idleplay = false
			combatplay = true
		endif
	endif
	if attackmode == 0
		if idleplay == false
			releaseKey(combatstart)
			sendAnimationEvent(Player, "eFlyingIdle")
			combatplay = false
			idleplay = true
		endif
	endif
	isfwdanim = 0
	sprintanimc = 0
	backanimc = 0
	leftanimc = 0
	rightanimc = 0
	attackaniml = 0
	attackanimd = 0
	attackanimr = 0
	flyup = false
	flydown = false
	Player.StopTranslation()
	Speed = 0
else
	idleplay = false
	combatplay = false
endIf
RegisterForSingleUpdate(0.1)
endEvent

function Combat()
if IsKeyPressed(attackleft) && !IsKeyPressed(attackright) && attackmode == 1 && Player.GetAV("Magicka") > 10 && Player.GetEquippedSpell(0)
	righthand = Player.GetEquippedSpell(0)
	if attackaniml == 0
		sendAnimationEvent(Player,"eFlyingAttackRight")
		attackaniml = 1
	endIf
	if castingtime == 0
		castingtime = GetCurrentRealTime() + righthand.GetCastTime() 
	endIf
	if castingtime < GetCurrentRealTime()
		righthand.Cast(Player)
		Player.DamageActorValue("Magicka",ringmagicka/75)
		castingtime = 0
	endIf
endIf
if !IsKeyPressed(attackleft) && IsKeyPressed(attackright) && attackmode == 1 && Player.GetAV("Magicka") > 10 && Player.GetEquippedSpell(1)
	lefthand = Player.GetEquippedSpell(1)
	if attackanimr == 0
		sendAnimationEvent(Player,"eFlyingAttackLeft")
		attackanimr = 1
	endIf
	if castingtime == 0
		castingtime = GetCurrentRealTime() + lefthand.GetCastTime() 
	endIf
	if castingtime < GetCurrentRealTime()
		lefthand.Cast(Player)
		Player.DamageActorValue("Magicka",ringmagicka/75)
		castingtime = 0
	endIf
endIf
if IsKeyPressed(attackright) && IsKeyPressed(attackleft) && attackmode == 1 && Player.GetEquippedSpell(0) && Player.GetEquippedSpell(1) && Player.GetAv("Magicka") > 10
	righthand = Player.GetEquippedSpell(1)
	lefthand = Player.GetEquippedSpell(0)
	if castingtime == 0
		if righthand.GetCastTime() == lefthand.GetCastTime()
			castingtime = GetCurrentRealTime() + righthand.GetCastTime()
		else
			castingtime = GetCurrentRealTime() + ((righthand.GetCastTime()+ lefthand.GetCastTime())/2)
		endIf
	endIf
	if castingtime < GetCurrentRealTime()
		righthand.Cast(Player)
		lefthand.Cast(Player)
		Player.DamageActorValue("Magicka",ringmagicka/45)
		castingtime = 0
	endIf
	if attackanimd == 0
		sendAnimationEvent(Player,"eFlyingAttackDual")
		attackanimd = 1
		attackaniml = 0
	endIf
else
	attackanimd = 0
	attackanimr = 0
	attackaniml = 0
endIf
if Player.GetAV("Magicka") < 10
	DestroyRing()
endIf
endFunction

Function ToggleAnimAndMove()
posx = Player.GetPositionX()
posy = Player.GetPositionY()
bearing = floor(Player.GetAngleZ())
elevation = Player.GetAngleX()
posz = Player.GetPositionZ()

if IsKeyPressed(Forward) || Keepgoing == 1
	if Keepgoing == 1
		HoldKey(keepmoving)
	endIF
	If IsKeyPressed(slow) 
		speed = 400
	elseif isfwdanim == 0 && checkbearing ==  true && flyfwdup == 0 && flyfwddw == 0 && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft) && !IsKeyPressed(Fast) && !IsKeyPressed(Back) && !IsKeyPressed(Left) && !IsKeyPressed(Right) && !IsKeyPressed(Up)  && !IsKeyPressed(Down)
		sendAnimationEvent(Player,"eFlyingForward") 
		speed = 1000
		sprintanimc = 0
		isfwdanim = 1
	elseif sprintanimc == 0  && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft) && IsKeyPressed(Fast) && !IsKeyPressed(Back) && !IsKeyPressed(Left) && !IsKeyPressed(Right) && !IsKeyPressed(Up)  && !IsKeyPressed(Down)
		sendAnimationEvent(Player,"eFlyingSprint")
		speed = 2000
		isfwdanim = 0
		sprintanimc = 1
	elseif IsKeyPressed(attackright) || IsKeyPressed(attackleft)
		speed = 1000
	endif
	if Elevation > 10 || Elevation < -10
		if Elevation > 10 && flyfwdup == 0
			sendAnimationEvent(Player,"eFlyingForwardUp")
			flyfwdup = 1
			flyfwddw = 0
			isfwdanim = 0
		EndIf
		if Elevation < -10 && flyfwddw == 0
			sendAnimationEvent(Player,"eFlyingForwardDown")
			flyfwddw = 0
			flyfwdup = 1
			isfwdanim = 0
		EndIf
	Else
		flyfwdup = 0
		flyfwddw = 0
	EndIf
	if checkbearing == false
		anglez = floor(Player.GetAngleZ())
		checkbearing = true
	endIf
	if checkbearing == true && flyfwdup == 0 && flyfwddw == 0
		if anglez > bearing + 20
			sendAnimationEvent(Player,"eFlyingForwardLeft")
			checkbearing = false
			isfwdanim = 0
		endif
		if anglez < bearing - 20
			sendAnimationEvent(Player,"eFlyingForwardRight")
			checkbearing = false
			isfwdanim = 0
		endIf
	endIf
	posx += sin(bearing)*(speed*5)
	posy += cos(bearing)*(speed*5)
	posz -= sin(elevation)*(speed*5)
else
	isfwdanim = 0
	sprintanimc = 0
	imagetime = 0
	checkbearing = false
endif
if IsKeyPressed(Back)
	If IsKeyPressed(slow) 
		speed = 200
	elseif backanimc == 0 && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft) && !IsKeyPressed(Forward) && !IsKeyPressed(Left) && !IsKeyPressed(Right) && !IsKeyPressed(Up) && !IsKeyPressed(Down)
		sendAnimationEvent(Player,"eFlyingBack")
		speed = 600
		backanimc = 1
	elseif IsKeyPressed(attackright) || IsKeyPressed(attackleft)
		speed = 600
	endif
	posx -= sin(bearing)*(speed*5)
	posy -= cos(bearing)*(speed*5)
	posz += sin(elevation)*(speed*5)
else
	backanimc = 0
endif
if IsKeyPressed(Left) 
	If IsKeyPressed(slow) 
		speed = 200
	elseif leftanimc == 0 && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft) && !IsKeyPressed(Forward) && !IsKeyPressed(Back) && !IsKeyPressed(Right) && !IsKeyPressed(Up) && !IsKeyPressed(Down)
		sendAnimationEvent(Player,"eFlyingLeft")
		leftanimc = 1
		speed = 600
	elseif IsKeyPressed(attackright) || IsKeyPressed(attackleft)
		speed = 600
	endif
	posx += sin(bearing - 90)*(speed*5)
	posy += cos(bearing - 90)*(speed*5)
	posz -= sin(elevation)*(speed*5)
else
	leftanimc = 0
endif
if IsKeyPressed(Right) 
	If IsKeyPressed(slow) 
		speed = 200
	elseif rightanimc == 0 && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft) && !IsKeyPressed(Forward) && !IsKeyPressed(Left) && !IsKeyPressed(Back) && !IsKeyPressed(Up) && !IsKeyPressed(Down)
		sendAnimationEvent(Player,"eFlyingRight")
		rightanimc = 1
		speed = 600
	elseif IsKeyPressed(attackright) || IsKeyPressed(attackleft)
		speed = 600
	endif
	posx += sin(bearing + 90)*(speed*5)
	posy += cos(bearing + 90)*(speed*5)
	posz -= sin(elevation)*(speed*5)
else
	rightanimc = 0
endif
if IsKeyPressed(Up) 
	if flyup == false && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft) && !IsKeyPressed(Right) && !IsKeyPressed(Forward) && !IsKeyPressed(Left) && !IsKeyPressed(Back) && !IsKeyPressed(Down)
		sendAnimationEvent(Player,"eFlyingUp")
		flyup = true
	endIf
	If IsKeyPressed(slow)
		speed = 600
	else
		speed = 1000
	endif
	posz += speed*5
else
	flyup = false
endif
if IsKeyPressed(Down)
	if flydown == false && !IsKeyPressed(attackright) && !IsKeyPressed(attackleft)  && !IsKeyPressed(Up) && !IsKeyPressed(Right) && !IsKeyPressed(Forward) && !IsKeyPressed(Left) && !IsKeyPressed(Back)
		sendAnimationEvent(Player,"eFlyingDown")
		flydown = true
	endIf
	If IsKeyPressed(slow)
		speed = 600
	else
		speed = 1000
	endif
	posz -= speed*5
else
	flydown = false
endif
Player.TranslateTo(posx,posy,posz,bearing,0,elevation,speed,1)
endFunction

Function DestroyRing()
Debug.Notification("The ring explodes consumed by flames.")
Player.DamageActorValue("Health",ringhealth/2)
removePerkNow = true
ReleaseKey(combatstart)
explodePlayer.Cast(Player)
Player.StopTranslation()
if Player.IsEquipped(RingFF)
	Player.RemoveItem(RingFF)
EndIf
if Player.IsEquipped(FireRingFF)
	Player.RemoveItem(FireRingFF)
EndIf
if Player.IsEquipped(IceRingFF)
	Player.RemoveItem(IceRingFF)
EndIf
if Player.IsEquipped(ShockRingFF)
	Player.RemoveItem(ShockRingFF)
endIf
endFunction

Event OnEffectFinish(Actor Player, Actor Caster)
Player.StopTranslation()
UnregisterForUpdate()
SetIniFloat("fInAirFallingCharGravityMult:Havok",1.35)
ReleaseKey(CombatStart)
sendAnimationEvent(Player,"moveStop")
if removeperknow == false
	RemoveFallPerk()
Else
	Player.RemovePerk(NoFallDmg)
endIf
endEvent

Function RemoveFallPerk()
Debug.Notification("You have 5 seconds of no falling damage.")
Wait(5)
Player.RemovePerk(NoFallDmg)
endFunction

 

I am looking for somebody to join me get this better, with the knowledge I have now, the only thing I lack is time to implement it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...