HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

condition for custom ability

12-11-2003, 04:42 AM#1
woodbulb
Ok.... i've been through 95% of all hero learns custom ability condition and I've tried using custom text. Whenever i use custom text it says compile error when i save (expression expected at part where i specified skill)

Here is an example of my custom text:
function Trig_duel_wield_up_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00B:Aamk' ) ) then
return false
endif
return true
endfunction

function Trig_duel_wield_up_Actions takes nothing returns nothing
set udg_Duel_Wield[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))] = true
endfunction

//===========================================================================
function InitTrig_duel_wield_up takes nothing returns nothing
set gg_trg_duel_wield_up = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_duel_wield_up, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_duel_wield_up, Condition( function Trig_duel_wield_up_Conditions ) )
call TriggerAddAction( gg_trg_duel_wield_up, function Trig_duel_wield_up_Actions )
endfunction

What this trigger means is:
Events:
hero learns skill
Conditions:
learned skill equal to <my custom skill based on attribute bonus>
Actions:
set duel_wield(# of owner of learning hero)= True

Help me plz cause this doesn't work :(
12-11-2003, 05:04 AM#2
QuatreDan
Well, I'm only educated in BASIC which is only so similar to JASS, but correct me if I'm wrong. Isn't the syntax of that first function you have there a little off?
Quote:
function Trig_duel_wield_up_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00B:Aamk' ) ) then
return false
endif
return true
endfunction


Shouldn't the second return be part of the If statement like this?:
function Trig_duel_wield_up_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00B:Aamk' ) ) then
return false
else
return true
endif
endfunction
______________________________

Because...the way you have it, I think...maybe it only takes the first return in a function...but anyway...the way you have it, wouldn't it return true no matter what? Cuz if it isn't your ability and it returns false but then returns true right afterwards, wouldn't that sort of cancel out your condition? Anyway...maybe I just don't know what I'm talking about...if I do happen to be right then...yay! :ggani:
Otherwise...oh well... :( Can't say that I didn't try.
12-11-2003, 05:11 AM#3
Aristotle
The game may not recognize your custom ability as an ability.
12-11-2003, 07:16 AM#4
RicFaith
Quote:
Originally posted by woodbulb
Here is an example of my custom text:
function Trig_duel_wield_up_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00B:Aamk' ) ) then
return false
endif
return true
endfunction


The error is here :
if ( not ( GetLearnedSkillBJ() == 'A00B' ) ) then

well you can see the only error is the missing ":Aamk". it's not supposed to be there.