-- Script to handle a cancun golf cart -- -- This object will -- o Create a golf cart model -- o Become 'collected' when the cart hits the ground after a big fall -- -- *WARNING* -- This script is currently hardocoded to player/viewport 0. It won't -- work in a multiplayer environment. If this is required, the script will -- need to be extended. function InitCancunGolfCart () CancunGolfCartModel = Object.LoadModel("Levels\\Cancun\\Can_Grl\\Models\\GolfCart.rom") end function CreateCancunGolfCart (myID) Object.CreatePhysicalBody(myID,"Levels\\Cancun\\Can_Grl\\Models\\GolfCart.hsc"); Object.SetMass(myID,0.4) Object.SetFriction(myID,0.7) Object.SetCollisionSound(myID,"MetalBreak") return coroutine.create(UpdateCancunGolfCart) end function UpdateCancunGolfCart(myID) local dt=0 local reason=0 Object.CreateParticleEffect(myID,0,"CrashFire") Object.SetParticleEffectActive(myID,0,false) Object.SetModel(myID,CancunGolfCartModel) Object.DeactivatePhysics(myID) Object.UpdateOnPhysicalBodyHitFloor(myID,true) Object.SetPhysicalBodyHitFloorVelocityThreshold(myID,5) while true do dt,reason = coroutine.yield() if reason == 9 then Object.SetCollected(myID,0) -- Hardcoding collector Object.UpdateOnPhysicalBodyHitFloor(myID,false) Object.SetParticleEffectAutoPositionUpdate(myID,0,true) Object.SetParticleEffectActive(myID,0,true) end end end