Jump to content

[LE] MiscUtil and ToggleFreeCamera() issue - need some advices


Hoamaii

Recommended Posts

Hey guys,

Any of you has successfully used PapyrusUtil's function "ToggleFreeCamera()"?

(actually, it's a MiscUtil function which is part of the PapyrusUtil skse plugin).

It works to a certain extent: it does change camera from 3rd Person state to the "freeFly" state when first used, and then turns it back to 3rd Person when used again BUT after that, the player is unable to fight.

 

All other controls work fine except drawing a weapon, casting a spell and combat. The game behaves as if Fighting Controls were disabled even though debugging "Game.IsFightingControlsEnabled()" returns true.

 

Reloading a previous save made before using that function is not enough to fix it. It looks like using that "ToggleFreeCamera()" function somehow modifies a game setting which sticks in your game no matter what save you load.

 

I can't read .dll's so I'm completely clueless as to what this function does under the hood.

 

Any clue, input or advice about what may be going on would be greatly appreciated, many thanks in adance :)

Link to comment
Share on other sites

Good to know I'm not the only one... I finally gave up too and resolved to add a debug function to my mod to restore default when users accidentally exit animations while still in freeCam state.

 

SL found a way to get it working though (at least when I tested it), but even though I'm using it exactly the same way they do, can't get it to work as it should. I left a message inPapyrusUtil for its author, if he ever answer me, I'll update this topic.

 

Thanks for your answer, maxarturo :)

Link to comment
Share on other sites

" add a debug function to my mod to restore default when users accidentally exit animations "

I'm not a professional coder but i'm a self teach scripter, my scripting abilities are good enough to allow me to create whatever i have in mind, but there are some things than i don't know, like papyrus debug trace functions ( which i've seen them been mentioned a lot lately ).

 

Could you explain me in few words what those actually do and how they are written, not too much in www.creationkit.com about it, and for what i can understand they are use a lot in scripts that forced the Player to do an animation " Debug.SendAnimationEvent() ", which i'm using in some of my scripts.
* I know that this is unrelated to your topic and i apologise for it !.
Thank you very much in advance !.
Link to comment
Share on other sites

Hey Max,

Well, I hardly ever use debug trace functions, when testing a mod I much prefer using Notifications or MessageBox so that I can directly check in game whether some functions have been properly called and work. I'm certainly not a professionel coder either, what little I know about Papyrus I've learnt mod after mod through the years, starting small and slow with DarkFox127's videos in fact, and the rest with the CK wiki or other modders' help in the forums :cool:

Lately, I managed to finally find the tools (and the time) to learn animations and I'm presently working on scripts to implement these new custom animations in game with a spell. Using, as you've guessed, "Debug.SendAnimationEvent(PlayerRef, "whateverAnimationEvent") to call my anims. Many times, testing them I switch to free camera in console to have a closer look at actors' positions and movements and more often than not when I exit the animation I forget to toggle FreeCam off and of course find my PC stuck. It very often happens to users too. I've been looking for a function to let my script do that for me and I thought PapyrusUtil's function would do the trick reliably.

 

I thought it'd be pretty cool too to toggle FreeCam on at the beginning of the anim if users wanted to, but obviously that doesn't work either for the same reason.

What I meant was, since "ToggleFreeCamera()" can't seem to do that, I needed a workaround to restore default AI and idle after accidentally exiting in FreeFly cam state. The way I'm doing it now is actually pretty cheap:

- in my "exitAnimation", I check camera state with "If Game.GetCameraState() == 3", if it returns true, I know the player has forgotten to turn freeCam off. If "true", I just call a "Debug.MessageBox("...")" which displays on screen to let users know how to remedy that instead of freaking out because they're stuck.

 

- what that message tells is basically: "console command TFC" to exit freecam, and then instruct them to use another function I added to my MCM menu which I called "Animation Debug". This "animation debug" function is pretty simple too: it first makes sure my anim spell has been dispelled, then makes sure player's AI and Controls have been fully restored before calling "PlayerRef.MoveTo(PlayerRef)" and "Debug.SendAnimationEvent(PlayerRef, "IdleForceDefaultState"). It's in fact the "MoveTo" function which sort of pulls back the player in full control of its displayed character. (of course, I tried this in many various ways after "ToggleFreeCamera()" too, but no matter how I script it, fighting controls are still lost).

 

I was really hoping "ToggleFreeCamera()" would avoid having to use Console Commands to restore their camera - that would have been much more satisfying to let the script do all the work. But so much for that...

 

One more thing, if you're interested about animations and camera, is very often you'll need to disable player's AI and controls for him to stay in the proper position, or prevent him to accidentally activate some furniture or activator around that may interfere with your script, or (in my case) because I wanted to "registerForControl" so that the activation control is used to call my "exit animation". What happens is disabling player's movements also disables UI, at least partially, crosshair and compass are gone for instance, and the game is hard-coded so that other actors cannot attack a player with disabled movements. At first I thought that's what was possibly preventing "ToggleFreeCamera()" to fully restore camera control - but calling "IsFightingControlEnabled()" and "IsMovementControlEnabled()" returned true so that was not it - and obviously, in game, movements were working fine.

 

Anyway, that's what I meant by using "debug", that lots of other functions can help you debug a script, some are Game functions, or Utility functions, or Actor functions, and Debug functions too of course.

 

I hope that answers your question - and sorry for the clumsy English, not my native language. Cheers :smile:

Link to comment
Share on other sites

Thank you very much for your detailed post.


This clarified me something that i had a wrong impression born from reading a post from a supposed professional coder. That Debug Function can clean - restore - fix the script itself, like an internal proccess. Nowhere near close to the truth.


* He turned out to be just a show off...
Link to comment
Share on other sites

  • Recently Browsing   0 members

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