S
sonic_kun
Guest
OK I'm new at this even though I've done abit of java before so I'm probably gonna have alotta qusetions.......hence this thread
How exactly does the "condition" function in JASS work? I've seen an example in Daelin's tutorial where he writes something like this:
function Cond takes nothing returns boolean
return GetSpellAbilityId() == ‘A000’
endfunction
as opposed to the default WE way of doing it by using ifs and nots and what not else.......
function Trig_Untitled_Trigger_001_Copy_Conditions takes nothing returns boolean
if ( not ( IsUnitInGroup(gg_unit_H005_0125, GetUnitsOfPlayerAll(Player(1))) == true ) ) then
return false
endif
if ( not ( IsUnitInGroup(gg_unit_H005_0034, GetUnitsOfPlayerAll(Player(1))) == true ) ) then
return false
endif
if ( not ( IsUnitInGroup(gg_unit_E001_0033, GetUnitsOfPlayerAll(Player(1))) == true ) ) then
return false
endif
return true
endfunction
In the above function, I want each of those conditions to be true (it's not an "or" function) So I tried combining the 2, by doing:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
return IsUnitInGroup(gg_unit_H005_0125, GetUnitsOfPlayerAll(Player(1)))== true
return IsUnitInGroup(gg_unit_H005_0034, GetUnitsOfPlayerAll(Player(1))) == true
return IsUnitInGroup(gg_unit_E001_0033, GetUnitsOfPlayerAll(Player(1))) == true
endfunction
But instead of doing what I wanted, the trigger functioned like an "or" condition........of O want to use this method of writing the conditions, how should I write the condition function so that the actions will run only if all the conditions are fulfilled?
How exactly does the "condition" function in JASS work? I've seen an example in Daelin's tutorial where he writes something like this:
function Cond takes nothing returns boolean
return GetSpellAbilityId() == ‘A000’
endfunction
as opposed to the default WE way of doing it by using ifs and nots and what not else.......
function Trig_Untitled_Trigger_001_Copy_Conditions takes nothing returns boolean
if ( not ( IsUnitInGroup(gg_unit_H005_0125, GetUnitsOfPlayerAll(Player(1))) == true ) ) then
return false
endif
if ( not ( IsUnitInGroup(gg_unit_H005_0034, GetUnitsOfPlayerAll(Player(1))) == true ) ) then
return false
endif
if ( not ( IsUnitInGroup(gg_unit_E001_0033, GetUnitsOfPlayerAll(Player(1))) == true ) ) then
return false
endif
return true
endfunction
In the above function, I want each of those conditions to be true (it's not an "or" function) So I tried combining the 2, by doing:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
return IsUnitInGroup(gg_unit_H005_0125, GetUnitsOfPlayerAll(Player(1)))== true
return IsUnitInGroup(gg_unit_H005_0034, GetUnitsOfPlayerAll(Player(1))) == true
return IsUnitInGroup(gg_unit_E001_0033, GetUnitsOfPlayerAll(Player(1))) == true
endfunction
But instead of doing what I wanted, the trigger functioned like an "or" condition........of O want to use this method of writing the conditions, how should I write the condition function so that the actions will run only if all the conditions are fulfilled?