Jump to content

How do loops work?


Hazardousbio

Recommended Posts

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 Game

import Debug

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

 

 

 

 

 

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

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

  • Recently Browsing   0 members

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