1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest. The contest is optionally paired. Best of luck, people!
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[General] You shall not pass!! The best way to stop units from passing certan areas

Discussion in 'World Editor Help Zone' started by nedio95, Feb 21, 2013.

?

Which metod to use ?

Poll closed Mar 24, 2013.
  1. 1) Regions

    64.3%
  2. 2) Patching blockers

    35.7%
  3. 3) Waygates

    0 vote(s)
    0.0%
  4. 4) Other. Please specify in post.

    0 vote(s)
    0.0%
  1. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    So here is the situation: I got an area where the user player can build stuff. He can form parties with the units he has to explore the map.
    Units can't leave the build area without being in a party
    There is a max number of parties a user player can have at a time.
    Parties stay together. ( Units dont strand )
    There is a limit to the number of units which can join a party.

    So a user player units can't leave the build area without being in a party but there are npc players (3 of them) which can atack the build areas of user players >> Their units need to be able to enter build areas.

    So which is the best way to make some units able to pass through lets call it a gate and some can't.

    I have a few ideas of my own but I would like to know if there is a better way and what i have to watch for.

    Some of the ways I thought:
    --1) Make them fully unpassable(cliffs/doodads/patchingblockers)and use regions to move units from side to side.
    Cons I see : Hard to use. Needs to register a lot of regions or points. Would look ugly (the unit wont walk through but be tp through).
    Pros I see: Well... ... ... it would work...

    --2) Using patching blockers. The units which can pass will become flying.
    Cons I see: Idk how that would look like. Will test sometime. Afraid to not fail with heights to make them look like ground units.
    Pros: Easy and fast to use. Just paste some patchingblockers and some triggering (if making a flying unit look like ground isn't too complicated)

    --3) Make them fully unpassable(cliffs/doodads/patchingblockers) and use Waygates.
    Cons I see: Would look ugly (the unit won't walk through but be tp through (it would look a bit better than 1) ) ).
    Pros I see: A lot less triggering and registering than 1).

    --4) Other ideas ?

    Edit//I would go with 2) but don't know if there would be any problems or if therr is a better way. I am asking because I am far away from the party system and units and npc players. If I was near it I would have tested right away.

    Edit2// I see now that I named metod 2) Patching blockers. It should be Make units flying... idk how to edit polls if it's even possible...
     
  2. Ender

    Ender

    Joined:
    Jan 28, 2012
    Messages:
    208
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    I would use regions.
     
  3. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    I vote for regions also.

    Unit enters region
    Owner of triggering unit not equal to x
    Move triggering unit to point y
     
  4. SeriousEnemy

    SeriousEnemy

    Joined:
    Nov 15, 2009
    Messages:
    219
    Resources:
    2
    Maps:
    1
    Template:
    1
    Resources:
    2
    Regions :)

    What about this way?

    trigger
    Code (vJASS):

    scope BaseStay initializer Init

        globals
            group PartyGroup = CreateGroup()
        endglobals

        private function StayInBase takes nothing returns nothing
            local unit u = GetTriggerUnit()
            local player p = GetOwningPlayer(u)
            local real x
            local real y
            local real x2
            local real y2
            if GetOwningPlayer(u) != Player(11) and IsUnitInGroup(u, PartyGroup) != true then
                set x = GetUnitX(u)
                set y = GetUnitY(u)
                set x2 = GetStartLocationX(GetPlayerId(p))
                set y2 = GetStartLocationY(GetPlayerId(p))
                if GetLocalPlayer() == Player(GetPlayerId(p)) then
                    call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 5, "|Cffff0000Unit is not in a party!|r" )
                endif
                call SetUnitOwner(u, Player(PLAYER_NEUTRAL_PASSIVE), false)
                call SetUnitPathing(u, false)
                call IssuePointOrder(u, "move", x2, y2)
                call TriggerSleepAction(SquareRoot(((x - x2) * (x - x2)) + ((y - y2) * (y - y2))) / GetUnitMoveSpeed(u))
                call SetUnitPathing(u, true)
                call SetUnitOwner(u, p, false)
            endif
            set u = null
            set p = null
        endfunction

        function Init takes nothing returns nothing
            local trigger t = CreateTrigger()
            local region Region = CreateRegion()
            call RegionAddRect(Region, gg_rct_Army)
            call TriggerRegisterLeaveRegion(t, Region, null)
            call TriggerAddAction(t, function StayInBase)
       
            call BJDebugMsg("Select units and press esc to add them to party group.")
       
            set t = null
        endfunction

    endscope
     
    This is just an example, I don't recomment to switch units owner.
    But you could teleport them to their base or whatever..
     

    Attached Files:

  5. Faith

    Faith

    Joined:
    Dec 29, 2009
    Messages:
    883
    Resources:
    3
    Spells:
    1
    Tutorials:
    2
    Resources:
    3
    Definitely regions. It provides the ability to let some pass but not others,
    or simply allows for other uses of the region too. For example, spawning in units!
     
  6. takakenji

    takakenji

    Joined:
    Jul 7, 2008
    Messages:
    3,418
    Resources:
    27
    Models:
    23
    Icons:
    4
    Resources:
    27
    easily regions
     
  7. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    region or custom region with coords
     
  8. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,930
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Use Gandalf!

    A good region system would need to pull units back in (like a force sucks them back) to prevent the annoying "teleport" and look more professional. The idea would be to have 2 regions, one inside the other. When a unit leaves the outer region it gets pulled towards the centre of both regions with a simple projectile system trigger. When it then enters the smaller internal region you remove it from the projectile system stopping it.
     
  9. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    As I read some of your posts I realised that I have totaly forgotten that there is a Unit leaves region event.
    So it will be with regions.

    @Dr Super Good Won't a projectile system be an overkill ?

    Edit//@SeriousEnemy Something similar :) But I'll turn it in GUI...
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,930
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Yes but would avoid the ugly teleport effect.
     
  11. GreeN!X

    GreeN!X

    Joined:
    Oct 20, 2012
    Messages:
    2,351
    Resources:
    2
    Maps:
    1
    Template:
    1
    Resources:
    2
    woops.. voted for pathing blockers before reading your post... yeah, regions are definitely better..
     
  12. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Erm what about:

    trig1
    Event
    unit leaves big region
    Conditions
    Unit type of trig unit != unit type which can pass
    Action
    Order trig unit to move to center of inner region
    Add unit to unitgroup
    Turn on trig2
    Turn on trig3

    trig2
    Event
    unit enters inner region
    Action
    Remove trig unit from unitgroup
    If №of units in unitgroup = 0 turn off this trigger turn off trig 3

    trig3
    Event
    Player selects a unit
    Conditions
    Trig unit is in unitgroup
    Action
    Clear selection for trig player

    Edit// On the other hand I'd need to register all the regions and loop through them in trig1 or create a lot of triggers...
     
    Last edited: Feb 23, 2013
  13. MajorKaza

    MajorKaza

    Joined:
    Nov 19, 2011
    Messages:
    511
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Regions or slow aura. Slow down to 0 should be stop.

    Aura better as no need to make target unit flying (can be hero for e.g.) and can be pulled when buffed.
     
  14. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Explain further please. :)
     
  15. Rainmaker

    Rainmaker

    Joined:
    Jun 3, 2009
    Messages:
    49
    Resources:
    0
    Resources:
    0
    Regions get my vote as well.
     
  16. RiotZ

    RiotZ

    Joined:
    Jul 25, 2009
    Messages:
    2,722
    Resources:
    2
    Maps:
    2
    Resources:
    2
    If entering the region sets the unit's movement speed to 0, then how the hell does the unit get out? xD
     
  17. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6
    Why not use pathing blockers, have units that are not in a party be considered flying, and use blockers that ONLY block flying around the base, when a group of units join up as a party; replace them with ground versions, they can then seamlessly pass through the barriers.

    If your buildings are only in the base; make the buildings also block air as well as ground to disallow units 'walking' inside them. If you use air units though... you'll have to get creative with the naval pathing 'channel'

    Edit: This requires importing of pathing maps, this is easy to do and the maps are very small in filesize. (unless used for a giant blocker, like 128x128) Pathing Map Tut
     
  18. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,930
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    The maker may not want to set the minimum speed to 0 in gameplay constants.
     
  19. Imadori

    Imadori

    Joined:
    Oct 8, 2012
    Messages:
    140
    Resources:
    9
    Icons:
    5
    Spells:
    2
    Tutorials:
    2
    Resources:
    9
    Here's mah test map, it sucks the a certain unit (Dr_Super_Good's idea) while the other units can travel freely. You can pretty much do this without using regions, but points instead, the area will be in circle though. I can make it if you want ;]

    Btw, you can order the unit to stop while it's being sucked. Add in Loop trigger.
    I wonder how to make the sucking movement smoother?
     

    Attached Files:

  20. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    ^ Oh thats the best idea so far :) ( I think ) I'd make it without the loop and instant moove (because it would interupt the move order).