-
Notifications
You must be signed in to change notification settings - Fork 0
/
war04a.go
230 lines (227 loc) · 4.4 KB
/
war04a.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
package war04a
import "github.com/noxworld-dev/noxscript/ns/v3"
var (
ivar4 int
ivar5 int
gvar6 int
fvar7 float32
obj8 ns.ObjectID
obj9 ns.ObjectID
obj10 ns.ObjectID
obj11 ns.ObjectID
obj12 ns.ObjectID
obj13 ns.ObjectID
wp14 ns.WaypointID
wp15 ns.WaypointID
wp16 ns.WaypointID
wp17 ns.WaypointID
gvar18 int
gvar19 int
gvar20 int
gvar21 ns.ObjectGroupID
gvar22 ns.ObjectGroupID
obj23 ns.ObjectID
wp24 ns.WaypointID
)
func init() {
ivar4 = 50
ivar5 = 20
gvar6 = 1
fvar7 = 5
gvar18 = 0
gvar19 = 1
gvar20 = gvar18
}
func CloseBlockTrap01() {
ns.ObjectOff(obj12)
ns.Move(obj8, wp14)
ns.Move(obj9, wp15)
ns.FrameTimerWithArg(ivar5, 1, BlockTrapBoom)
ns.FrameTimerWithArg(ivar4, 1, ResetBlockTrap)
}
func CloseBlockTrap02() {
ns.ObjectOff(obj13)
ns.Move(obj10, wp16)
ns.Move(obj11, wp17)
ns.FrameTimerWithArg(ivar5, 2, BlockTrapBoom)
ns.FrameTimerWithArg(ivar4, 2, ResetBlockTrap)
}
func BlockTrapLoop() {
var v0 int
switch v0 = gvar6; v0 {
case 1:
goto LABEL1
case 2:
goto LABEL2
default:
goto LABEL3
}
LABEL1:
CloseBlockTrap01()
gvar6 = 2
goto LABEL3
LABEL2:
CloseBlockTrap02()
gvar6 = 1
goto LABEL3
LABEL3:
ns.FrameTimer(30, BlockTrapLoop)
}
func InitializeBlockTrap() {
obj8 = ns.Object("SpikeBlock01")
obj9 = ns.Object("SpikeBlock02")
obj10 = ns.Object("SpikeBlock03")
obj11 = ns.Object("SpikeBlock04")
wp14 = ns.Waypoint("BlockWP01")
wp15 = ns.Waypoint("BlockWP02")
wp16 = ns.Waypoint("BlockWP03")
wp17 = ns.Waypoint("BlockWP04")
obj12 = ns.Object("BlockTrap01Trigger")
obj13 = ns.Object("BlockTrap02Trigger")
BlockTrapLoop()
}
func BlockTrapBoom(a1 int) {
var v0 int
switch v0 = a1; v0 {
case 1:
goto LABEL1
case 2:
goto LABEL2
default:
goto LABEL3
}
LABEL1:
ns.AudioEvent(ns.HammerMissing, wp14)
ns.Effect(ns.JIGGLE, ns.GetWaypointX(wp14), ns.GetWaypointY(wp14), fvar7, 0)
goto LABEL3
LABEL2:
ns.AudioEvent(ns.HammerMissing, wp16)
ns.Effect(ns.JIGGLE, ns.GetWaypointX(wp16), ns.GetWaypointY(wp16), fvar7, 0)
goto LABEL3
LABEL3:
return
}
func ResetBlockTrap(a1 int) {
var v0 int
switch v0 = a1; v0 {
case 1:
goto LABEL1
case 2:
goto LABEL2
default:
goto LABEL3
}
LABEL1:
ns.ObjectOn(obj12)
ns.AudioEvent(ns.TriggerReleased, wp14)
goto LABEL3
LABEL2:
ns.ObjectOn(obj13)
ns.AudioEvent(ns.TriggerReleased, wp16)
goto LABEL3
LABEL3:
return
}
func PlayerDeath() {
ns.DeathScreen(4)
}
func CaptainDialogStart() {
var v0 int
switch v0 = gvar20; v0 {
case gvar18:
goto LABEL1
case gvar19:
goto LABEL2
default:
goto LABEL3
}
LABEL1:
ns.TellStory(ns.SwordsmanHurt, "Con04a:CaptainGreet")
goto LABEL3
LABEL2:
ns.TellStory(ns.SwordsmanHurt, "Con04a:CaptainIdle")
goto LABEL3
LABEL3:
return
}
func CaptainDialogEnd() {
var v0 int
switch v0 = gvar20; v0 {
case gvar18:
goto LABEL1
case gvar19:
goto LABEL2
default:
goto LABEL3
}
LABEL1:
ns.JournalEntry(ns.GetHost(), "Chapter4SearchCrypts", 2)
ns.PrintToAll("Con01a:NewJournalEntry")
gvar20 = gvar19
goto LABEL3
LABEL2:
goto LABEL3
LABEL3:
return
}
func StartCaptainConversation() {
ns.SetDialog(obj23, ns.NORMAL, CaptainDialogStart, CaptainDialogEnd)
ns.StartDialog(obj23, ns.GetHost())
}
func PlayOutdoorMusic() {
ns.Music(22, 100)
}
func MapInitialize() {
gvar21 = ns.ObjectGroup("Secret2Triggers")
gvar22 = ns.ObjectGroup("Fish")
obj23 = ns.Object("Airship_Captain")
wp24 = ns.Waypoint("SecretAudioOrigin")
ns.StoryPic(obj23, "AirshipCaptainPic")
ns.SetOwner(ns.GetHost(), obj23)
ns.GroupWander(gvar22)
InitializeBlockTrap()
PlayOutdoorMusic()
ns.StartupScreen(4)
ns.FrameTimer(5, StartCaptainConversation)
}
func OpenSecretPassageWalls() {
ns.WallOpen(ns.Wall(129, 137))
}
func ExitMessage() {
ns.PrintToAll("War04a:ExitMessage")
}
func ClearScreen() {
ns.ImmediateBlind()
}
func PlayUndergroundMusic() {
ns.Music(20, 100)
}
func SecretSFX() {
ns.MoveWaypoint(wp24, ns.GetObjectX(ns.GetHost()), ns.GetObjectY(ns.GetHost()))
ns.AudioEvent(ns.SecretFound, wp24)
}
func FoundSecret1() {
ns.PrintToAll("GeneralPrint:SecretFound")
ns.GiveXp(ns.GetHost(), 25)
SecretSFX()
}
func FoundSecret2() {
ns.PrintToAll("GeneralPrint:SecretFound")
ns.GiveXp(ns.GetHost(), 100)
ns.ObjectGroupOff(gvar21)
SecretSFX()
}
func FoundSecret3() {
ns.ObjectOff(ns.GetTrigger())
ns.PrintToAll("GeneralPrint:SecretFound")
ns.GiveXp(ns.GetHost(), 100)
SecretSFX()
}
func OnEvent(typ string) {
switch typ {
case "PlayerDeath":
PlayerDeath()
case "MapInitialize":
MapInitialize()
}
}