-- Checkpoint Marker script -- o Create a checkpoint marker object, initially in a deactiavted ( red colour ) state -- o On receiving an ACTIVATE message, becomes actives and changes colour to green -- o On receiving a DEACTIVATE message, becomes deactivated and changes colour to red -- o Sends a COLLECT message when the player gets near and the markers is in the active state function InitCheckpointMarker() print("Initing Crusty CheckpointMarker pickup") CheckpointArrowModel = Object.LoadModel("Pickups\\Checkpoint_Arrow.rom") end function CreateCheckpointMarker(myID) return coroutine.create(UpdateCheckpointMarker) end function UpdateCheckpointMarker(myID) local dt=0 local reason=0 local x,y,z=Object.GetPosition(myID); y = y + 2.75 Object.SetModel(myID,CheckpointArrowModel) local Orbit1ID=Object.CreateChildScriptedObject(myID,"CheckpointMarkerOrbit1",x,y,z) local Orbit2ID=Object.CreateChildScriptedObject(myID,"CheckpointMarkerOrbit2",x,y,z) Object.CreateSphereTouchfield(myID,0,0.5,0,3.00) Object.UpdateOnReceiveMessage(myID,true) Object.SetUpdateRate(myID,0) Object.SendEventToObject(Orbit1ID,5) Object.SendEventToObject(Orbit2ID,5) Object.UpdateOnSphereTouchfield(myID,false) while true do dt,reason = coroutine.yield() if reason == 1 then -- spheretouch Object.SetCollected(myID,0) elseif reason == 4 then -- activate Object.SendEventToObject(Orbit1ID,4) Object.SendEventToObject(Orbit2ID,4) Object.UpdateOnSphereTouchfield(myID,true) elseif reason == 5 then -- deactivate Object.SendEventToObject(Orbit1ID,5) Object.SendEventToObject(Orbit2ID,5) Object.UpdateOnSphereTouchfield(myID,false) end end end