print("_HintController") testMode = false hintui = object("_RuinsHintUI") hintvo = object("_RuinsHintVO") function hint(hintNumber,playVO) if playVO == nil then playVO = true end print("hint",hintNumber,playVO) if playVO then playHintVO(hintNumber) end showHintUI(hintNumber) end function playHintVO(hintNumber) local theHint = "playHintVO" .. string.format("%03d",hintNumber) print("playHintVO",theHint,hintNumber) hintvo.trigger.send(1,theHint) end function showHintUI(hintNumber) local theHint = "hint" .. string.format("%03d",hintNumber) print("showHintUI",theHint,hintNumber) hintui.trigger.send(1,theHint) end --[[ 01 - Talk to Flynn 02 - Clear away all of the bramble. 03 - Talk to Persephone 04 - Check out the docks 05 - Look inside the lock 06 - Talk to Gurglefin 07 - Grab the oil can 164 - Oil the Far Viewer 08 - Meet Hugo by the Far Viewer 09 - Investigate the beach 10 - Oil the robot 11 - Find the clams 12 - Use bomb to open the cave 13 - Talk to Diggs 14 - Talk to Arbo 15 - Collect the apples 16 - Talk to General Robot 17 - Talk to the skull 18 - Find T-Bone¡¦s bones 19 - Talk to T-Bone 20 - Talk to Diggs the Molekin 21 - Talk to the Weapon Master 22 - Talk to Hugo ]] hintTriggers = { "sc03Done", "sc04Done", "sc05Done", "sc07Done", "state3UpgradeDone", "sc10Done", "sc11Done", "sc44Done", "sc13Done", "sc17Done", "sc18Done", "sc19Done", "sc14Done", "sc15Done", "sc50Done", "sc21Done", "sc22Done", "sc24Done", "sc52Done", "sc25Done", "sc27Done", "sc28Done", "sc30Done", "sc47Done", "sc32Done", "sc33Done", "sc34Done", "sc63Done", "sc36Done", "sc37Done", "sc40Done", "sc41Done", } function giveHint(playVO) local state = RuinsState.get() if state == 1 then hint(1,playVO) -- 01 - Talk to Flynn elseif state == 2 then print("state 2 hint conditions:",sc05Done) if sc05Done then hint(1,playVO) -- 01 - Talk to Flynn else hint(2,playVO) -- 02 - Clear away all of the bramble. end elseif state == 3 then print("state 3 hint conditions:",state3UpgradeDone) if state3UpgradeDone then hint(1,playVO) -- 01 - Talk to Flynn else hint(3,playVO) -- 03 - Talk to Persephone end elseif state == 4 then print("state 4 hint conditions:",sc11Done,sc44Done) if sc11Done then -- Gurglefin freed hint(6,playVO) -- 06 - Talk to Gurglefin elseif sc44Done then -- Gurglefin discovered hint(5,playVO) -- 05 - Look inside the lock else hint(4,playVO) -- 04 - Check out the docks end elseif state == 5 then print("state 5 hint conditions:",sc17Done) if sc17Done then hint(6,playVO) -- 06 - Talk to Gurglefin else hint(164,playVO) -- 164 - Oil the Far Viewer end elseif state == 6 then hint(6,playVO) -- 06 - Talk to Gurglefin elseif state == 7 then print("state 7 hint conditions:",sc50Done,sc15Done,sc14Done,discoveredClamRobot) if sc50Done then hint(13,playVO) -- 13 - Talk to Diggs elseif sc15Done then hint(12,playVO) -- 12 - Use bomb to open the cave elseif sc14Done then hint(11,playVO) -- 11 - Find the clams elseif discoveredClamRobot then hint(10,playVO) -- 10 - Oil the robot else hint(9,playVO) -- 09 - Investigate the beach end elseif state == 8 then hint(13,playVO) -- 13 - Talk to Diggs elseif state == 9 then hint(14,playVO) -- 14 - Talk to Arbo elseif state == 10 then print("state 10 hint conditions:",sc52Done) if not sc52Done then hint(15,playVO) -- 15 - Collect the apples else hint(14,playVO) -- 14 - Talk to Arbo end elseif state == 11 then hint(16,playVO) -- 16 - Talk to General Robot elseif state == 12 then hint(16,playVO) -- 16 - Talk to General Robot elseif state == 13 then hint(16,playVO) -- 16 - Talk to General Robot elseif state == 14 then print("state 14 hint conditions:",sc47Done,sc30Done,mrBonesMinigameActive) if sc47Done then hint(19,playVO) -- 19 - Talk to T-Bone elseif sc30Done and mrBonesMinigameActive then hint(18,playVO) -- 18 - Find T-Bone¡¦s bones else hint(9,playVO) -- 09 - Investigate the beach end elseif state == 15 then hint(19,playVO) -- 19 - Talk to T-Bone elseif state == 16 then hint(19,playVO) -- 19 - Talk to T-Bone elseif state == 17 then print("state 17 hint conditions:",sc63Done) if sc63Done then hint(20,playVO) -- 20 - Talk to Diggs the Molekin else hint(12,playVO) -- 12 - Use bomb to open the cave end elseif state == 18 then hint(20,playVO) -- 20 - Talk to Diggs the Molekin elseif state == 19 then hint(21,playVO) -- 21 - Talk to the Weapon Master elseif state == 20 then hint(21,playVO) -- 21 - Talk to the Weapon Master elseif state == 21 then hint(22,playVO) -- 22 - Talk to Hugo end end hintCooldown = 180 hintCheckCooldown = 10 hintPlayerIdleTime = 60 hintGeneralIdleTime = 300 nextHintCheckTime = 10 nextHintTime = hintCooldown hintTestNumber = 1 function resetGeneralIdle() nextGeneralIdleHintTime = myTime + hintGeneralIdleTime end resetGeneralIdle() if testMode then hintCooldown = 20 hintCheckCooldown = 5 hintPlayerIdleTime = 10 hintGeneralIdleTime = 20 nextHintTime = hintCooldown resetGeneralIdle() print("!!! HintController testMode ON !!!") end function hintTick () if nextHintCheckTime <= myTime then --hint(hintTestNumber) print( "hint conditions:" , PlayerInput_IdleTime() , Game_InCinematic() , lastDialog , conversation_ask(lastDialog) ) print( "hint times:" , myTime , nextHintCheckTime , nextHintTime , PlayerInput_IdleTime() , nextGeneralIdleHintTime ) if nextHintTime <= myTime and ( (PlayerInput_IdleTime() >= hintPlayerIdleTime) or (nextGeneralIdleHintTime <= myTime) ) and not Game_InCinematic() and not conversation_ask(lastDialog) then giveHint(true) nextHintTime = myTime + hintCooldown resetGeneralIdle() end nextHintCheckTime = myTime + hintCheckCooldown --hintTestNumber = hintTestNumber + 1 --if hintTestNumber > 22 then hintTestNumber = 1 end end for k,v in pairs(hintTriggers) do if trigger.received(1,v) then print("got a hintTrigger",v) giveHint(false) end end end