• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Help me fix my System

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
I see you changed your message here, you still have issue or solved?

The easiest fix I can think of is that the unit has an ability to "refresh" the area around.

Another option is to refresh 10 timers over a 5 minute period, after that it is released, the chanse of units blocking the land for such a long time is small.

A third option is to check unit position above the area, but not sure exactly how to determine if a unit is actually blocking.

Is grid farmable? Yes -> Is grid Walkable? No. -> Is there units there? Yes. -> Add grid to recheck index. -> Check Grid again after seconds. -> Repeat.
 
Last edited:
Level 12
Joined
May 22, 2015
Messages
1,051
Could you select all the units in the area you want to turn into farm land and disable pathing for them and then re-enable it right after? It shouldn't cause problems if it all happens instantly, I don't think.
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
Could you select all the units in the area you want to turn into farm land and disable pathing for them and then re-enable it right after? It shouldn't cause problems if it all happens instantly, I don't think.

Doesn't work sadly. However adding removing locust or making the unit flying might, not sure how that is done exactly though.

JASS:
scope Test123 initializer Init 
    function Trig_Untitled_Trigger_001_Func001A takes nothing returns nothing
        call SetUnitPathing( GetEnumUnit(), false )
    endfunction

    function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
        call ForGroup( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_Untitled_Trigger_001_Func001A )
        if IsTerrainWalkable(GetRectCenterX(gg_rct_a), GetRectCenterY(gg_rct_a)) then
            call BJDebugMsg("yes")
        else 
            call BJDebugMsg("no")
        endif   
    endfunction

    private function Init takes nothing returns nothing
        set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle( gg_trg_Untitled_Trigger_001, 1.00 )
        call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
    endfunction
endscope
 
Level 12
Joined
May 22, 2015
Messages
1,051
Dang. Can you save their xy coordinates (using a hashtable), move them to the origin of the farmland, generate the farmland, and then move them back? I don't have a full grasp on everything your system does, so it might not work for all cases.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I could do that, but visually it would look retarded wouldn't it? :p Gonna try it later though.

How fast does the farmland generate? If it all just appears instantly, it shouldn't be a problem.

If it sort of grows out, you'd have to grab the units as it expands.
 
Status
Not open for further replies.
Top