Gate Building

Level 20
Joined
Jul 27, 2008
Messages
14,376
How to make building Gate to open and close. I know it sounds simple.
I tried with upgrade and morph which crashes map.

Then I tried with trigger that replaces gate with walkable gate that uses "dead alternate" animation which works but if a unit is near gate that closes, gate moves from its position.

Gate can be built by workers anywhere on map and these gates aren't doodad or destructible.
 
Level 10
Joined
Aug 15, 2008
Messages
720
Well, you have already found solution, all you have to do is to move those units which could block your closed gates making em to move somewhere else and then spawn closed gates.

BTW, what pathing you use for closed gates?
 
Level 20
Joined
Jul 27, 2008
Messages
14,376
For closed gates I used Stone wall horizontal. Tried gate pathing but to big

But migrating gates kinda bug me. I was hoping for solution for that because I have seen that it is possible.

Apheraz I did try replacing building with trigger which results in moving the building when unit is to close. Read the whole post?
 
Level 10
Joined
Aug 15, 2008
Messages
720
I think I fixed your problem, as I said you need to "push" units who blocks your closed gates first. I managed to do that quite easily with hide command ^^

Here's example map: http://www.hiveworkshop.com/forums/pastebin.php?id=1vyij6

  • Open
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open
    • Actions
      • Set temploc[0] = (Position of (Triggering unit))
      • Set temprect[0] = (Region centered at temploc[0] with size (384.00, 128.00))
      • Set tempgroup[0] = (Units in temprect[0] matching ((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is A flying unit) Not equal to True)))
      • Unit Group - Pick every unit in tempgroup[0] and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
      • Unit - Replace (Triggering unit) with a Opened Gates <Horizontal> using The old unit's relative life and mana
      • Animation - Play (Last replaced unit)'s alternate animation
      • Unit Group - Pick every unit in tempgroup[0] and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
      • Custom script: call DestroyGroup(udg_tempgroup[0])
      • Custom script: call RemoveRect(udg_temprect[0])
      • Custom script: call RemoveLocation(udg_temploc[0])
  • Close
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close
    • Actions
      • Set temploc[0] = (Position of (Triggering unit))
      • Set temprect[0] = (Region centered at temploc[0] with size (384.00, 128.00))
      • Set tempgroup[0] = (Units in temprect[0] matching ((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is A flying unit) Not equal to True)))
      • Unit Group - Pick every unit in tempgroup[0] and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
      • Unit - Replace (Triggering unit) with a Closed Gates <Horizontal> using The old unit's relative life and mana
      • Unit Group - Pick every unit in tempgroup[0] and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
      • Custom script: call DestroyGroup(udg_tempgroup[0])
      • Custom script: call RemoveRect(udg_temprect[0])
      • Custom script: call RemoveLocation(udg_temploc[0])
 
Level 20
Joined
Jul 27, 2008
Messages
14,376
Crashes the game... I said in first post I tried both upgrade and morphing (also some forget that there is no model of "opened gate" which is actually animation of normal gate). Also this is solved so please no more suggestions unless are more effective then Azeroc's.
 
Level 10
Joined
Aug 15, 2008
Messages
720
I don't there is something more effective than my solution. It is like that you try placing gates where unit stands and then Wc3 Engine detects that spot is taken by unit and moves gate to closest available place for these gates. My simple trigger just "Hides" this unit who took gate position, after that gates are spawned/replaced and then I un-hide that unit. Now Wc3 Engine detects that Gates are now blocking pathing instead of unit and moves unit instead of gates. Simple as that xD
 
Top