function InitTokyoScript () print("initing Crusty TokyoScript pickup") print("Loading all my models...") TokyoScriptPickup = Object.LoadModel("Pickups\\Script.rom") print("creating rotation") TokyoScriptRotation = Object.CreateRotation(0.0,2.0) end function CreateTokyoScript(id) return coroutine.create(UpdateTokyoScript) end function UpdateTokyoScript(myID) local dt=0 local reason=0 local time=0 local closeto=false local collected = false print("Creating the orbit") local orbit = Object.CreateScriptedObject("Tokyo\\TokyoScriptOrbit",Object.GetPosition(myID)) print("Setting the model") Object.SetModel(myID,TokyoScriptPickup) Object.SetRotation(myID,TokyoScriptRotation) Object.CreateSphereTouchfield(myID,0,0,0,1.4) Object.UpdateOnSphereTouchfield(myID,true) Object.SetUpdateRate(myID,0) Object.AddToCamBox(myID) while true do dt,reason = coroutine.yield() if collected == false and reason == 1 then Sound.PlaySoundEnv3D("pickup",Object.GetPosition(myID)) Object.SetCollected(myID,0) Object.UpdateOnSphereTouchfield(myID,false) Object.ClearModel(myID) Object.ClearModel(orbit) Object.Deactivate(myID) Object.Deactivate(orbit) collected = true end end end