-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDriveLogic.lua
More file actions
70 lines (66 loc) · 2.15 KB
/
DriveLogic.lua
File metadata and controls
70 lines (66 loc) · 2.15 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
function _OnInit()
GameVersion = 0
end
function _OnFrame()
if true then --Define current values for common addresses
if GameVersion==0 then
if ReadString(0x9A9330,4) == 'KH2J' then --EGS
drive1=0x3F200E
drive2=0x4011A4
drive3=0x3E2AEC
drive4=0x4011F8
drive5=0x3FFE34
drive6=0x3C223E
drive7=0x3F202A
GameVersion=1
Now = 0x0716DF8
Save = 0x09A9330
end
if ReadString(0x9A98B0,4) == 'KH2J' then --Steam Global
drive1=0x3F2D2E
drive2=0x401EC4
drive3=0x3E380C
drive4=0x401F18
drive5=0x400B54
drive6=0x3C2F5E
drive7=0x3F2D4A
GameVersion=2
Now = 0x0717008
Save = 0x09A98B0
end
end
if GameVersion==0 then
return
end
World = ReadByte(Now+0x00)
Room = ReadByte(Now+0x01)
Place = ReadShort(Now+0x00)
Door = ReadShort(Now+0x02)
Map = ReadShort(Now+0x04)
Btl = ReadShort(Now+0x06)
Evt = ReadShort(Now+0x08)
PrevPlace = ReadShort(Now+0x30)
end
-- if room is before datas and place is before datas and they are not in stt
-- if world == 100aw then give ability to go into drive
-- credit to ksx for the base of this lua script
if World==9 or (Room==33 and Place==8450 and ReadShort(Save+0x1CF9)<1) then
if ReadByte(drive1) == 0x74 then
WriteByte(drive1, 0x77)
WriteShort(drive2, 0x820F)
WriteByte(drive3, 0x72)
WriteShort(drive4, 0x820F)
WriteByte(drive5, 0x7D)
WriteByte(drive6, 0x7D)
WriteByte(drive7, 0x03)
end
elseif ReadByte(drive1)==0x77 then
WriteByte(drive1, 0x74)
WriteShort(drive2, 0x850F)
WriteByte(drive3, 0x78)
WriteShort(drive4, 0x850F)
WriteByte(drive5, 0x74)
WriteByte(drive6, 0x74)
WriteByte(drive7, 0x01)
end
end