#include "script/wheels.lua" arrow = nil uiBlur = 1 uiCloseEyes = 1 function init() enabled = true local tutorialDone = GetBool("savegame.mod.tutorial.complete") if tutorialDone then enabled = false end uiBlur = 1 uiCloseEyes = 1 SetValue("uiCloseEyes", 0, "linear", 1.8) garage1 = FindLocation("garage1") toolsLocation = FindLocation("tools") toolsLocation2 = FindLocation("tools2") toolsTrigger = FindTrigger("tools") toolsDone = false freyas_vehicle = FindVehicle("freyas", true) carDone = false exitLocation = FindLocation("exitlocation") exitTrigger = FindTrigger("exittrigger") arrow = LoadSprite("gfx/arrowdown.png") --Disable all tools local tools = ListKeys("game.tool") for i=1,#tools do local k = "game.tool."..tools[i]..".enabled" if GetBool(k) then SetBool(k, false) end end SetString("game.player.tool", "none") if GetBool("savegame.mod.toolsdone") then removeToolsAndSkipTutorial() end end function drawArrow(location) if GetBool("game.map.enabled") then return end local arrowPos = GetLocationTransform(location).pos local c = GetCameraTransform().pos c[2] = arrowPos[2] local p = VecCopy(arrowPos) p[2] = p[2] + math.sin(GetTime()*5)*0.3+0.3 + 2 local t = Transform(p, QuatLookAt(arrowPos, c)) DrawSprite(arrow, t, 2, 2, .3, .3, .3, 3, false, true) DrawSprite(arrow, t, 2, 2, 1, 1, 1, 1, true, true) end function drawArrowVehicle(vehicle) if GetBool("game.map.enabled") then return end local arrowPos = GetVehicleTransform(vehicle).pos local c = GetCameraTransform().pos c[2] = arrowPos[2] local p = VecCopy(arrowPos) p[2] = p[2] + math.sin(GetTime()*5)*0.3+0.3 + 3 local t = Transform(p, QuatLookAt(arrowPos, c)) DrawSprite(arrow, t, 2, 2, .3, .3, .3, 3, false, true) DrawSprite(arrow, t, 2, 2, 1, 1, 1, 1, true, true) end function tick(dt) if not enabled then return end local p = GetPlayerPos() local ammoBodies = FindBodies("ammo") local toolBodies = FindBodies("tool") if #ammoBodies + #toolBodies == 0 then toolsDone = true SetBool("savegame.mod.toolsdone",true) end if not toolsDone and isMessageRead("intro") then if not IsPointInTrigger(toolsTrigger, p) then SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HINT_GO_TO_SHOWROOM")) drawArrow(garage1) else SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_PICK_UP")) drawArrow(toolsLocation) drawArrow(toolsLocation2) end end local vehicle = GetPlayerVehicle() local health = GetVehicleHealth(freyas_vehicle) local vt = GetVehicleTransform(freyas_vehicle) local carInWater, _ = IsPointInWater(vt.pos) if (health <= 0 and toolsDone) or ((carInWater or vt.pos[2] < 0) and toolsDone) then carDone = true if IsPointInTrigger(exitTrigger, p) then SetBool("savegame.mod.tutorial.complete",true) StartLevel("paperboy", "MOD/tillaggaryd.xml", "paperboy") else drawArrow(exitLocation) SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HINT_GO_TO_TILLAGGARAYD")) end end if vehicle == freyas_vehicle and toolsDone then carDone = true if IsPointInTrigger(exitTrigger, p) then SetBool("savegame.mod.tutorial.complete",true) StartLevel("paperboy", "MOD/tillaggaryd.xml", "paperboy") else drawArrow(exitLocation) if health <= 0 then SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_CAR'S_BROKEN")) else SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_DRIVE_TO")) end end end if toolsDone and not carDone then SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_GO_TO")) drawArrowVehicle(freyas_vehicle) end end function isMessageReceived(messageId) return GetInt("savegame.mod.message."..messageId) > 0 end function isMessageRead(messageId) return GetInt("savegame.mod.message."..messageId..".read") > 0 end function draw() local delay = 0.6 if GetTime() < .4+delay then SetValue("uiBlur", 1, "linear", 0.1) end if GetTime() > .4+delay and GetTime() < 7.0+delay then SetValue("uiBlur", 0, "linear", 0.1) end if GetTime() > 0.7+delay and GetTime() < 1.0+delay then SetValue("uiBlur", 1, "linear", 0.1) end if GetTime() > 1.0+delay and GetTime() < 1.1+delay then SetValue("uiBlur", 0, "linear", 0.1) end UiBlur(uiBlur) UiColor(0,0,0,uiCloseEyes) UiRect(UiWidth(),UiHeight()) end function removeToolsAndSkipTutorial() local tools = FindBodies("ammo") for i=1,#tools do Delete(tools[i]) end local pTool = "spraycan" SetBool("savegame.tool."..pTool..".enabled", true) SetBool("game.tool."..pTool..".enabled", true) pTool = "extinguisher" SetBool("savegame.tool."..pTool..".enabled", true) SetBool("game.tool."..pTool..".enabled", true) pTool = "sledge" SetBool("savegame.tool."..pTool..".enabled", true) SetString("game.player.tool", pTool) SetBool("game.tool."..pTool..".enabled", true) pTool = "wire" SetBool("game.tool."..pTool..".enabled", true) SetInt("game.tool."..pTool..".ammo", 30) SetInt("game.tool."..pTool..".stretch", 1) pTool = "gun" SetBool("game.tool."..pTool..".enabled", true) SetInt("game.tool."..pTool..".ammo", 12) SetInt("game.tool."..pTool..".damage", 1) SetInt("game.tool."..pTool..".range", 5) pTool = "plank" SetBool("game.tool."..pTool..".enabled", true) SetInt("game.tool."..pTool..".ammo", 48) SetInt("game.tool."..pTool..".length", 50) SetInt("game.tool."..pTool..".width", 4) pTool = "blowtorch" SetBool("game.tool."..pTool..".enabled", true) SetInt("game.tool."..pTool..".ammo", 20) pTool = "steroid" SetBool("game.tool."..pTool..".enabled", true) SetInt("game.tool."..pTool..".ammo", 4) -- Custom tool RegisterTool("jackhammer", "JACKHAMMER", "MOD/vox/jackhammer.vox", 3) SetBool("game.tool.jackhammer.enabled", true) SetString("game.tool.jackhammer.ammo.display","") end