globals
constant integer Research_Ability = 'Rhan' //Set to your Ability id.
endglobals
function isAnimal takes integer a returns boolean
if a == 'nech' then //Chicken (Make a new line and add "elseif a == 'your animal id' then"
elseif a == 'ndog' then //Dog
else
return false
endif
return true
endfunction
function Check takes nothing returns nothing
local integer i
local unit u
set u = GetEnumUnit()
set i = GetUnitTypeId(u)
if isAnimal (i) then
call UnitShareVisionBJ( true, u, GetOwningPlayer(GetResearchingUnit()) )
endif
endfunction
function Setup takes nothing returns nothing
call ForGroupBJ( GetUnitsOfPlayerAll(Player(PLAYER_NEUTRAL_PASSIVE)), function Check)
endfunction
function Conditions takes nothing returns boolean
if ( not ( GetResearched() == Research_Ability ) ) then
return false
endif
return true
endfunction
//===========================================================================
function InitTrig_Animal_Vision takes nothing returns nothing
set gg_trg_Animal_Vision = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Animal_Vision, EVENT_PLAYER_UNIT_RESEARCH_FINISH )
call TriggerAddCondition( gg_trg_Animal_Vision, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_Animal_Vision, function Setup )
endfunction