Hazardousbio Posted February 29, 2012 Share Posted February 29, 2012 So i wrote code for a spell to create an activator and rise it up and suck all enemies into it. Here it is, but it wont update :( Scriptname VortexUplift extends ActiveMagicEffect import Gameimport Debugfloat HeightActor CasterActorActor TargetActorObjectReference MarkerRef Event OnEffectStart(actor Target, actor Caster)CasterActor=CasterTargetActor=TargetMarkerRef = Caster.PlaceAtme(MovingMarker)Height=0 EndEvent Event OnUpdate() if Height<MaximumHeight Height+=10 MarkerRef.moveto(CasterActor,0,0,Height) TargetActor.SetPosition(TargetActor.GetPositionX(),TargetActor.GetPositionY(),TargetActor.GetPositionZ()+Height) MarkerRef.PushActorAway(TargetActor, PushForce) MessageBox("Script VortexUplift is still calculating:"+Height+" Which is less than "+MaximumHeight) RegisterForSingleUpdate(0.2) else MessageBox("Script VortexUplift Has finished") Endif EndEvent int Property PushForce Auto {Must be a negative Integer}int Property MaximumHeight Auto{How High should your enemies be sucked up?}Activator Property MovingMarker Auto {This is the Form used to be lifted} LeveledActor Property PlaceYes Auto LeveledActor Property PlaceNo Auto --------------------------------------- Link to comment Share on other sites More sharing options...
Cipscis Posted February 29, 2012 Share Posted February 29, 2012 An object does receive updates if it's not registered for updates. P.S. When posting scripts, please use code tags. This makes the script displayed with a fixed-width font, and maintains formatting like indentation. For example:Scriptname VortexUplift extends ActiveMagicEffect Import Game Import Debug int Property PushForce Auto {Must be a negative Integer} int Property MaximumHeight Auto {How High should your enemies be sucked up?} Activator Property MovingMarker Auto {This is the Form used to be lifted} LeveledActor Property PlaceYes Auto LeveledActor Property PlaceNo Auto float Height Actor CasterActor Actor TargetActor ObjectReference MarkerRef Event OnEffectStart(actor Target, actor Caster) CasterActor = Caster TargetActor = Target MarkerRef = Caster.PlaceAtme(MovingMarker) Height = 0 EndEvent Event OnUpdate() If (Height < MaximumHeight) Height += 10 MarkerRef.MoveTo(CasterActor, 0, 0, Height) TargetActor.SetPosition(TargetActor.GetPositionX(), TargetActor.GetPositionY(), TargetActor.GetPositionZ()+Height) MarkerRef.PushActorAway(TargetActor, PushForce) MessageBox("Script VortexUplift is still calculating:" + Height + " Which is less than " + MaximumHeight) RegisterForSingleUpdate(0.2) else MessageBox("Script VortexUplift Has finished") Endif EndEvent Cipscis Link to comment Share on other sites More sharing options...
jimhsu Posted February 29, 2012 Share Posted February 29, 2012 Don't know what exactly you're trying to do, but wouldn't using While (Height < MaximumHeight) ... be more efficient? Link to comment Share on other sites More sharing options...
porroone Posted February 29, 2012 Share Posted February 29, 2012 Yes I will advice to use while instead of OnUpdate, the second tends to pile up s*** you dont need when the OnUpdate triggers before it ran all the code. Link to comment Share on other sites More sharing options...
Hazardousbio Posted March 1, 2012 Author Share Posted March 1, 2012 Ahhh! Good idea. I havent really used a while before. Mostly if statements. Thanks so much guys! Link to comment Share on other sites More sharing options...
Recommended Posts