KingFeraligatr Posted July 12, 2014 Share Posted July 12, 2014 I have written a script to constantly reset an actor's Essential status to "true" no matter what. I wrote it because I know people are crafty and I'm a bit paranoid about people setting the Essential status of someone I've deemed permanently Essential to "false". Now the script works well as intended, but I did it sort of sloppy. The "reset essential" part of the script is stuck in an unbreakable while loop (intentional for now) and it makes the script processed constantly. This in turn cause quite a bit of script lag. Here's the source:Scriptname z_reset_essential extends Actor{constantly makes an actor essential};can't say I like how this script works right now. It hogs other scripts' processing and slows down script proccesing in general. I'd like some help with making;this script better. Tell me if you know a better way to make this idea work.;actor SelfRefint looping = 1Event OnInit() ;continuous checking startRegisterForSingleUpdate (1.0)EndEventEvent OnUpdate()ActorBase myself = GetActorBase () as ActorBaselooping = 1while( looping != 0 || looping == 0 );this creates the endless loop. this unbreakable while loop is intentional until I can find a better way to do thislooping = 1if( myself.IsEssential () == false );here's the the essential checkmyself.SetEssential (true)endifendwhileRegisterForSingleUpdate (1.0)EndEvent----------------I'd like some help optimizing the script so it doesn't hog up script processing while still achieving the effect of making an actor constantly Essential not matter what the circumstance with the script being unable to be broken. Anything you can contribute would be nice. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now