我找到方法了,谢谢大家的回复。
只需要下面的代码就可以自动攻击人形怪就是心魔怪了。
local pattern = "27 E0 ?? ??"
-- 扫描所有27E开头的地址
local addresses = AOBScan("27 E0 * * * * * *")
if addresses == nil then
showMessage("未找到27E开头的地址模式")
return
end
local count = addresses.Count
print(string.format("找到 %d 个27E开头的地址", count))
local modifiedCount = 0
for i = 0, count - 1 do
local addressStr = addresses[i]
local address = tonumber(addressStr, 16)
if address then
-- 确保在27E范围内
if address >= 0x27E00000 and address <= 0x27EFFFFF then
local currentValue = readInteger(address)
if currentValue ~= nil then
-- 尝试写入
local success = writeInteger(address, targetValue)
if success then
print(string.format("修改 0x%X: 0x%X → 0x%X",
address, currentValue, targetValue))
modifiedCount = modifiedCount + 1
-- 创建内存记录
CreateMemoryRecord(address, currentValue, targetValue)
end
end
end
end
end
addresses.destroy()
print(string.format("\n高级扫描完成"))
print(string.format("成功修改了 %d 个地址", modifiedCount))
showMessage(string.format("高级扫描完成!\n修改了 %d 个27E开头的地址", modifiedCount))
end
-- 创建内存记录
function CreateMemoryRecord(address, oldValue, newValue)
local al = getAddressList()
if al then
local mr = al.createMemoryRecord()
mr.Description = string.format("27E_Static_0x%X", address)
mr.Address = string.format("%X", address)
mr.Type = vtDword
mr.Active = true
mr.Comment = string.format("静态基址 | 原始: 0x%X | 新值: 0x%X", oldValue, newValue)
end
end
-- 使用特定基址范围的方法
function ModifySpecific27EAddresses()
-- 目标值
local targetValue = 0x0D867778
-- 可能的关键地址列表(可以根据扫描结果添加)
local keyAddresses = {
0x27E083B0, -- 你提到的地址
0x27E00000,
0x27E01000,
0x27E02000,
-- 可以添加更多
}
print("=== 修改特定27E地址 ===")
local modifiedCount = 0
for i, address in ipairs(keyAddresses) do
local currentValue = readInteger(address)
if currentValue ~= nil then
local success = writeInteger(address, targetValue)
if success then
print(string.format("0x%X: 0x%X → 0x%X",
address, currentValue, targetValue))
modifiedCount = modifiedCount + 1
-- 添加到地址列表
AddToAddressList(address, currentValue, targetValue)
end
end
end
print(string.format("修改了 %d 个特定地址", modifiedCount))
showMessage(string.format("已修改 %d 个特定27E地址", modifiedCount))
end
-- 主菜单
function ShowMenu()
local choice = messageDialog(
"选择操作模式:\n\n"..
"1. 全范围扫描并修改(慢但全面)\n"..
"2. 高级模式扫描\n"..
"3. 修改特定已知地址\n"..
"4. 修改单个地址 27E083B0",
mtInformation, mbYesNoCancel)
if choice == mrYes then
-- 选项1
FindAndModify27EAddresses()
elseif choice == mrNo then
-- 选项2
AdvancedScanAndModify()
elseif choice == mrCancel then
-- 选项3
ModifySpecific27EAddresses()
else
-- 选项4:修改单个地址
local address = 0x27E083B0
local targetValue = 0x0D867778
local current = readInteger(address)
if current ~= nil then
writeInteger(address, targetValue)
showMessage(string.format("修改 27E083B0:\n0x%X → 0x%X", current, targetValue))
else
showMessage("无法读取地址 27E083B0")
end
end
end
-- 执行主菜单
ShowMenu() |