TobiaszPL Posted March 23, 2019 Posted March 23, 2019 Now im making Script to Move Camera :) Camera should move if player enter new place first time to show this place Also on Arena if Boss was spawned first time so i want to show boss name and move camera to him and also it help me with my EmpireBuilder lel ! so player may just see how next upgrade will look from air but now first script UGH here is Script: Scriptname QLG_Script_MoveCam extends ObjectReference FormList Property QCamMarkers auto { Where Camera should move } Actor Property QPlayer auto { Player Ref. req. } Float Property CamSpeed auto { Camera Speed } Event OnActivate( ObjectReference QRef ) If QRef == QPlayer QPlayer.SetAlpha(0.0) QPlayer.SetGhost(True) Game.DisablePlayerControls(True, True, True, true, True, False, True) Int I = QCamMarkers.GetSize() Float QDistance = 0.0 While ( I >= 0 ) I -= 1 QDistance = QPlayer.GetDistance( QCamMarkers.GetAt( I ) as ObjectReference ) QPlayer.TranslateToRef( QCamMarkers.GetAt( I ) as ObjectReference , CamSpeed ) Game.SetCameraTarget( QCamMarkers.GetAt( I ) as Actor ) Utility.Wait( QDistance / CamSpeed ) EndWhile QPlayer.SetAlpha(1.0) QPlayer.SetGhost(False) Game.EnablePlayerControls() EndIf EndEvent This script move Camera from Point to Point and its ok BUT 1) if player is in Air he is jumping each 2/3 sec in air- can i change player to bucket? they can't jump xD 2) Script can't rotate Camera... i tried many ways but nothing is working i just can't rotate this F**g camera to target... this what i write and show is only for test xD
ReDragon2013 Posted March 23, 2019 Posted March 23, 2019 bad condition While ( I >= 0 )bad method, not working here Game.SetCameraTarget( QCamMarkers.GetAt( I ) as Actor )I changed the code as follow, but cannot give you a better way for camera focusQLG_Script_MoveCam Scriptname QLG_Script_MoveCam extends ObjectReference ; https://forums.nexusmods.com/index.php?/topic/7504971-what-is-wrong-with-my-script-5/ FormList PROPERTY QCamMarkers auto { Where Camera should move, XMarkers are already placed to Skyrim world } Float PROPERTY fCamSpeed auto { Camera Speed } ; -- EVENTs -- EVENT OnActivate(ObjectReference akActionRef) IF (Game.GetPlayer() == akActionRef as Actor) ELSE RETURN ;- STOP - not the player ENDIF ;-------------------- gotoState("Busy") ; ### STATE ### myF_Action(akActionRef as Actor) gotoState("") ; ### STATE ### back to no state ENDEVENT ;=================================== state Busy ;========= EVENT OnActivate(ObjectReference akActionRef) ; prevent triggering of this event while doing cam action ENDEVENT ;======= endState ; -- FUNCTION -- ; https://www.creationkit.com/index.php?title=DisablePlayerControls_-_Game ; https://www.creationkit.com/index.php?title=SetCameraTarget_-_Game ; https://www.creationkit.com/index.php?title=SetDontMove_-_Actor ;-------------------------------- FUNCTION myF_Action(Actor player) ;-------------------------------- Game.DisablePlayerControls(TRUE, TRUE, TRUE, TRUE, TRUE, False, TRUE, False) ; Disable player controls ;;; player.SetDontMove(TRUE) ; disables player movement, camera switching, and camera rotating player.SetGhost(TRUE) ; * make him ghosted player.SetAlpha(0.0, False) ; ** make player invisible, no fading out ; --------------------------- int i = QCamMarkers.GetSize() ; get size of formlist, top/down list WHILE (i > 0) i = i - 1 objectReference oRef = QCamMarkers.GetAt(i) as ObjectReference ; get next camera position IF ( oRef ) ; make sure Reference is valid float f = player.GetDistance(oRef) player.TranslateToRef(oRef, fCamSpeed) ; move player to xMarker with speed of ; Attention: next will not work, xMarker cannot be an actor !! ;;; IF oRef.IsDisabled() ;;; oRef.EnableNoWait() ; specifying a disabled Ref will result in a CTD after SetCameraTarget() ;;; ENDIF ;;; Game.SetCameraTarget(oRef as Actor) ; sets an Actor (as the current target) for the players camera. f = f / fCamSpeed ; adjust the waittime by speed of camera Utility.Wait(f) ELSE Utility.Wait(1.0) ; failsafe wait ENDIF ENDWHILE ; --------------------------- player.SetAlpha(1.0, False) ; ** make player visible again, no fading in player.SetGhost(False) ; * remove the ghost flag ;;; player.SetDontMove(False) Game.EnablePlayerControls(TRUE, TRUE, TRUE, TRUE, TRUE, False, TRUE, False) ; Enable player controls ENDFUNCTION
TobiaszPL Posted March 23, 2019 Author Posted March 23, 2019 ; Attention: next will not work, xMarker cannot be an actor !! How about this ? :) Actor QTempActor QTempActor.SetPosition( ( QCamMarkers.GetAt( I ) as ObjectReference ).GetPositionX(), ( QCamMarkers.GetAt( I ) as ObjectReference ).GetPositionY(), ( QCamMarkers.GetAt( I ) as ObjectReference ).GetPositionZ() ) Game.SetCameraTarget( QTempActor ) can't test this script on my PC now xDbut how about this ? :D will it work ? :P
Recommended Posts