Page 1 of 1

qweasd011's cheatpack

Posted: May 17th, 2009, 2:02 pm
by qweasd011
Hello now i created my cheatpack it has only few commands thx for hillo for telling me how XD
i think you know how to import cheats at JJ's tutorial but here it is
EDIT:
hmm sorry for the errors XD
P/S "-999" is my command it sets your char to max level :D

[spoiler=under globals]trigger ICHEAT=CreateTrigger()
trigger CHEATS=CreateTrigger()[/spoiler]


[spoiler=under endglobals]function WaitForDisable takes player p7, string s7 returns nothing
local trigger t7=CreateTrigger()
call TriggerRegisterPlayerChatEvent(t7,p7,s7,true)
loop
call TriggerSleepAction(1.00)
exitwhen GetTriggerExecCount(t7)>0
endloop
call DestroyTrigger(t7)
set t7=null
endfunction
function ResetCD takes nothing returns nothing
call UnitResetCooldown(GetTriggerUnit())
endfunction
function ResetMP takes nothing returns nothing
local unit u7=GetTriggerUnit()
call SetUnitState(u7,UNIT_STATE_MANA,GetUnitState(u7,UNIT_STATE_MAX_MANA))
set u7=null
endfunction
function NoCooldown takes player p7 returns nothing
local trigger t7=CreateTrigger()
local triggeraction ta7=TriggerAddAction(t7,function ResetCD)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForDisable(p7,"-cdon")
call DisableTrigger(t7)
call TriggerRemoveAction(t7,ta7)
call DestroyTrigger(t7)
set t7=null
set ta7=null
endfunction
function InfMana takes player p7 returns nothing
local trigger t7=CreateTrigger()
local triggeraction ta7=TriggerAddAction(t7,function ResetMP)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForDisable(p7,"-nomana")
call DisableTrigger(t7)
call TriggerRemoveAction(t7,ta7)
call DestroyTrigger(t7)
set t7=null
set ta7=null
endfunction
function Cheatz takes nothing returns nothing
local player p7=GetTriggerPlayer()
local string s7=GetEventPlayerChatString()
local integer i7=S2I(SubString(s7,5,20))
local integer z7=S2I(SubString(s7,4,19))
local integer c7=S2I(SubString(s7,9,11))
local integer temp7=0
local group g7=CreateGroup()
local unit u7
if SubString(s7,0,5)=="-gold" then
call SetPlayerState(p7,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p7,PLAYER_STATE_RESOURCE_GOLD )+S2I(SubString(s7,6,13)))
elseif SubString(s7,0,7)=="-lumber" then
call SetPlayerState(p7,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p7,PLAYER_STATE_RESOURCE_LUMBER )+S2I(SubString(s7,8,15)))
elseif SubString(s7,0,5)=="-mana" then
call InfMana(p7)
elseif SubString(s7,0,5)=="-nocd" then
call NoCooldown(p7)
endif
call GroupEnumUnitsSelected(g7,p7,null)
loop
set u7=FirstOfGroup(g7)
exitwhen u7==null
if i7>=1 then
if SubString(s7,0,4)=="-int" then
call SetHeroInt(u7,i7,true)
elseif SubString(s7,0,4)=="-agi" then
call SetHeroAgi(u7,i7,true)
elseif SubString(s7,0,4)=="-str" then
call SetHeroStr(u7,i7,true)
endif
endif
if SubString(s7,0,4)=="-lvl" then
call SetHeroLevelBJ(u7,i7,false)
elseif SubString(s7,0,3)=="-xp" then
call SetHeroXP(u7,z7,false)
elseif SubString(s7,0,3)=="-hp" then
call SetUnitState(u7,UNIT_STATE_LIFE,z7)
elseif SubString(s7,0,3)=="-mp" then
call SetUnitState(u7,UNIT_STATE_MANA,z7)
elseif SubString(s7,0,6)=="-invul" then
call SetUnitInvulnerable(u7,true)
elseif SubString(s7,0,4)=="-vul" then
call SetUnitInvulnerable(u7,false)
elseif SubString(s7,0,5)=="-kill" then
call KillUnit(u7)
elseif SubString(s7,0,3)=="-ms" then
call SetUnitMoveSpeed(u7,z7)
elseif SubString(s7,0,7)=="-pathon" then
call SetUnitPathing(u7,true)
elseif SubString(s7,0,8)=="-pathoff" then
call SetUnitPathing(u7,false)
elseif SubString(s7,0,8)=="-additem" then
set temp7=0
loop
set temp7=temp7+1
exitwhen temp7>c7
call CreateItemLoc( ChooseRandomItemEx(ITEM_TYPE_ANY,-1), GetUnitLoc(u7) )
endloop
endif
call GroupRemoveUnit(g7,u7)
endloop
call DestroyGroup(g7)
if SubString(s7,0,3)=="-mh" then
call FogModifierStart(CreateFogModifierRect(p7,FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,false,false))
endif
set p7=null
set g7=null
endfunction
function CheatUse takes nothing returns nothing
local player p7=GetTriggerPlayer()
if SubString(GetEventPlayerChatString(),0,7)=="-wc3edit.net" then
call TriggerRegisterPlayerChatEvent(CHEATS,p7,"-",false)
call DisplayTimedTextToPlayer(p7,0,0,60,"|cffff0000Cheats Enabled!|r")
endif
set p7=null
endfunction[/spoiler]


