• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.
Level 3
Joined
Oct 9, 2016
Messages
42
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
168
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