-- -- Autor: Benjam√ån de la Fuente Ranea -- Fecha: 23-12-2008 -- -- Script con la descripciÛn del circuito -- RegisterCircuit(0, 2, { name = "circuit_tuto2.lua", model = "circuit_playground2.mesh", lightMap = "", groundNodes = "Backgrnd,Rodea,Rodeanoc,Rampa01,Rampa02,Rampa04,Rampa05,Rampa06,Rampa07,Rampa08,Rampa09,barreras,Obstacles", noRayCollision = "Rodeanoc", physicsNodes = "Box01,Box02,Box03,Box04,Box05,Box06,Box07,Item:ActorGeom:Nitro(1),Item:ActorGeom:Nitro(2),Item:ActorGeom:Nitro(3),Item:ActorGeom:CheckPoint(1),Item:ActorGeom:CheckPoint(2),Item:ActorGeom:CheckPoint(3),Item:ActorGeom:CheckPoint(4),Item:ActorGeom:CheckPoint(5),Item:ActorGeom:CheckPoint(6),Cone:cono_1,Cone:cono_2,Cone:cono_3,Cone:cono_4,Cone:cono_6,Cone:cono_7,Cone:cono_8,Cone:cono_10,Cone:cono_11,Cone:cono_12,SppedLimitCheckpoint(7),SppedLimitCheckpoint(8),TriggerReset(1),TriggerReset(2),TriggerJump()", camera = "circuit_tuto", cutscene = "", nLaps = 1, controlPointsData = { }, respawnPoints = { 1 }, nitroPoints = { }, itemDecisionPoints = { }, preInit = function() execute("circuits/circuit_common.lua") function AddCarActions() CreateAction("Car1", "CheckVelocityAction", { controlZone = "SpeedLimitCheckpoint", id = 7, greater = false, velocity = 50 }) CreateAction("Car1", "CheckVelocityAction", { controlZone = "SpeedLimitCheckpoint", id = 8, greater = true, velocity = 110 }) end function TutoText() return { text = "", scale = 0.07, font = "fontTRN_fg.fnt", overlap = g_TextOverlap, align = E_ALIGN_LEFT, layer = LF_PANELS+1 } end g_checkPoints = {} CreateActor("ActorGeom", { name = "TutoMessage", model = "HUD/tutotext.mesh", layer = LF_PANELS+1, camera = "HUD" }) SetText("TutoText()", g_Text.initTuto2Message) SetActorAnim("TutoMessage", { anim = "HUD/tutotext.anm" }) SetResetCarPoint("Car1", "Car1") function CheckPoint(_id, _carId) if _carId then if not g_checkPoints[_id] then -- Animamos el checkpoint local actorName = "CheckPoint(" .. _id .. ")" ClearActorAnims(actorName, true, true) if _id == 6 then Sound.PlaySound(g_ActivateCheckpointSound) SetActorAnim(actorName, { anim = "circuitStuff/tl2_on.anm" }) EnqueueExecuteScript(actorName, "SetActorAnim('" .. actorName .. "', { anim = 'circuitStuff/tl2_on_cycle.anm', loop = true })") elseif _id == 7 then Sound.PlaySound(g_ActivateCheckpointSound) SetActorAnim(actorName, { anim = "circuitStuff/tl3_on.anm" }) EnqueueExecuteScript(actorName, "SetActorAnim('" .. actorName .. "', { anim = 'circuitStuff/tl3_on_cycle.anm', loop = true })") elseif _id == 8 then Sound.PlaySound(g_ActivateCheckpointSound) SetActorAnim(actorName, { anim = "circuitStuff/tl4_on.anm" }) EnqueueExecuteScript(actorName, "SetActorAnim('" .. actorName .. "', { anim = 'circuitStuff/tl4_on_cycle.anm', loop = true })") else Sound.PlaySound(g_ActivateCheckpointSound) SetActorAnim(actorName, { anim = "circuitStuff/tl_on.anm" }) EnqueueExecuteScript(actorName, "SetActorAnim('" .. actorName .. "', { anim = 'circuitStuff/tl_on_cycle.anm', loop = true })") end -- Actualizamos el contador g_checkPoints[_id] = true local currentCheckpoints = CountCheckPoints() UpdateCheckpoints(currentCheckpoints) -- Comprobación de fin de tutorial if currentCheckpoints == #g_checkPoints then EndCurrentTutorial() DestroyActor('TutoMessage') end end else g_checkPoints[_id] = false if _id == 6 then return { model = "circuitStuff/tutolight2.mesh" } else return { model = "circuitStuff/tutolight.mesh" } end end end function SpeedLimitCheckpoint(_id, _bChecked, _bFail) if _bChecked then if _bFail then CheckPoint(_id, true) elseif _id == 7 then SetText("TutoText()", g_Text.tutoSlowDown) SetActorAnim("TutoMessage", { anim = "HUD/tutotext.anm" }) elseif _id == 8 then SetText("TutoText()", g_Text.tutoSpeedUp) SetActorAnim("TutoMessage", { anim = "HUD/tutotext.anm" }) end else g_checkPoints[_id] = false if _id == 7 then return { name = "CheckPoint(" .. _id .. ")", model = "circuitStuff/tutolight3.mesh" } else return { name = "CheckPoint(" .. _id .. ")", model = "circuitStuff/tutolight4.mesh" } end end end function CountCheckPoints() local numCheckpoints = 0 for i = 1, #g_checkPoints, 1 do if g_checkPoints[i] then numCheckpoints = numCheckpoints + 1 end end return numCheckpoints end function TriggerReset(_id) if _id == 1 then SetResetCarPoint("Car1", "DummyReset1") SetText("TutoText()", g_Text.tutoResetMessage) SetActorAnim("TutoMessage", { anim = "HUD/tutotext.anm" }) AnimateTutorialResetButton() elseif _id == 2 then SetResetCarPoint("Car1", "Car1") end end function Nitro(_id, _carId) if _carId then AddNitroToCar(_carId) local actorName = "Nitro(" .. _id .. ")" ClearActorAnims(actorName, true, true) SetActorAnim(actorName, { anim = "circuitStuff/nitro_out.anm" }) EnqueueExecuteScript(actorName, "HideItem('Item:ActorGeom:" .. actorName .. "');SetActorAnim('" .. actorName .. "', { anim = 'circuitStuff/nitro.anm', loop = true })") if GetCarUsedNitros("Car1") == 0 then if( Is_Multitouch == 1 ) then SetText("TutoText()", g_Text.tutoTakeNitro) else SetText("TutoText()", g_Text.tutoTakeNitro2) end SetActorAnim("TutoMessage", { anim = "HUD/tutotext.anm" }) end else return { model = "circuitStuff/nitro.mesh" } end end end, onInit = function() SetActorAnim("Nitro(1)", { anim = "circuitStuff/nitro.anm", loop = true, }) SetActorAnim("Nitro(2)", { anim = "circuitStuff/nitro.anm", loop = true, }) SetActorAnim("Nitro(3)", { anim = "circuitStuff/nitro.anm", loop = true, }) SetActorAnim("CheckPoint(1)", { anim = "circuitStuff/tl_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(2)", { anim = "circuitStuff/tl_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(3)", { anim = "circuitStuff/tl_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(4)", { anim = "circuitStuff/tl_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(5)", { anim = "circuitStuff/tl_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(6)", { anim = "circuitStuff/tl2_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(7)", { anim = "circuitStuff/tl3_off_cycle.anm", loop = true, }) SetActorAnim("CheckPoint(8)", { anim = "circuitStuff/tl4_off_cycle.anm", loop = true, }) end, })