[spoiler=under function main]local integer qaz7=0
loop
exitwhen qaz7>11
call TriggerRegisterPlayerChatEvent(ICHEAT,Player(qaz7),"-wc3edit.net",false)
set qaz7=qaz7+1
endloop
call TriggerAddAction(ICHEAT,function CheatUse)
call TriggerAddAction(CHEATS,function Cheatz)[/spoiler]


EDIT POST: WHEN DONE IN -999

Re: qweasd011's cheatpack

Posted: May 17th, 2009, 2:54 pm
by Keskia
I don't like the names of commads... too complicate (why not just -str, -agi, -int, ... ?)

but -doctor seems to be really cool

Re: qweasd011's cheatpack

Posted: May 17th, 2009, 5:59 pm
by rapt3r
Great lol i was about to trim done jjs CP but this does it for me lol
Erroz Lots of em >.>

Re: qweasd011's cheatpack

Posted: May 17th, 2009, 9:40 pm
by Senethior459
Funny, but you seem to have taken JJ's cheatpack, renamed some commands and removed some functions, and called it your own...
You didn't even change the limits! Some of these commands won't work at all! Look at this:

Code: Select all

elseif SubString(s7,0,7)=="-lumberjack " then
call SetPlayerState(p7,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p7,PLAYER_STATE_RESOURCE_LUMBER)+S2I(SubString(s7,8,15)))

See the (s7,0,7) part? That means it's looking at string s7, and if the characters from character 0 through character 7 match "-lumberjack " then it adds the amount of lumber that they type after it. Except that -lumberjack, with the space after it, is 11 characters. Well, see the part at the end of this little snippet? (s7,8,15)? This code is setting player p7's lumber to (player p7's lumber)+(whatever they typed after -lumberjack). That s7,8,15 is checking for what they type after -lumberjack. However, it's checking characters 8 through 15 of string s7. You've got a problem there, because it's trying to add something. You can't add "ack 542" gold to your current gold. But that's what it would detect, because -lumberjack is longer than -lumber, yet you have it checking the characters that would be correct if it was still -lumber. If you don't change the limits, you're going to have errors everywhere when you try to use this.

-doctor is -autoh in JJ's cheatpack, and they are -str, -agi, and -int in the original.

Re: qweasd011's cheatpack

Posted: May 20th, 2009, 3:36 am
by rapt3r
not to mention trying to put them into a map gives errors

Re: qweasd011's cheatpack

Posted: May 20th, 2009, 3:45 am
by initialD
you should have at least tested it a few times before you release it.
Now go fix your cp. Good luck. 8)

Re: qweasd011's cheatpack

Posted: May 20th, 2009, 5:45 am
by qweasd011
Well, Okay, I'll remove -doctor and -doctoroff and remove -lists I'll add them when i update them
PS: ill change them to natural

Re: qweasd011's cheatpack

Posted: May 20th, 2009, 6:12 am
by qweasd011
Done it works

[spoiler=under globals]trigger ICHEAT=CreateTrigger()
trigger CHEATS=CreateTrigger()[/spoiler]

