1 | -- Get objects from orxonox |
---|
2 | thisscript:addObject("FPSPlayer", "Player") |
---|
3 | thisscript:addObject("CameraMan", "cameraManager") |
---|
4 | thisscript:addObject("QuestGUI", "energyQuest") |
---|
5 | thisscript:addObject("NPC", "triggeredDoor") |
---|
6 | thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle |
---|
7 | |
---|
8 | --get first Quest |
---|
9 | triggerGetEnergyQuest = SpaceTrigger() --ScriptTrigger() |
---|
10 | triggerGetEnergyQuest:setScript("quest.lua") |
---|
11 | triggerGetEnergyQuest:setFunction("getEnergyQuest") |
---|
12 | triggerGetEnergyQuest:setAbsCoor(229.492569, 38.417606, -363.788483) |
---|
13 | triggerGetEnergyQuest:setTarget("Player") |
---|
14 | triggerGetEnergyQuest:setRadius(160) |
---|
15 | --triggerGetEnergyQuest:setDebugDraw(true) |
---|
16 | |
---|
17 | --activate energy - finish energyQuest |
---|
18 | triggerFinishEnergyQuest = ActionTrigger() |
---|
19 | triggerFinishEnergyQuest:setScript("quest.lua") |
---|
20 | triggerFinishEnergyQuest:setFunction("finishEnergyQuest") |
---|
21 | triggerFinishEnergyQuest:setAbsCoor(346.239166, 482.885010, -160.825775) |
---|
22 | triggerFinishEnergyQuest:setTarget("Player") |
---|
23 | triggerFinishEnergyQuest:setRadius(35) |
---|
24 | --triggerFinishEnergyQuest:setDebugDraw(true) |
---|
25 | |
---|
26 | --finish quest Info |
---|
27 | triggerFinishEnergyQuest = SpaceTrigger() |
---|
28 | triggerFinishEnergyQuest:setScript("quest.lua") |
---|
29 | triggerFinishEnergyQuest:setFunction("finishEnergyQuestInfo") |
---|
30 | triggerFinishEnergyQuest:setAbsCoor(346.239166, 482.885010, -160.825775) |
---|
31 | triggerFinishEnergyQuest:setTarget("Player") |
---|
32 | triggerFinishEnergyQuest:setRadius(35) |
---|
33 | --triggerFinishEnergyQuest:setDebugDraw(true) |
---|
34 | |
---|
35 | --HINT Broken station -> find another way |
---|
36 | triggerFinishEnergyQuest = SpaceTrigger() |
---|
37 | triggerFinishEnergyQuest:setScript("quest.lua") |
---|
38 | triggerFinishEnergyQuest:setFunction("hintBrokenStation") |
---|
39 | triggerFinishEnergyQuest:setAbsCoor(192.274033, 221.190002, 63.674793) |
---|
40 | triggerFinishEnergyQuest:setTarget("Player") |
---|
41 | triggerFinishEnergyQuest:setRadius(85) |
---|
42 | --triggerFinishEnergyQuest:setDebugDraw(true) |
---|
43 | |
---|
44 | --HINT Joga -> find another way |
---|
45 | triggerFinishEnergyQuest = SpaceTrigger() |
---|
46 | triggerFinishEnergyQuest:setScript("quest.lua") |
---|
47 | triggerFinishEnergyQuest:setFunction("joga") |
---|
48 | triggerFinishEnergyQuest:setAbsCoor(208, 144, 186) |
---|
49 | triggerFinishEnergyQuest:setTarget("Player") |
---|
50 | triggerFinishEnergyQuest:setRadius(60) |
---|
51 | --triggerFinishEnergyQuest:setDebugDraw(true) |
---|
52 | |
---|
53 | --Tick: HINT need to open the door and stop the player |
---|
54 | trigger = TickTrigger() |
---|
55 | trigger:setScript("quest.lua") |
---|
56 | trigger:setFunction("tick") |
---|
57 | --trigger:setActiveOnCreation(true) |
---|
58 | |
---|
59 | |
---|
60 | --gloabals--------------------------------------------------------------------- |
---|
61 | questEnergyDone = false |
---|
62 | lastPlayerZ = 0 |
---|
63 | lastDoorY = 0 |
---|
64 | doorSequenceTime = 7 --duration time sec |
---|
65 | |
---|
66 | function getEnergyQuest(timestep) |
---|
67 | energyQuest:startGUI() |
---|
68 | return true |
---|
69 | end |
---|
70 | |
---|
71 | function hintBrokenStation(timestep) |
---|
72 | gameWorld:showText("The station seems broken... you need to find another way.") |
---|
73 | return true |
---|
74 | end |
---|
75 | |
---|
76 | function finishEnergyQuest(timestep) |
---|
77 | gameWorld:showText("Good work: the emergency energy system seems to be up again.") |
---|
78 | cameraManager:setCam("CameraDoor") |
---|
79 | cameraManager:changeCurrTarget("NPC", "triggeredDoor") |
---|
80 | |
---|
81 | energyQuest:stopGUI() |
---|
82 | questEnergyDone = true |
---|
83 | return true |
---|
84 | end |
---|
85 | |
---|
86 | function finishEnergyQuestInfo(timestep) |
---|
87 | gameWorld:showText("Hint: you can use the Energyswitch by Pressing U") |
---|
88 | return true |
---|
89 | end |
---|
90 | |
---|
91 | function joga(timestep) |
---|
92 | gameWorld:showText("*zwinker*") |
---|
93 | return true |
---|
94 | end |
---|
95 | |
---|
96 | function tick(timestep) |
---|
97 | --io.write("tick called \n") |
---|
98 | if not questEnergyDone then |
---|
99 | if Player:getAbsCoorZ() < -454 then |
---|
100 | --gameWorld:showText("The door can't open without energy."); |
---|
101 | Player:setAbsCoor(Player:getAbsCoorX(),Player:getAbsCoorY(),lastPlayerZ) --set player back |
---|
102 | else |
---|
103 | lastPlayerZ = Player:getAbsCoorZ() --store last position |
---|
104 | end |
---|
105 | else --quest finished |
---|
106 | if doorSequenceTime > 0 then --sequence running |
---|
107 | --triggeredDoor:walkTo(222, 92.5, -472) |
---|
108 | lastDoorY = lastDoorY+92.5/8*timestep |
---|
109 | triggeredDoor:setAbsCoor(triggeredDoor:getAbsCoorX(), lastDoorY, triggeredDoor:getAbsCoorZ()) |
---|
110 | doorSequenceTime = doorSequenceTime - timestep |
---|
111 | else |
---|
112 | --triggeredDoor:setVisibility(false) |
---|
113 | cameraManager:setCam("GameWorldCamera") |
---|
114 | gameWorld:showText("You should hurry as long as there is still energy.") |
---|
115 | return true --quest&sequence finished: kill trigger |
---|
116 | end |
---|
117 | end |
---|
118 | return false |
---|
119 | end |
---|