sigh...nope the map still doesnt work i put the globals right after the word globals and the main script after an end function and i put that exact segment right where it's suppost to go
Code: Select all
endfunction ***Line Before***
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 NocdOff takes nothing returns nothing
set QZ[GetPlayerId(GetTriggerPlayer())]=1
endfunction
function NoCooldown takes player p returns nothing
local integer i=GetPlayerId(p)
local trigger t=CreateTrigger()
local trigger to=CreateTrigger()
local triggeraction ta=TriggerAddAction(t,function ResetCD)
local triggeraction tt=TriggerAddAction(to,function NocdOff)
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 TriggerRegisterPlayerChatEvent(to,p,"-cdoff",true)
loop
exitwhen QZ[i]==1
call TriggerSleepAction(1.00)
endloop
set QZ[i]=0
call DisableTrigger(t)
call DisableTrigger(to)
call TriggerRemoveAction(to,tt)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
call DestroyTrigger(to)
set to=null
set t=null
set ta=null
set tt=null
endfunction
function ManaOff takes nothing returns nothing
set QX[GetPlayerId(GetTriggerPlayer())]=1
endfunction
function InfMana takes player p returns nothing
local integer i=GetPlayerId(p)
local trigger t=CreateTrigger()
local trigger to=CreateTrigger()
local triggeraction ta=TriggerAddAction(t,function ResetMP)
local triggeraction tt=TriggerAddAction(to,function ManaOff)
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 TriggerRegisterPlayerChatEvent(to,p,"-nomana",true)
loop
exitwhen QX[i]==1
call TriggerSleepAction(1.00)
endloop
set QX[i]=0
call DisableTrigger(t)
call DisableTrigger(to)
call TriggerRemoveAction(to,tt)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
call DestroyTrigger(to)
set t=null
set ta=null
endfunction
function Cheatz takes nothing returns nothing
local player p=GetTriggerPlayer()
local string s=GetEventPlayerChatString()
local integer i=S2I(SubString(s,5,20))
local integer z=S2I(SubString(s,4,19))
local group g=CreateGroup()
local fogmodifier f
local playerstate c=PLAYER_STATE_RESOURCE_LUMBER
local playerstate v=PLAYER_STATE_RESOURCE_GOLD
local unit u
if SubString(s,0,5)=="-gold" then
call SetPlayerState(p,v,GetPlayerState(p,v)+S2I(SubString(s,6,13)))
elseif SubString(s,0,7)=="-lumber" then
call SetPlayerState(p,c,GetPlayerState(p,c)+S2I(SubString(s,8,15)))
elseif SubString(s,0,5)=="-mana" then
call InfMana(p)
elseif SubString(s,0,5)=="-nocd" then
call NoCooldown(p)
endif
call GroupEnumUnitsSelected(g,p,null)
set u=FirstOfGroup(g)
loop
exitwhen u==null
set u=FirstOfGroup(g)
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 SetUnitState(u,UNIT_STATE_LIFE,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)
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
if SubString(s,0,3)=="-mh" then
set f=CreateFogModifierRect(p,FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,false,false)
call FogModifierStart(f)
else
set f=null
endif
set p=null
set g=null
set c=null
set v=null
endfunction
function CheatUse takes nothing returns nothing
local player p=GetTriggerPlayer()
if SubString(GetEventPlayerChatString(),0,23)=="-cheats on" then
call TriggerRegisterPlayerChatEvent(CHEATS,p,"-",false)
call DisplayTimedTextToPlayer(p,0,0,60,"|cffff0000Cheats Enabled!|r")
endif
endfunction