Hi,
Im making a survival map where i have a worker (Which is a hero) that gains gold per hit on a Gold mine that is enemy and player 11 (Dark green). gain is based on strenght.
But i also want xp per hit so he can lvl without fighting cuz mines are too far away from battle and getting xp would make the map fail (need constant gold income)... so what trigger or jass i need to do that his hit make him gain xp ? ive tried to make it without JASS. Since i didnt find any way to do it i figured it was doable with JASS trigger maybe. Problem is... JASS is chinese to me ....
Thanks in advande
Note gold gained isnt based on a spell but simple trigger that add to the attaking unit his str to his current gold. Id like to know how to do the same for XP
EDIT: so i made a trigger (GUI) that looked like that
Gave me this as JASS
-------------------------------------------
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetAttacker()) == 'H002' ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetAttackedUnitBJ()) == Player(10) ) ) then
return false
endif
return true
endfunction
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001001001 takes nothing returns boolean
return ( GetUnitTypeId(GetAttacker()) == 'H002' )
endfunction
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001002 takes nothing returns nothing
call AdjustPlayerStateBJ( 2, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Actions takes nothing returns nothing
call ForForce( GetPlayersMatching(Condition(function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001001001)), function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001002 )
endfunction
//===========================================================================
function InitTrig_XP_per_hit_Achak_Copy_Copy_Copy_Copy takes nothing returns nothing
set gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy, Condition( function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Conditions ) )
call TriggerAddAction( gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy, function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Actions )
endfunction
-----------------------------------------------------------
so i wanna know how i can change player_state_ressource_gold, 2 to XP
Im making a survival map where i have a worker (Which is a hero) that gains gold per hit on a Gold mine that is enemy and player 11 (Dark green). gain is based on strenght.
But i also want xp per hit so he can lvl without fighting cuz mines are too far away from battle and getting xp would make the map fail (need constant gold income)... so what trigger or jass i need to do that his hit make him gain xp ? ive tried to make it without JASS. Since i didnt find any way to do it i figured it was doable with JASS trigger maybe. Problem is... JASS is chinese to me ....
Thanks in advande

Note gold gained isnt based on a spell but simple trigger that add to the attaking unit his str to his current gold. Id like to know how to do the same for XP
EDIT: so i made a trigger (GUI) that looked like that

Gave me this as JASS
-------------------------------------------
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetAttacker()) == 'H002' ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetAttackedUnitBJ()) == Player(10) ) ) then
return false
endif
return true
endfunction
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001001001 takes nothing returns boolean
return ( GetUnitTypeId(GetAttacker()) == 'H002' )
endfunction
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001002 takes nothing returns nothing
call AdjustPlayerStateBJ( 2, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction
function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Actions takes nothing returns nothing
call ForForce( GetPlayersMatching(Condition(function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001001001)), function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Func001002 )
endfunction
//===========================================================================
function InitTrig_XP_per_hit_Achak_Copy_Copy_Copy_Copy takes nothing returns nothing
set gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy, Condition( function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Conditions ) )
call TriggerAddAction( gg_trg_XP_per_hit_Achak_Copy_Copy_Copy_Copy, function Trig_XP_per_hit_Achak_Copy_Copy_Copy_Copy_Actions )
endfunction
-----------------------------------------------------------
so i wanna know how i can change player_state_ressource_gold, 2 to XP
Last edited: