0% found this document useful (0 votes)
13 views4 pages

Crime Lua

The document contains Lua code for handling crime events and battles in a game. It defines functions to find inventory items, handle crime dialogs, assign variables for crime types and superpowers, and process turns in battles using the assigned superpowers.

Uploaded by

kkinoy178
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

Crime Lua

The document contains Lua code for handling crime events and battles in a game. It defines functions to find inventory items, handle crime dialogs, assign variables for crime types and superpowers, and process turns in battles using the assigned superpowers.

Uploaded by

kkinoy178
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

function findItem(id)

for _, itm in pairs(getInventory()) do


if itm.id == id then
return itm.amount
end
end
return 0
end

function crime(var)
if var[0] == "OnDialogRequest" then
if var[1]:find("Ms%. Terry") and var[1]:find("Ban Hammer") then
ban = "yes"
return true
end
if var[1]:find("|Battle%!|") then
x = var[1]:match("tilex|(%d+)")
y = var[1]:match("tiley|(%d+)")
logToConsole("`9Villian : `3" .. var[1]:match("add_textbox|(.*)`` is"))
if var[1]:find("Crime in Progress") then
c1 = 2298
c2 = 2308
c3 = 2320
c4 = 2324
c5 = 2332
end
if var[1]:find("Jimmy Snow") then
use1 = c5
use2 = c4
use3 = c3
elseif var[1]:find("Big Bertha") then
use1 = c1
use2 = c4
use3 = c3
elseif var[1]:find("Shockinator") then
use1 = c4
use2 = c3
use3 = c1
elseif var[1]:find("The Firebug") then
use1 = c2
use2 = c1
use3 = c5
elseif var[1]:find("Generic Thug") or var[1]:find("Kat 5") then
use1 = c4
use2 = c3
use3 = c2
elseif var[1]:find("Professor Pummel") then
c1 = 2296
c2 = 2298
c3 = 2300
c4 = 2320
c5 = 2324
use1 = c3
use2 = c2
use3 = c1
elseif var[1]:find("Z%. Everett Koop") then
c1 = 2296
c2 = 2298
c3 = 2300
c4 = 2320
c5 = 2324
use1 = c3
use2 = c1
use3 = c2
elseif var[1]:find("Dr%. Destructo") then
c1 = 2298
c2 = 2308
c3 = 2310
c4 = 2314
c5 = 2316
step = "0"
use1 = c1
use2 = c3
use3 = c5
elseif var[1]:find("Dragon Hand") or var[1]:find("Almighty Seth") then
c1 = 2308
c2 = 2312
c3 = 2314
c4 = 2326
c5 = 2328
use1 = c5
use2 = c4
use3 = 6969
elseif var[1]:find("Devil Ham") then
c1 = 2310
c2 = 2316
c3 = 2322
c4 = 2334
c5 = 2338
use1 = c1
use2 = c2
use3 = c3
use4 = c5
step = "0"
elseif var[1]:find("Ms%. Terry") then
c1 = 2294
c2 = 2316
c3 = 2322
c4 = 2328
c5 = 2338
use1 = c1
use2 = c2
use3 = c3
use4 = c4
use5 = c5
ban = "no"
end
if findItem(c1) == 0 or findItem(c2) == 0 or findItem(c3) == 0 or
findItem(c4) == 0 or findItem(c5) == 0 then
logToConsole("Superpower Cards are not enough!")
sendPacket(2, "action|dialog_return\ndialog_name|crime_edit\ntilex|" ..
x .."|\ntiley|" .. y .. "|\nstate|0||\nbuttonClicked|button_cancel")
else
sendPacket(2,"action|dialog_return\ndialog_name|crime_edit\ntilex|" ..
x .."|\ntiley|" .. y .."|\nstate|0||\nbuttonClicked|button_ok\n\nc" .. c1 .. "|1\
nc" .. c2 .. "|1\nc" .. c3 .. "|1\nc" .. c4 .. "|1\nc" .. c5 .. "|1\n")
end
return true
elseif var[1]:find("Fighting Crime") and var[1]:find("Devil Ham") then
if var[1]:find("is going to play `%d") then
if var[1]:match("is going to play `(%d)") == "1" then
use = use4
elseif var[1]:match("is going to play `(%d)") ~= "1" then
use = use2
end
elseif var[1]:find("c" .. use3) and step == "0" then
step = "1"
use = use3
elseif var[1]:find("c" .. use2) then
use = use2
elseif var[1]:find("c" .. use1) then
use = use1
else
use = "passturn"
end
logToConsole("Fighting... Please Wait")
sendPacket(2,"action|dialog_return\ndialog_name|crime_edit\ntilex|" ..
x .. "|\ntiley|" .. y .. "|\nstate|1||\nbuttonClicked|c" .. use)
return true
elseif var[1]:find("Fighting Crime") and var[1]:find("Ms%. Terry") then
if var[1]:find("is going to play `%d") then
if var[1]:match("is going to play `(%d)") == "2" then
use = use1
elseif var[1]:match("is going to play `(%d)") == "4" then
use = use2
elseif var[1]:match("is going to play `(%d)") == "9" then
use = use4
elseif var[1]:match("is going to play `(%d)") == "1" then
use = use5
end
elseif var[1]:find("c" .. use3) then
use = use3
elseif var[1]:find("c" .. use5) and ban=="yes" then
use = use5
elseif var[1]:find("c" .. use1) then
use = use1
elseif var[1]:find("c" .. use4) then
use = use4
elseif var[1]:find("c" .. use5) then
use = use5
elseif var[1]:find("c" .. use2) then
use = use2
else
use = "passturn"
end
logToConsole("Fighting... Please Wait")
sendPacket(2, "action|dialog_return\ndialog_name|crime_edit\ntilex|" ..
x .. "|\ntiley|" .. y .. "|\nstate|1||\nbuttonClicked|c" .. use)
return true
elseif var[1]:find("Fighting Crime") and var[1]:find("Dr%. Destructo") then
if var[1]:find("c" .. use1) and step == "0" then
use = use1
step = "1"
elseif var[1]:find("c" .. use2) then
use = use2
elseif var[1]:find("c" .. use3) then
use = use3
else
use = "passturn"
end
logToConsole("Fighting... Please Wait")
sendPacket(2, "action|dialog_return\ndialog_name|crime_edit\ntilex|" ..
x .. "|\ntiley|" .. y .. "|\nstate|1||\nbuttonClicked|c" .. use)
return true
elseif var[1]:find("Fighting Crime") then
if var[1]:find("c" .. use1) then
use = use1
elseif var[1]:find("c" .. use2) then
use = use2
elseif var[1]:find("c" .. use3) then
use = use3
else
use = "passturn"
end
logToConsole("Fighting... Please Wait")
sendPacket(2, "action|dialog_return\ndialog_name|crime_edit\ntilex|" ..
x .. "|\ntiley|" .. y .. "|\nstate|1||\nbuttonClicked|c" .. use)
return true
elseif var[1]:find("embed_data|state|2|") or var[1]:find("embed_data|state|
3|") then
return true
end
end
end

AddHook("OnVarlist", "acrme", crime)

You might also like