• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Remove Fog of war via triggers,Return lumber without going to lumbermill

Status
Not open for further replies.
Level 4
Joined
Oct 9, 2016
Messages
49
Hello guys its me again,sorry for keep asking question,this time i wish to know how to enable vision for certain unit type,neutral animal if posible after done a specific research,and how to make workers return lumber without making them walk back to the town hall or lumbermill,increasing Gather ability cast range only makes them harvest lumber from a long range.
 
Level 6
Joined
Dec 6, 2009
Messages
173
Copy this into your map and just change the Research_Ability Global and add more elseifs to the isAnimal function. I hope this helps!

JASS:
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


I made it in GUI aswell if you want that instead :)
  • Animal Vision
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Animal War Training
    • Actions
      • Unit Group - Pick every unit in (Units owned by Neutral Passive) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Chicken
            • Then - Actions
              • Unit - Grant shared vision of (Picked unit) to (Owner of (Researching unit))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Frog
                • Then - Actions
                  • Unit - Grant shared vision of (Picked unit) to (Owner of (Researching unit))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Raccoon
                    • Then - Actions
                      • Unit - Grant shared vision of (Picked unit) to (Owner of (Researching unit))
                    • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top