forked from coderwilson/FFX_TAS_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFX_Besaid1.py
More file actions
304 lines (277 loc) · 9.71 KB
/
FFX_Besaid1.py
File metadata and controls
304 lines (277 loc) · 9.71 KB
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
import time
import FFX_Xbox
import FFX_Screen
import FFX_Battle
import FFX_memory
FFXC = FFX_Xbox.FFXC
def Beach():
print("Starting Besaid section. Beach")
FFXC.set_value('AxisLy', -1)
FFX_memory.awaitControl()
time.sleep(4.5)
FFXC.set_value('AxisLy', 0)
FFX_Xbox.SkipDialog(20)
FFX_memory.clickToControl()
print("Run to Wakka")
FFXC.set_value('AxisLy', 1)
time.sleep(1)
FFXC.set_value('AxisLx', 1)
time.sleep(3)
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
#Time to head to the village (via Pirahnas, it's fine)
FFX_memory.clickToControl()
FFXC.set_value('AxisLy', -1)
time.sleep(1.2)
#FFXC.set_value('AxisLy', 0)
#FFXC.set_value('AxisLx', 1)
#time.sleep(0.8)
#FFXC.set_value('AxisLx', 0)
#FFXC.set_value('AxisLy', -1)
#time.sleep(0.5)
#FFXC.set_value('AxisLy', 0)
#FFX_Xbox.touchSaveSphere()
FFXC.set_value('AxisLy', -1)
FFX_memory.awaitEvent()
time.sleep(0.1)
FFX_memory.awaitControl()
time.sleep(0.6)
while FFX_memory.getCoords()[1] < -20:
FFXC.set_value('AxisLx', 1)
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLy', 0)
FFX_Xbox.SkipDialog(12)
FFXC.set_value('AxisLx', 0)
#Now in the water
FFX_memory.clickToControl() #Wakka pushing Tidus into the water.
FFXC.set_value('AxisLx', 1)
time.sleep(1)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
def swimming1():
print("Start of swimming section in Besaid.")
checkpoint = 0
lastCP = 0
while checkpoint < 100:
if lastCP != checkpoint:
print("Checkpoint reached: ", checkpoint)
lastCP = checkpoint
if FFX_memory.userControl():
pos = FFX_memory.getCoords()
if checkpoint == 0:
if pos[0] > 250:
checkpoint = 10
else:
FFXC.set_value('AxisLy', 1)
if pos[1] > ((-0.63 * pos[0]) -572):
FFXC.set_value('AxisLx', 1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 10:
if pos[0] > 435:
checkpoint = 20
else:
FFXC.set_value('AxisLy', 1)
if pos[1] > ((0.29 * pos[0]) -780.57):
FFXC.set_value('AxisLx', 1)
elif pos[1] < ((0.29 * pos[0]) -790.57):
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 20:
if pos[1] > -420:
checkpoint = 30
else:
FFXC.set_value('AxisLy', 1)
if pos[1] > ((2.65 * pos[0]) -1826.94):
FFXC.set_value('AxisLx', 1)
elif pos[1] < ((2.65 * pos[0]) -1856.94):
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif checkpoint == 30:
if FFX_memory.getMap() != 41:
checkpoint = 100
else:
FFXC.set_value('AxisLy', 1)
if pos[0] < 535:
FFXC.set_value('AxisLx', 1)
elif pos[0] > 545:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
elif FFX_Screen.BattleScreen():
battleNum = FFX_memory.getBattleNum()
#11 = two pirhanas
#12 = three pirhanas with one being a triple formation (takes two hits)
#13 = four pirhanas
if battleNum == 11:
FFX_Battle.attack('none')
else:
FFX_Battle.escapeAll()
elif FFX_Screen.BattleComplete():
FFXC.set_value('BtnB', 1)
time.sleep(0.035)
FFXC.set_value('BtnB', 0)
time.sleep(0.035)
elif not FFX_memory.userControl():
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
if checkpoint > 20:
FFX_Xbox.menuB()
def swimming1_old() :
Complete = 0
path = 0
straight = 13
turn = straight + 3
recover = turn + 5
print("Swimming towards Besaid village. Pirahnas section.")
while Complete == 0 :
if FFX_Screen.PixelTest( 269, 191, (183, 183, 61) ) :
#We're now on the hill.
Complete = 1
elif not FFX_Screen.Minimap1() and not FFX_Screen.BattleScreen() :
#Skip dialog if it is occurring, for speed's sake
FFXC.set_value('BtnB', 1)
time.sleep(0.1)
FFXC.set_value('BtnB', 0)
time.sleep(0.1)
elif FFX_Screen.Minimap1() and not FFX_Screen.PixelTest( 269, 191, (183, 183, 61) ) :
path += 1
print("Swimming: ", path)
if path == 100 :
Complete = 1
elif path >= recover and path < recover +5 :
print("Angle to the finish line")
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', 1)
time.sleep(3)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
elif path < straight:
FFXC.set_value('AxisLy', 1)
time.sleep(1)
FFXC.set_value('AxisLy', 0)
elif path >= straight and path < turn:
print("Turning")
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', -1)
time.sleep(0.6)
FFXC.set_value('AxisLx', 0)
time.sleep(0.1)
FFXC.set_value('AxisLy', 0)
elif path >= turn :
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', -1)
time.sleep(0.2)
FFXC.set_value('AxisLx', 0)
time.sleep(2)
FFXC.set_value('AxisLy', 0)
elif FFX_Screen.BattleScreen() :
print("Battle: Tidus and Wakka attack.")
FFX_Battle.FinishWithAttacksOnly()
def enteringVillage():
FFX_memory.clickToControl()
FFXC.set_value('AxisLy', 1)
time.sleep(1.1)
FFXC.set_value('AxisLx', -1)
time.sleep(5)
FFXC.set_value('AxisLx', 0)
FFX_Xbox.SkipDialog(10)
FFXC.set_value('AxisLy', 0)
#Conversation with Luzzu and Gatta
#FFX_Xbox.SkipDialog(18)
FFX_memory.clickToControl()
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', 1)
time.sleep(5)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
#Learning about the prayer
FFX_Screen.awaitPixel(973,506,(187, 187, 187))
FFX_Xbox.menuDown()
FFX_Xbox.menuB()
#Wait for Tidus to gain control
FFX_memory.clickToControl()
FFXC.set_value('AxisLy', 1)
FFXC.set_value('AxisLx', -1)
time.sleep(0.9)
FFXC.set_value('AxisLx', 0)
time.sleep(13)
FFXC.set_value('AxisLy', 0)
#Next, run towards the Braska statue
FFX_memory.awaitControl()
FFXC.set_value('AxisLx', -1)
time.sleep(3)
FFXC.set_value('AxisLx', 0)
FFX_memory.awaitControl() #Finally receive our statue.
FFXC.set_value('AxisLy', -1)
time.sleep(0.4)
pos = FFX_memory.getCoords()
while FFX_memory.userControl():
FFXC.set_value('AxisLx', 1)
if pos[0] > 8:
FFXC.set_value('AxisLy', -1)
elif pos[0] < -5:
FFXC.set_value('AxisLy', 1)
else:
FFXC.set_value('AxisLy', 0)
pos = FFX_memory.getCoords()
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
time.sleep(0.2)
#Temple to Wakka's tent
FFX_memory.awaitControl()
FFXC.set_value('AxisLy', -1)
time.sleep(7)
FFXC.set_value('AxisLx', 1)
time.sleep(4)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
#Approach Wakka
FFX_Screen.awaitPixel(198,160, (64, 193, 64))
FFXC.set_value('AxisLy', -1)
FFXC.set_value('AxisLx', 1)
FFX_Xbox.SkipDialog(2.5)
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
FFX_Xbox.SkipDialog(3)
#Sleeping
FFX_memory.clickToControl()
#Awake
FFXC.set_value('AxisLx', -1)
FFXC.set_value('AxisLy', 1)
time.sleep(2)
FFXC.set_value('AxisLx', 0)
FFXC.set_value('AxisLy', 0)
time.sleep(0.3)
FFX_memory.awaitControl()
FFXC.set_value('AxisLx', -1)
time.sleep(1)
pos = FFX_memory.getCoords()
while FFX_memory.userControl():
FFXC.set_value('AxisLy', 1)
if pos[0] > 18:
FFXC.set_value('AxisLx', 1)
elif pos[0] < -18:
FFXC.set_value('AxisLx', -1)
else:
FFXC.set_value('AxisLx', 0)
pos = FFX_memory.getCoords()
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
time.sleep(0.2)
FFX_memory.awaitControl()
#Start of conversation with Wakka and the priest.
pos = FFX_memory.getCoords()
while FFX_memory.userControl():
FFXC.set_value('AxisLx', -1)
if pos[0] > 10:
FFXC.set_value('AxisLy', -1)
else:
FFXC.set_value('AxisLy', 0)
pos = FFX_memory.getCoords()
FFXC.set_value('AxisLy', 0)
FFXC.set_value('AxisLx', 0)
time.sleep(0.2)
print("Pathing is complete. Ready for trials")