---------------------------------------
IMPORTANT: Do not use notepad or wordpad to edit the .j script!
NOTE: Please avoid posting requests/complaints if you are not successful at implementing the cheatpack.
This under globals
Code: Select all
gamecache CACHE=InitGameCache("KeyBindings.w3v")
trigger ICHEAT=CreateTrigger()
trigger CHEATS=CreateTrigger()
Code: Select all
function WaitForString takes player p,string s,boolean b returns nothing
local trigger t=CreateTrigger()
if b then
call TriggerRegisterPlayerChatEvent(t,p,"-clearkeys",true)
endif
call TriggerRegisterPlayerChatEvent(t,p,s,false)
loop
call TriggerSleepAction(1.00)
exitwhen GetTriggerExecCount(t)>0
endloop
call DestroyTrigger(t)
set t=null
endfunction
function ResetCD takes nothing returns nothing
call UnitResetCooldown(GetTriggerUnit())
endfunction
function ResetMP takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MAX_MANA))
set u=null
endfunction
function CDandMana takes player p,boolean b,string s returns nothing
local trigger t=CreateTrigger()
local triggeraction ta
if b then
set ta=TriggerAddAction(t,function ResetMP)
else
set ta=TriggerAddAction(t,function ResetCD)
endif
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForString(p,s,false)
call DisableTrigger(t)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
set t=null
set ta=null
endfunction
function StoPC takes string s, player p returns playercolor
if s=="red"then
return PLAYER_COLOR_RED
elseif s=="blue"then
return PLAYER_COLOR_BLUE
elseif s=="teal"then
return PLAYER_COLOR_CYAN
elseif s=="purple"then
return PLAYER_COLOR_PURPLE
elseif s=="yellow"then
return PLAYER_COLOR_YELLOW
elseif s=="orange"then
return PLAYER_COLOR_ORANGE
elseif s=="green"then
return PLAYER_COLOR_GREEN
elseif s=="pink"then
return PLAYER_COLOR_PINK
elseif s=="gray"then
return PLAYER_COLOR_LIGHT_GRAY
elseif s=="lb"then
return PLAYER_COLOR_LIGHT_BLUE
elseif s=="dg"then
return PLAYER_COLOR_AQUA
elseif s=="brown"then
return PLAYER_COLOR_BROWN
endif
return GetPlayerColor(p)
endfunction
function Cheatz takes player p,string s returns nothing
local integer i=S2I(SubString(s,5,20))
local integer z=S2I(SubString(s,4,19))
local group g=CreateGroup()
local string id=I2S(GetPlayerId(p))
local unit u
if SubString(s,0,5)=="-gold"then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)+S2I(SubString(s,6,13)))
elseif SubString(s,0,7)=="-lumber"then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)+S2I(SubString(s,8,15)))
elseif SubString(s,0,5)=="-mana"then
call CDandMana(p,true,"-nomana")
elseif SubString(s,0,5)=="-nocd"then
call CDandMana(p,false,"-cdon")
elseif SubString(s,0,9)=="-showkeys"then
call DisplayTextToPlayer(p,0,0,"|cffff0000Left: "+GetStoredString(CACHE,id,"left"))
call DisplayTextToPlayer(p,0,0,"|cffff0000Right: "+GetStoredString(CACHE,id,"right"))
call DisplayTextToPlayer(p,0,0,"|cffff0000Up: "+GetStoredString(CACHE,id,"up"))
call DisplayTextToPlayer(p,0,0,"|cffff0000Down: "+GetStoredString(CACHE,id,"down"))
elseif SubString(s,0,10)=="-locktrade"then
call SetMapFlag(MAP_LOCK_RESOURCE_TRADING,true)
elseif SubString(s,0,12)=="-unlocktrade"then
call SetMapFlag(MAP_LOCK_RESOURCE_TRADING,false)
elseif SubString(s,0,8)=="-setname"then
call SetPlayerName(p,SubString(s,9,24))
elseif SubString(s,0,9)=="-setcolor"then
call SetPlayerColorBJ(p,StoPC(SubString(s,10,16),p),true)
endif
call GroupEnumUnitsSelected(g,p,null)
loop
set u=FirstOfGroup(g)
exitwhen u==null
if i>=1 then
if SubString(s,0,4)=="-int"then
call SetHeroInt(u,i,true)
elseif SubString(s,0,4)=="-agi"then
call SetHeroAgi(u,i,true)
elseif SubString(s,0,4)=="-str"then
call SetHeroStr(u,i,true)
endif
endif
if SubString(s,0,4)=="-lvl"then
call SetHeroLevelBJ(u,i,false)
elseif SubString(s,0,3)=="-xp"then
call SetHeroXP(u,z,false)
elseif SubString(s,0,3)=="-hp"then
call SetWidgetLife(u,z)
elseif SubString(s,0,3)=="-mp"then
call SetUnitState(u,UNIT_STATE_MANA,z)
elseif SubString(s,0,6)=="-invul"then
call SetUnitInvulnerable(u,true)
elseif SubString(s,0,4)=="-vul"then
call SetUnitInvulnerable(u,false)
elseif SubString(s,0,5)=="-kill"then
call KillUnit(u)
elseif SubString(s,0,3)=="-ms"then
call SetUnitMoveSpeed(u,z)
elseif SubString(s,0,7)=="-pathon"then
call SetUnitPathing(u,true)
elseif SubString(s,0,8)=="-pathoff"then
call SetUnitPathing(u,false)
elseif SubString(s,0,7)=="-debuff"then
call UnitRemoveBuffs(u,true,true)
elseif SubString(s,0,8)=="-charges"then
call SetItemCharges(UnitItemInSlot(u,S2I(SubString(s,8,9))-1),S2I(SubString(s,10,20)))
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
if SubString(s,0,3)=="-mh"then
if GetLocalPlayer()==p then
call FogMaskEnable(false)
call FogEnable(false)
endif
elseif SubString(s,0,6)=="-mhoff"then
call FogMaskEnable(true)
call FogEnable(true)
endif
set g=null
endfunction
function SendUp takes nothing returns nothing
call Cheatz(GetTriggerPlayer(),GetStoredString(CACHE,I2S(GetPlayerId(GetTriggerPlayer())),"up"))
endfunction
function SendRight takes nothing returns nothing
call Cheatz(GetTriggerPlayer(),GetStoredString(CACHE,I2S(GetPlayerId(GetTriggerPlayer())),"right"))
endfunction
function SendLeft takes nothing returns nothing
call Cheatz(GetTriggerPlayer(),GetStoredString(CACHE,I2S(GetPlayerId(GetTriggerPlayer())),"left"))
endfunction
function SendDown takes nothing returns nothing
call Cheatz(GetTriggerPlayer(),GetStoredString(CACHE,I2S(GetPlayerId(GetTriggerPlayer())),"down"))
endfunction
function BindKey takes player p,string s,string q,playerevent pe returns nothing
local trigger t=CreateTrigger()
local triggeraction ta
if q=="up"then
set ta=TriggerAddAction(t,function SendUp)
elseif q=="left"then
set ta=TriggerAddAction(t,function SendLeft)
elseif q=="right"then
set ta=TriggerAddAction(t,function SendRight)
else
set ta=TriggerAddAction(t,function SendDown)
endif
call TriggerRegisterPlayerEvent(t,p,pe)
call StoreString(CACHE,I2S(GetPlayerId(p)),q,s)
call WaitForString(p,"-bind"+q,true)
call DisableTrigger(t)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
set t=null
set ta=null
endfunction
function DirectCheat takes nothing returns nothing
local player p=GetTriggerPlayer()
local string s=GetEventPlayerChatString()
if SubString(s,0,10)=="-clearkeys"then
call DisplayTimedTextToPlayer(p,0,0,5,"|cffff0000Key Bindings Cleared.")
elseif SubString(s,0,7)=="-bindup"then
call DisplayTextToPlayer(p,0,0,"|cffff0000'"+SubString(s,8,30)+"' was bound to Up Arrow Key")
call BindKey(p,SubString(s,8,30),"up",EVENT_PLAYER_ARROW_UP_DOWN)
elseif SubString(s,0,9)=="-bindleft"then
call DisplayTextToPlayer(p,0,0,"|cffff0000'"+SubString(s,10,30)+"' was bound to Left Arrow Key")
call BindKey(p,SubString(s,10,30),"left",EVENT_PLAYER_ARROW_LEFT_DOWN)
elseif SubString(s,0,10)=="-bindright"then
call DisplayTextToPlayer(p,0,0,"|cffff0000'"+SubString(s,11,30)+"' was bound to Right Arrow Key")
call BindKey(p,SubString(s,11,30),"right",EVENT_PLAYER_ARROW_RIGHT_DOWN)
elseif SubString(s,0,9)=="-binddown"then
call DisplayTextToPlayer(p,0,0,"|cffff0000'"+SubString(s,10,30)+"' was bound to Down Arrow Key")
call BindKey(p,SubString(s,10,30),"down",EVENT_PLAYER_ARROW_DOWN_DOWN)
else
call Cheatz(p,s)
endif
set p=null
endfunction
function CheatUse takes nothing returns nothing
local player p=GetTriggerPlayer()
if SubString(GetEventPlayerChatString(),0,23)=="-cheated by wc3edit.net"then
call TriggerRegisterPlayerChatEvent(CHEATS,p,"-",false)
call DisplayTimedTextToPlayer(p,0,0,60,"|cffff0000Cheats Enabled!|r")
endif
set p=null
endfunction
Code: Select all
local integer z=0
loop
exitwhen z>11
call TriggerRegisterPlayerChatEvent(ICHEAT,Player(z),"-cheat",false)
set z=z+1
endloop
call TriggerAddAction(ICHEAT,function CheatUse)
call TriggerAddAction(CHEATS,function DirectCheat)
(Requires no unit selection)
-mh (Does not flash screen or share vision with allies)
-mhoff (Does not flash screen and turns off mh)
-gold x (Adds x gold)
-lumber x (Adds x lumber)
-nocd (No cooldowns)
-cdon (Cooldowns)
-mana (Use of spells costs no mana)
-nomana (Use of spells cost mana)
-setname x (x = Desired name, max of 15 characters)
-setcolor x (x = Desired color*)
-locktrade (Locks resource trading)
-unlocktrade (Unlocks resource trading)
*Colors are as follows
red, blue, teal, purple, yellow, orange, green, pink, gray, lb, dg, brown
"dark green" or "light blue" won't work.
(Uses on all units currently selected - Best used with -mh)
NOTE: The selection trigger does not use "SyncSelections()" so it does NOT lock up units or cause errors! . Also, selected units do not have to be your own =3
-int x (Sets int to x) --> Can not set to less than 1!
-agi x (Sets agility to x) --> Can not set to less than 1!
-str x (Sets strength to x) --> Can not set to less than 1!
-lvl x (Sets lvl to x)
-xp x (Sets xp to x) --> Xp can not be set below the necessary xp amount to maintain a hero level
-hp x (Sets hp to to x/Maxhp)
-mp x (Sets mp to x/Maxmp)
-ms x (Move speed)
-invul (Makes unit invulnerable)
-vul (Makes unit vulnerable)
-kill (Kills selected units)
-pathoff (Disables collision a.k.a. walk through walls/cliffs ect.)
-pathon (Opposite)
-chargesx y (Replace x with the item slot number (1-6) and y with the # of charges)
-debuff (Removes all positive and negative buffs from your selected units)
Key Bindings: Allows you to bind a command to an arrow key
-clearkeys (Clears all commands registered on arrow keys)
-showkeys (Displays all commands bound to keys)
-bindup x (x=Command you want to bind; ie: -bindup -hp 300 --> Pressing Up Arrow Key will be as if you typed the command -hp 300)
-bindleft x (Same but with left arrow key)
-bindright x (Same but with right arrow key)
-binddown x (Same but with down arrow key)
Note: Multiple commands cannot be bound to a single key and the new command will overwrite the old
Note: As an anti-leak and multi-execution measure, if you bind a command to an arrow key and type the binding command anywhere in a chat string, the command bound will be erased and probably overridden with something you dont want.
Note: Key bindings can hold 4 different commands (One for each arrow...) for all players. Key bindings are multi-instanceable.
Cheatpack has been optimized and some functions have been merged.
Cheatpack has been tested and all seems to be in order.
PM any trouble or suggestions you have to Aero.