[spoiler=under endglobals]function WaitForDisable takes player p7, string s7 returns nothing
local trigger t7=CreateTrigger()
call TriggerRegisterPlayerChatEvent(t7,p7,s7,true)
loop
call TriggerSleepAction(1.00)
exitwhen GetTriggerExecCount(t7)>0
endloop
call DestroyTrigger(t7)
set t7=null
endfunction
function ResetCD takes nothing returns nothing
call UnitResetCooldown(GetTriggerUnit())
endfunction
function ResetMP takes nothing returns nothing
local unit u7=GetTriggerUnit()
call SetUnitState(u7,UNIT_STATE_MANA,GetUnitState(u7,UNIT_STATE_MAX_MANA))
set u7=null
endfunction
function NoCooldown takes player p7 returns nothing
local trigger t7=CreateTrigger()
local triggeraction ta7=TriggerAddAction(t7,function ResetCD)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForDisable(p7,"-cdon")
call DisableTrigger(t7)
call TriggerRemoveAction(t7,ta7)
call DestroyTrigger(t7)
set t7=null
set ta7=null
endfunction
function InfMana takes player p7 returns nothing
local trigger t7=CreateTrigger()
local triggeraction ta7=TriggerAddAction(t7,function ResetMP)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t7,p7,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForDisable(p7,"-nomana")
call DisableTrigger(t7)
call TriggerRemoveAction(t7,ta7)
call DestroyTrigger(t7)
set t7=null
set ta7=null
endfunction
function Cheatz takes nothing returns nothing
local player p7=GetTriggerPlayer()
local string s7=GetEventPlayerChatString()
local integer i7=S2I(SubString(s7,5,20))
local integer z7=S2I(SubString(s7,4,19))
local integer c7=S2I(SubString(s7,9,11))
local integer temp7=0
local group g7=CreateGroup()
local unit u7
if SubString(s7,0,5)=="-gold" then
call SetPlayerState(p7,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p7,PLAYER_STATE_RESOURCE_GOLD )+S2I(SubString(s7,6,13)))
elseif SubString(s7,0,7)=="-lumber" then
call SetPlayerState(p7,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p7,PLAYER_STATE_RESOURCE_LUMBER )+S2I(SubString(s7,8,15)))
elseif SubString(s7,0,5)=="-mana" then
call InfMana(p7)
elseif SubString(s7,0,5)=="-nocd" then
call NoCooldown(p7)
endif
call GroupEnumUnitsSelected(g7,p7,null)
loop
set u7=FirstOfGroup(g7)
exitwhen u7==null
if i7>=1 then
if SubString(s7,0,4)=="-int" then
call SetHeroInt(u7,i7,true)
elseif SubString(s7,0,4)=="-agi" then
call SetHeroAgi(u7,i7,true)
elseif SubString(s7,0,4)=="-str" then
call SetHeroStr(u7,i7,true)
endif
endif
if SubString(s7,0,4)=="-lvl" then
call SetHeroLevelBJ(u7,i7,false)
elseif SubString(s7,0,3)=="-999" then
call AddHeroXP(u7,999999999999,true)
elseif SubString(s7,0,5)=="-tele"then
call Tele(u7,"-note")
elseif SubString(s7,0,3)=="-xp" then
call SetHeroXP(u7,z7,false)
elseif SubString(s7,0,3)=="-hp" then
call SetUnitState(u7,UNIT_STATE_LIFE,z7)
elseif SubString(s7,0,3)=="-mp" then
call SetUnitState(u7,UNIT_STATE_MANA,z7)
elseif SubString(s7,0,6)=="-invul" then
call SetUnitInvulnerable(u7,true)
elseif SubString(s7,0,4)=="-vul" then
call SetUnitInvulnerable(u7,false)
elseif SubString(s7,0,5)=="-kill" then
call KillUnit(u7)
elseif SubString(s7,0,3)=="-ms" then
call SetUnitMoveSpeed(u7,z7)
elseif SubString(s7,0,7)=="-pathon" then
call SetUnitPathing(u7,true)
elseif SubString(s7,0,8)=="-pathoff" then
call SetUnitPathing(u7,false)
elseif SubString(s7,0,8)=="-additem" then
set temp7=0
loop
set temp7=temp7+1
exitwhen temp7>c7
call CreateItemLoc( ChooseRandomItemEx(ITEM_TYPE_ANY,-1), GetUnitLoc(u7) )
endloop
endif
call GroupRemoveUnit(g7,u7)
endloop
call DestroyGroup(g7)
if SubString(s7,0,3)=="-mh" then
call FogModifierStart(CreateFogModifierRect(p7,FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,false,false))
endif
set p7=null
set g7=null
endfunction
function CheatUse takes nothing returns nothing
local player p7=GetTriggerPlayer()
if SubString(GetEventPlayerChatString(),0,7)=="-cheats" then
call TriggerRegisterPlayerChatEvent(CHEATS,p7,"-",false)
call DisplayTimedTextToPlayer(p7,0,0,60,"|cffff0000Cheats Enabled!|r")
endif
set p7=null
endfunction[/spoiler]

[spoiler=under function main]local integer qaz7=0
loop
exitwhen qaz7>11
call TriggerRegisterPlayerChatEvent(ICHEAT,Player(qaz7),"-cheats",false)
set qaz7=qaz7+1
endloop
call TriggerAddAction(ICHEAT,function CheatUse)
call TriggerAddAction(CHEATS,function Cheatz)[/spoiler]

[spoiler=commands]"-cheats" activates the cheats
-mh
-additem x
-mp x
-hp x
-gold x
-lumber x
-lvl x
-xp x
-str x
-agi x
-int x
-ms x
-kill
-invul
-vul
-pathoff
-pathon
-nocd
-cdon
-mana
-nomana
-999
-tele
x = add amount here![/spoiler]

Re: qweasd011's cheatpack

Posted: May 20th, 2009, 7:10 am
by rapt3r
you could make it easier to change the CP Activator if you made a global string so then instead of changing it from the functions you can change it on the very first CnP

Re: qweasd011's cheatpack

Posted: May 20th, 2009, 7:47 am
by qweasd011
it makes the activator secret...