Spoiler
Scriptname CQCrimeOverhaulUpdateScript extends Quest Quest Property CQCrimeOverhaul Auto Actor Property PlayerRef AutoImport UtilityImport MathFloat x2_plus_y2Float xFloat yFloat x1Float x2Float y1Float y2Float distance Event OnInit() x1=PlayerRef.GetPositionX() ;Gets the player's starting position in the x-y plane. y1=PlayerRef.GetPositionY() RegisterForSingleUpdate(1.0)EndEventEvent OnUpdate() Wait(10.0) x2=PlayerRef.GetPositionX() ;Waits and then gets the player's new position. y2=PlayerRef.GetPositionY() x=x1-x2 ;Calculate the distance between the two points. x=x*x y=y1-y2 y=y*y x2_plus_y2=x+y distance=sqrt(x2_plus_y2) if distance>100 ;If the player has moved over 100 units away from the starting position CQCrimeOverhaul.Stop() ;refresh aliases and set new starting position. CQCrimeOverhaul.Start() x1=PlayerRef.GetPositionX() y1=PlayerRef.GetPositionY() RegisterForSingleUpdate(1.0) endIf RegisterForSingleUpdate(1.0) ;Otherwise loop and repeat calculation with new second position.EndEvent