Problem with removing locust

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
There are two units involved in this; the Gate (udg_Gate[]) unit and the Rune controling it (u). The locust doesn't get removed so after one go you cant target the gate, perhaps i could just remove it and create a new on the spot but that feels redundant.

  • GateControler Building
    • GateControler Building
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Gate Controler
    • Actions
      • Set u = (Triggering unit)
      • Set i = (Custom value of u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Open Gate
        • Then - Actions
          • Animation - Play Gate_U[i]'s death alternate animation
          • Unit - Remove Open Gate from u
          • Unit - Add Close Gate to u
          • Custom script: call UnitAddAbility( udg_Gate_U[udg_i], 'Aloc')
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Close Gate
            • Then - Actions
              • Animation - Play Gate_U[i]'s stand animation
              • Unit - Remove Close Gate from u
              • Unit - Add Open Gate to u
              • Custom script: call UnitRemoveAbility( udg_Gate_U[udg_i], 'Aloc')
            • Else - Actions
I also tried to replace the global variables with locals but I didnt manage to create a local intiger. This was my attempt:

  • Actions
    • Custom script: local unit u = GetTriggerUnit()
    • Custom script: local intiger i = GetUnitUserData(u)
 
It doesn't work. The game crashes after the second go and the morphed illidan icon apears in the corner... And if I remove the Metamorphosis part you can select the gate but not attack it. (The cursor doesn't turn green while hovering over it.)


  • GateControler Building
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Gate Controler
    • Actions
      • Set u = (Triggering unit)
      • Set i = (Custom value of u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Open Gate
        • Then - Actions
          • Animation - Play Gate_U[i]'s death alternate animation
          • Unit - Remove Open Gate from u
          • Unit - Add Close Gate to u
          • Custom script: call UnitAddAbility( udg_Gate_U[udg_i], 'Aloc')
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Close Gate
            • Then - Actions
              • Animation - Play Gate_U[i]'s stand animation
              • Unit - Remove Close Gate from u
              • Unit - Add Open Gate to u
              • Custom script: call UnitRemoveAbility( udg_Gate_U[udg_i], 'Aloc')
              • Unit - Hide Gate_U[i]
              • Unit - Unhide Gate_U[i]
              • Unit - Add Metamorphosis to Gate_U[i]
              • Unit - Order Gate_U[i] to Night Elf Demon Hunter - Metamorphosis
              • Unit - Remove Metamorphosis from Gate_U[i]
            • Else - Actions
I'm considering scraping the unit gate and just stick with the destructibles, if only workers could repair destructibles...
 
Last edited:
Use this to remove locust:
  • Unit - Hide YourUnit
  • Custom script: call UnitRemoveAbility( udg_YourUnit, 'Aloc')
  • Unit- Unhide YourUnit
Always hide your unit, then remove the locust, and then unhide your unit.

And:
Custom script: local intiger i = GetUnitUserData(u)

Dosn't work because is integer no intiger, check the grammar.
 

Attachments

I don't read that, bearform it doesn't work, at least for me. Metamorphosis yes, but you need a hero as base unit.

You can edit the model extents, remove all the extents in the geosets ( not in the animations ). Create a new animation like stand alternate, leave the min and max extents in 0. With triggers, add an alternate tag to your unit (if you create a stand alternate animation) for make the door unselectable. Reset the animation to make it selectable.

Attached map.
 

Attachments

I tried this way, where the gate is moved to a storageplace on the map. There are two unit-types for one gate. One with locust and one without.

  • Open/close Gate
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • is_gate_open Equal to False
        • Then - Actions
          • Unit - Move gate[1] instantly to (Position of gate[0])
          • Unit - Move gate[0] instantly to (Center of Region 000 <gen>)
          • Animation - Play gate[1]'s death alternate animation
          • Set is_gate_open = True
        • Else - Actions
          • Unit - Move gate[0] instantly to (Position of gate[1])
          • Unit - Move gate[1] instantly to (Center of Region 000 <gen>)
          • Animation - Play gate[0]'s stand alternate animation
          • Set is_gate_open = False
This would have been perfect if not for the fact that the attackers chase after the gate towards that corner even though i add invulnerable or paus the unit. Any one knows how to prevent this ghost chase?
 
The point leak im familiar with (like the only one ;D). The problem im facing is that i must detect the units that has specifically targeted the gate.

Perhaps there is such a condition. Problem is I can't find it.

It would be something like:
  • Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Check if the unit current order is to attack gate[0]
        • Then - Actions
          • Unit - Order (Picked unit) to Stop
        • Else - Actions
I suppose a workaround could be to add the unit that attacks the Gate to a unit group and when they change their order remove them but I'd much rather avoid that if I can.
 
Status
Not open for further replies.
Back
Top