Setting hero agi, str and int HELP!

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
vosszaa
Old Wrinkly Member
Posts: 247
Joined: March 7th, 2007, 7:04 am

Post by vosszaa »

err... problems again - -a

Once i put -str, -agi and -int codes together like this..
::Declare in globals::
trigger gg_trg_Str=null
trigger gg_trg_Agi=null
trigger gg_trg_Int=null
==========

-str part ===

function SetStr takes nothing returns nothing
call SetHeroStr(GetEnumUnit(),S2I(SubString(GetEventPlayerChatString(),4,20)),true)
endfunction

function HerosOnly takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Str_Actions takes nothing returns nothing
local player p=GetTriggerPlayer()
local group g=CreateGroup()
call GroupEnumUnitsOfPlayer(g,p,Condition(function HerosOnly))
call ForGroup(g,function SetStr)
call DestroyGroup(g)
set g=null
endfunction

function InitTrig_Str takes nothing returns nothing
set gg_trg_Str = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Str, Player(0), "-str", false )
call TriggerAddAction( gg_trg_Str, function Trig_Str_Actions )
endfunction

-agi part ===

function SetAgi takes nothing returns nothing
call SetHeroAgi(GetEnumUnit(),S2I(SubString(GetEventPlayerChatString(),4,20)),true)
endfunction

function HerosOnly takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Agi_Actions takes nothing returns nothing
local player p=GetTriggerPlayer()
local group g=CreateGroup()
call GroupEnumUnitsOfPlayer(g,p,Condition(function HerosOnly))
call ForGroup(g,function SetAgi)
call DestroyGroup(g)
set g=null
endfunction

function InitTrig_Agi takes nothing returns nothing
set gg_trg_Agi = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Agi, Player(0), "-agi", false )
call TriggerAddAction( gg_trg_Agi, function Trig_Agi_Actions )
endfunction

-int part ===

function SetInt takes nothing returns nothing
call SetHeroInt(GetEnumUnit(),S2I(SubString(GetEventPlayerChatString(),4,20)),true)
endfunction

function HerosOnly takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction

function Trig_Int_Actions takes nothing returns nothing
local player p=GetTriggerPlayer()
local group g=CreateGroup()
call GroupEnumUnitsOfPlayer(g,p,Condition(function HerosOnly))
call ForGroup(g,function SetInt)
call DestroyGroup(g)
set g=null
endfunction

function InitTrig_Int takes nothing returns nothing
set gg_trg_Int = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Int, Player(0), "-int", false )
call TriggerAddAction( gg_trg_Int, function Trig_Int_Actions )
endfunction

::In function main::
call InitTrig_Str()
call InitTrig_Agi()
call InitTrig_Int()
==========
It said "the map was not found" when i create the game..

But it will works if i only put -str code only.. so weird eh :?

Oh btw, i just want only player red "player (0)" (host) can cheat. So, i delete the othe player lines.
Image

The tallest tower.. begins from the ground
Today, you are novice..
Tomorrow, you might be The Master..
And when you are..
Vosszaa will hunt you down..
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Post by Aero »

It's because you have the "function HerosOnly" 3 times which is an error, you only need to declare it once

I took the liberty of merging your functions too...how nice ^.^

trigger gg_trg_Stats=null

function HerosOnly takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true)
endfunction
function SetStr takes nothing returns nothing
call SetHeroStr(GetEnumUnit(),S2I(SubString(GetEventPlayerChatString(),4,20)),true)
endfunction
function SetAgi takes nothing returns nothing
call SetHeroAgi(GetEnumUnit(),S2I(SubString(GetEventPlayerChatString(),4,20)),true)
endfunction
function SetInt takes nothing returns nothing
call SetHeroInt(GetEnumUnit(),S2I(SubString(GetEventPlayerChatString(),4,20)),true)
endfunction

function SetStats takes nothing returns nothing
local group g=CreateGroup()
local string s=SubString(GetEventPlayerChatString(),0,4)
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Condition(function HerosOnly))
call DestroyBoolExpr(Condition(function HerosOnly))
if s=="-str" then
call ForGroup(g,function SetStr)
endif
if s=="-agi" then
call ForGroup(g,function SetAgi)
endif
if s=="-int" then
call ForGroup(g,function SetInt)
endif
call DestroyGroup(g)
set g=null
endfunction

function InitTrig_Stats takes nothing returns nothing
set gg_trg_Stats=CreateTrigger()
call TriggerRegisterPlayerChatEvent(gg_trg_Stats,Player(0),"-str",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Stats,Player(0),"-agi",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Stats,Player(0),"-int",false)
call TriggerAddAction(gg_trg_Stats,function SetStats)
endfunction

call InitTrig_Stats()