Can anyone explain why these two triggers give an error message before startup of the map?
First one, checks for attacker if its a hero, if so, add an event regarding the attacked target being damaged, where the second trigger takes final data
Second one, checks if the damage source is the mountain king, if so, add exp to the damage source
Please note that I am lazy, so I didn't have time to add RemoveTriggerAction - that trigger (points to the second one)
Can anyone detect flaws? if so, correct them for me so I may learn from my mistakes, also, any other aspects of the script you'd like to change, please tell me
First one, checks for attacker if its a hero, if so, add an event regarding the attacked target being damaged, where the second trigger takes final data
JASS:
function CondExp takes nothing returns boolean
if ( IsUnitType(GetAttacker(),UNIT_TYPE_HERO)) then
return true
endif
return false
endfunction
function givexp takes nothing returns nothing
call DisplayTextToForce(GetPlayersAll(), "Lulzor - 1")
call TriggerRegisterUnitEvent(gg_trg_dmg, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
endfunction
//===========================================================================
function InitTrig_ExpAtAttack takes nothing returns nothing
local integer u
set gg_trg_ExpAtAttack = CreateTrigger( )
set u=0
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_ExpAtAttack, Player(u), EVENT_PLAYER_UNIT_ATTACKED,null)
exitwhen u==16
set u=u+1
endloop
call TriggerAddCondition(gg_trg_ExpAtAttack, Condition( function CondExp))
call TriggerAddAction( gg_trg_ExpAtAttack, function givexp)
endfunction
Second one, checks if the damage source is the mountain king, if so, add exp to the damage source
JASS:
function CondDmg takes nothing returns boolean
if (GetUnitTypeId(GetEventDamageSource())!= 'Hmkg') then
return false
endif
return true
endfunction
function dmg takes nothing returns nothing
call DisplayTextToForce(GetPlayersAll(), "Lulzor - 2")
call AddHeroXP(GetEventDamageSource(), 200, true)
endfunction
//===========================================================================
function InitTrig_dmg takes nothing returns nothing
set gg_trg_dmg = CreateTrigger( )
call TriggerAddCondition( gg_trg_dmg, Condition( function CondDmg))
call TriggerAddAction( gg_trg_dmg, function dmg )
endfunction
Please note that I am lazy, so I didn't have time to add RemoveTriggerAction - that trigger (points to the second one)
Can anyone detect flaws? if so, correct them for me so I may learn from my mistakes, also, any other aspects of the script you'd like to change, please tell me