Page 1 of 2

Setting hero agi, str and int HELP!

Posted: March 18th, 2007, 8:56 pm
by vosszaa
trigger gg_trg_Str=null

function Trig_Str_Actions takes nothing returns nothing
call SetHeroStr( GetTriggerUnit(), S2I(SubStringBJ(GetEventPlayerChatString(), 5, 20)), true )
endfunction

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

call InitTrig_Str()



i adopted this code from the -gold code(which works fine) but somehow i cant get this to work.

I change the red text into "GetEnumUnit" but still..desnt work

Is there anything to do with the red text..? or my code just wrong..? can somebody correct my code..?

Thx..

Posted: March 18th, 2007, 9:04 pm
by Kala-cha
It's the red coding, -_-, I don't know how to do JASS but if there's red coding, it's wrong lol.

Posted: March 18th, 2007, 9:09 pm
by vosszaa
Kala-cha wrote:It's the red coding, -_-, I don't know how to do JASS but if there's red coding, it's wrong lol.


Its not the red code!! - -'

I just hightlight it when post just to let u know which text im talkn about..

Posted: March 18th, 2007, 9:12 pm
by Aero

Code: Select all

trigger gg_trg_Str=null

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 group g=CreateGroup()
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),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", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Str, Player(1), "-str", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Str, Player(2), "-str", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Str, Player(3), "-str", true )
call TriggerAddAction( gg_trg_Str, function Trig_Str_Actions )
endfunction

call InitTrig_Str()

Posted: March 18th, 2007, 9:42 pm
by Kala-cha
What? lol, I'm just stupid I guess ^_^

Posted: March 18th, 2007, 9:58 pm
by vosszaa
Err... I have a problems >_<

I already declare "trigger gg_trg_Str=null"

I already put your codes in function.

I already put "call InitTrig_Str()" under function main

Still doesnt work..>_<

What did i do wrong ??

Posted: March 18th, 2007, 10:35 pm
by Aero
Should be quite alright...
Declare trigger gg_trg_Str=null in globals
Call InitTrig_Str() in function main

All you need to do is put the code in

Posted: March 18th, 2007, 11:49 pm
by vosszaa
err.. Nope! still doesnt work.

I did everything correctly in part of declareration and in the part of function main

And for the codes i just copy and paste, nothing changed.

I try put in few different maps like footman, blademaster, hero war EE etc etc

None of them works..

Dont u have a code that more simple than this one(its look complicated to me @_@)? Coz Xantan said its similar to the -gold code.

Posted: March 19th, 2007, 12:14 am
by Aero
Oh shit here's the problem

"TriggerRegisterPlayerChatEvent"

call TriggerRegisterPlayerChatEvent( gg_trg_Str, Player(0), "-str", true )

At the end it says true
True means "exact match"
Change it to false and it will work

I guess I should of looked at InitTrig too instead of assuming it was correct

Posted: March 19th, 2007, 12:41 am
by vosszaa
Its working now ^^

Thx