Collision and hide/unhide problem

Solu9

You can change this now in User CP.
Reaction score
216
When the ability is cast on a building the player should be able to walk where the building was for 5seconds. However this trigger does not work. The casting unit is not able able to walk through the building and the building is not hidden.

Trigger:
  • Time Distortion
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Frost Nova
    • Actions
      • Unit - Turn collision for (Target unit of ability being cast) Off
      • Unit - Unhide (Target unit of ability being cast)
      • Wait 5.00 seconds
      • Unit - Turn collision for (Target unit of ability being cast) On
      • Unit - Unhide (Target unit of ability being cast)


Edit: I know "waits" are bad bad bad, but this is just a test.
 

Solu9

You can change this now in User CP.
Reaction score
216
Now this trigger will hide the unit, but it never reappears.

Trigger:
  • Time Distortion
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Frost Nova
    • Actions
      • Unit - Hide (Target unit of ability being cast)
      • Wait 5.00 game-time seconds
      • Unit - Unhide (Target unit of ability being cast)
 

Dirac

22710180
Reaction score
147
Things like "target unit of ability being cast" do not go through waits, use variables instead
 

inevit4ble

Well-Known Member
Reaction score
38
This Works perfectly
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TestAbi
    • Actions
      • Set MyUnit = (Target unit of ability being cast)
      • Unit - Turn collision for MyUnit Off
      • Unit - Hide MyUnit
      • Wait 5.00 seconds
      • Unit - Turn collision for MyUnit On
      • Unit - Unhide MyUnit

BUT
I must warn you of an obvious bug. What if the unit is stand on the area of the building when it comes back?
The unit gets stuck 'in' the building.
I'm not sure of your application but just be aware of it
 

Solu9

You can change this now in User CP.
Reaction score
216
Thanks for the trigger. And yeah I thought about the stuck part and was hoping the unit would just be pushed aside. Can you in some way incorporate a safety device which moves the unit/s (not the building) when the building comes back?

Btw, when I use hide unit, collision doesn't seem to matter.
 

TheOverWhelm

Member
Reaction score
16
A safety device would be changing the structure's pathing to not require "buildable", I believe. -Should- work, and if it doesn't then you have a problem. Could try doing a Move Unit to where it was, or a SetUnitX and a SetUnitY. Parameters are both unit,real for them. so udg_TempUnit and udg_TempReal if you don't know much about JASS.
 

inevit4ble

Well-Known Member
Reaction score
38
ye,

I'm just not sure how to detect how big a building is? Does position of unit include their whole area or just their center point?
 

Solu9

You can change this now in User CP.
Reaction score
216
Actually inevit4ble Im surprised you didn't test this yourself while you were at it. If a unit is at the spot of the building when the building is unhidden then the unit is indeed "inside" the building. However if you try to move the unit, it automatically teleports next to the building :)
I think we can call this case closed :)

Thanks for all the help and feedback. Kisses.

Edit: I do want to note though. Luckily only one hero in my map can do this and I'll just set the cooldown on the spell to 5-6 seconds since if I use the spell on more than one building before the first one reappears, the first one will stay hidden forever.

And shouldn't I remove the MyUnit at the end of the trigger?
 

inevit4ble

Well-Known Member
Reaction score
38
Unit variables don't leak so unless you needed MyUnit to = No Unit then it would be redundant.

I did test the bug , I used a town halls as the building in question. I found if the unit was closer to the edge of the building then it would be pushed out of the radius otherwise it would get stuck. I assume if the buildings were small, such as a farm, it would always push the unit out, not sure.
But
letting the unit recast it would save the trouble of making a fixer trigger.
And
luckily only one unit can cast it otherwise if more than one instance occurred at a time, the previously hidden building would not come back :O
lol

Happy Mapping \:D/
 

Solu9

You can change this now in User CP.
Reaction score
216
Trigger:
  • If -
    • Unit variables don't leak equal yes
      • then -
        • Great
      • else -
        • whatever... they don't leak


And yeah, Im using a farm-size building luckily :)

Again. Thanks for the help.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top