function InitNYDrugs () print("initing Crusty NYDrugs pickup") print("Loading all my models...") NYDrugsPickup = Object.LoadModel("Pickups\\Drugspackage.rom") print("creating rotation") NYDrugsRotation = Object.CreateRotation(0.0,2.0) end function CreateNYDrugs(id) return coroutine.create(UpdateNYDrugs) end function UpdateNYDrugs(myID) local dt=0 local reason=0 local time=0 local closeto=false local collected = false print("Creating the orbit") local orbit1 = Object.CreateChildScriptedObject(myID,"NewYork\\NYDrugsOrbit1",Object.GetPosition(myID)) local orbit2 = Object.CreateChildScriptedObject(myID,"NewYork\\NYDrugsOrbit2",Object.GetPosition(myID)) print("Setting the model") Object.SetModel(myID,NYDrugsPickup) Object.SetRotation(myID,NYDrugsRotation) Object.CreateSphereTouchfield(myID,0,0,0,1.4) Object.SetBob(myID,0.2,0.02) 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 Object.SetCollected(myID,0) Object.UpdateOnSphereTouchfield(myID,false) Object.ClearModel(myID) Object.ClearModel(orbit1) Object.Deactivate(myID) Object.Deactivate(orbit1) Object.ClearModel(myID) Object.ClearModel(orbit2) Object.Deactivate(myID) Object.Deactivate(orbit2) collected = true end end end