kitcat81 Posted December 27, 2016 Share Posted December 27, 2016 (edited) Guys, I need some help. The problem is with the .enable() function that I used for my activator script. I need my object to pop up (not to fade in) when some certain events happen. I tried different ways of implementing it :MyObject.Enable()orMyObject.Enable(false)orMyObject.EnableNoWait() Any of these variants work just fine but only until I quit the game. Restarting the game makes my object behave like it was set to fade it (enable(true)) . The only way I`ve found to fix it is to enter the workshop mode . it somehow magically fixes this bug and my object starts to act properly accorfing to it`s script. I was trying to find that magic function in WorkshopSript and WorkshopParentScript to fix this bug by calling this function from my script (without starting the workshop mode), but no results. Maybe someone else has ideas about it, I can`t imagine what type of function can potentially fix such kind of issue. This is not something gamebreaking but it`s imprtant for my mod visuals as it was supposed to immitate an animation. Edited December 27, 2016 by kitcat81 Link to comment Share on other sites More sharing options...
steve40 Posted January 2, 2017 Share Posted January 2, 2017 There's no such bug, I've never had any issues with enabling or disabling objects, with or without fade-in. Maybe it's a problem with your script or implementation. Link to comment Share on other sites More sharing options...
kitcat81 Posted January 2, 2017 Author Share Posted January 2, 2017 (edited) There's no such bug, I've never had any issues with enabling or disabling objects, with or without fade-in. Maybe it's a problem with your script or implementation.I doubt there is any problem with my script, it does not do anything special apart from disabling, moving and enabling some static object . The script is attached to activator. And it works fine , the bug appears only after quitting the game and restarting it.. Object fades in instead of popping in. The bug dissapears after entering the workshop. I found a way around it just by using another object that does not flicker after setting it`s position. Disabling and Enabling functions were used to make the static object not flicker after changing it`s position. Was something like this: Event MySecretScript.kTrigger(MySecretScript akSender, Var[] akArgs) MyObject.Disable() MyObject.SetPosition(x,y,z) MyObject.SetAngle(x,y,z) MyObject.Enable() Edited January 2, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
steve40 Posted January 2, 2017 Share Posted January 2, 2017 (edited) Wiki: "Using MoveTo, or any of the other Move function, on a Static can cause flickering on the model edges and blurring of the texture. To combat this, immediately call a disable() then enable() on the model to force it to reload in the new position." I expect that also applies to functions like SetPosition and SetAngle. An alternative solution would be to delete the object then respawn it in the desired position. Another option might be to make the object as a movable static instead of a static. A further solution would be to register for remote event OnPlayerLoadGame(), then have an event Actor.OnPlayerLoadGame() that does a disable/enable on your object. Event OnLoad() Self.RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") ResetFlicker() EndEvent Event OnUnload() Self.UnregisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") EndEvent Event Actor.OnPlayerLoadGame(Actor akSender) ResetFlicker() EndEvent Function ResetFlicker() Self.UnregisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") Utility.Wait(0.3) ; this small pause fixes an issue caused by fast travelling Self.Disable(False) Self.Enable(False) Self.RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") EndFunctionDoing this ^ should fix the glitch by resetting the objects whenever the game is restarted. Edited January 2, 2017 by steve40 Link to comment Share on other sites More sharing options...
kitcat81 Posted January 3, 2017 Author Share Posted January 3, 2017 (edited) Wiki: "Using MoveTo, or any of the other Move function, on a Static can cause flickering on the model edges and blurring of the texture. To combat this, immediately call a disable() then enable() on the model to force it to reload in the new position." I expect that also applies to functions like SetPosition and SetAngle. An alternative solution would be to delete the object then respawn it in the desired position. Another option might be to make the object as a movable static instead of a static.Thank you for trying to help Steve. I had read this and this is why I used disable and enable. It fixed the flickering but as I said after fully quitting and realoading it started to fade in instead of popping in. I was wondering if it`s possible to call some function to fix this "fade in" error without entering the workshop . Respawining could be a solution but to respawn an object I also need to disable it after respawning so I can set it`s position and angle, then to enable. Did not try this as I decided to go more relible way with using another type of object that does not flicker. Edited January 3, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted January 3, 2017 Share Posted January 3, 2017 (I'm horrible at scripting, but having said that...)Self.Disable()Self.Enable()At the end of each activation of the activator script? Edit: don't need the "self." anymore, but anh, oh well.Edit2: Hmm, not sure I really get what you're trying to do (my brain is long gone today after dealing with trigger scripts all day myself), so never mind me. =P Link to comment Share on other sites More sharing options...
kitcat81 Posted January 3, 2017 Author Share Posted January 3, 2017 (edited) (I'm horrible at scripting, but having said that...)Disable.selfEnable.selfAt the end of each activation of the activator script? Edit: don't need the ".self" anymore, but anh, oh well.Edit2: Hmm, not sure I really get what you're trying to do (my brain is long gone today after dealing with trigger scripts all day myself), so never mind me. =P :D no problem. Thanks for yout input. I have an activator that is registered for some custom event. And when it recieves the event, it should move some another linked object ( change it`s angle and position). It`s interesting what is the magic about entering the workshop and what exactly it does that fixes the "fade in" glitch. Is there a way to check if the object is persistent or loaded in memory? Edited January 3, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
steve40 Posted January 3, 2017 Share Posted January 3, 2017 (edited) Fadingsignal's Campfire mod does similar to what you are doing. Have a look at CampingKit_UtilityFunctions.psc in his mod. I don't know if his mod suffers from the same fade-in bug after reloading the game?He added a short wait in between disabling/enabling his objects, even though Disable/Enable are meant to wait for the object's 3D to unload or load. Maybe you could try adding a 'wait' in there: Function ResetObject(ObjectReference objectToReset) Global ;When moving objects, they become blurry due to weird positional z-fighting with the textures ;Disabling and Enabling the object stops this, so we run this last after our positional changes objectToReset.Disable(False) Utility.Wait(0.02) objectToReset.Enable(False) EndFunction Edited January 3, 2017 by steve40 Link to comment Share on other sites More sharing options...
kitcat81 Posted January 3, 2017 Author Share Posted January 3, 2017 (edited) Fadingsignal's Campfire mod does similar to what you are doing. Have a look at CampingKit_UtilityFunctions.psc in his mod. I don't know if his mod suffers from the same fade-in bug after reloading the game?He added a short wait in between disabling/enabling his objects, even though Disable/Enable are meant to wait for the object's 3D to unload or load. Maybe you could try adding a 'wait' in there: Function ResetObject(ObjectReference objectToReset) Global ;When moving objects, they become blurry due to weird positional z-fighting with the textures ;Disabling and Enabling the object stops this, so we run this last after our positional changes objectToReset.Disable(False) Utility.Wait(0.02) objectToReset.Enable(False) EndFunction Thank you again ! Well, I already have sorted it by changing the object that does not need disabling it, so it`s all fine now :smile: But If I need some more object like this I`ll try to add a short delay. But It all worked really fine and got bugged only after quiiting the game ( when you close the game menu , not just loading another save). I think the reason is that something was not loading properly. Some script info was dumped. And re-enting the workshop refreshed it. This is a minor bug realy and I think many people would not even notice it. It was just important for me because I wanted this object to look like it turns and even a short disappearing was unacceptable. Edited January 3, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
Recommended Posts