Unit gets stuck in cliff

SnowCrow

New Member
Reaction score
7
I have a hero respawn trigger which revives the hero in random location in the map. But theres a problem, because the hero might respawn inside cliff, getting stuck. Is there a solution to this?
I've thought of adding antistuck-regions to those cliffs, and when the unit enters it, it moves the unit elsewhere.
I guess there is easier way, could anyone help? :)
 

Lanboy

TH.net Regular
Reaction score
22
you might be able to do a terrain type check at the point. i dont know whether you can check for cliffs or not but yeah.
 

2-P

I will work hard tomorrow
Reaction score
325
There's a boolean comparison called "Environment - Terrain Pathing is off".

You can use it to check if the "Walkability" is off for example.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Try putting Pathing Blockers (Both) for every single part of your cliff. Then, in your trigger, put:

Code:
Hero Revival (One Trigger)
   Hero - Revive Hero Instantly at (Random Point in (Playable map area)

There, the hero will spawn anywhere except the cliff. But alternately, you could use anti-stuck regions, just like what you said :D
 

SnowCrow

New Member
Reaction score
7
There's a boolean comparison called "Environment - Terrain Pathing is off".

You can use it to check if the "Walkability" is off for example.

Thanks.
But now I don't know how to trigger it now. Could you guide me a bit how its done?
Code:
Woo 1
    Events
        Unit - A unit owned by Player 1 (Red) Dies
    Conditions
        (Player 1 (Red) slot status) Equal to Is playing
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Wait 5.00 seconds
        ?
 

Void

New Member
Reaction score
16
Pathing Check

Do a pathing check to see if the respawn area is walkable... I think its under boolean but it might be under something else...
 

SnowCrow

New Member
Reaction score
7
Yes I get it, but I don't get how to trigger it.
Code:
Actions
    Wait 5.00 seconds
    Hero - Instantly revive (Triggering Unit) at (Random Point of (Playable map area)), Hide revival graphics
Or must I create a point variable and revive the hero at it? But I still don't know how to do it.
 

Tom Jones

N/A
Reaction score
437
Set a variable to a random point on the map. Run the variable trough a pathing check. If it's true then revive the hero, if it's false pick a new random point.
 

SnowCrow

New Member
Reaction score
7
Damn, now I have another problem. I have these triggers:
Code:
Random Points
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Set RandomPoint1 = (Random point in Respawn <gen>)
Respawn <gen> is a region that covers almost the whole playable area.

Code:
Woo 1
    Events
        Unit - A unit owned by Player 1 (Red) Dies
    Conditions
        (Player 1 (Red) slot status) Equal to Is playing
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Wait 5.00 seconds
        Trigger - Run Respawn 1 <gen> (checking conditions)

Code:
Respawn 1
    Events
    Conditions
    Actions
        If ((Terrain pathing at RandomPoint1 of type Walkability is off) Equal to False) then do (Hero - Instantly revive (Triggering unit) at RandomPoint1, Hide revival graphics) else do (Trigger - Run (This trigger) (checking conditions))
        Camera - Pan camera for (Owner of (Triggering unit)) to (Position of (Triggering unit)) over 1.00 seconds
        Unit - Set mana of (Triggering unit) to 100.00%
        Unit - Make (Triggering unit) Invulnerable
        Wait 2.00 seconds
        Unit - Make (Triggering unit) Vulnerable

Now the problem is, almost everytime I test my map, and my hero dies, the whole WC crashes. This doesn't happen at every death, but more like every 3rd death. Any help?

//Omfg wtf, am I really so stupid that I use triggering unit in a trigger that doesnt have events. I copied it from the other trigger which had events. Lol! I'll fix it.
 

Rinpun

Ex TH Member
Reaction score
105
Even so, you might want to look at a better method. Creating a leaked location every second is ugly. You should try using reals instead of a location for a thing as simple as this. If you use the center x times two and center y times two you'll get the ranges of the reals. That is, you'll want to get a random real between negative center x times two and positive center x times two for the x coordinate and then you'll want to get a random real between negative center y times two and positive center y times two for the y coordinate.

Then again, if I remember it correctly, the "center" coordinates of WC3 are kind of fugged up. The center of the map is 0,0 and stuff like that, so you might want to play with getting the full x dimension and full y dimension of the rect (get the center, times it by two, and take the absolute value, then you can take its negative and positive to get an accurate random number).
 

SnowCrow

New Member
Reaction score
7
How could I fix the leak? I've never studied on leaks, so I don't know a lot about them.
 

Rinpun

Ex TH Member
Reaction score
105
You have to remove the location after you use it. However, for your current use, you can't really, because you might use it and you might not.

I'd suggest finding the random point of the respawn in the trigger that checks if it's walkable. Then you can call RemoveLocation(udg_RandomPoint1) using custom script after the execution of it's trigger (or before you rerun the trigger-I suggest you make that an if then else with multiple actions).
 
I

IKilledKEnny

Guest
Code:
custom script: loop
custom script: exitwhen IsTerrainPathableBJ(udg_location, PATHING_TYPE_WALKABILITY) == true
custom script: call RemoveLocation(udg_location)
custom script: set udg_location = GetRandomLocInRect(GetWorldBounds())
custom script: endloop
//Revive hero at location
custom script: call RemoveLocation(udg_location)
 

Rinpun

Ex TH Member
Reaction score
105
Should have a RemoveLocation(udg_location) before the set udg_location =.

Then there should be a RemoveLocation(udg_location) after "// revive hero at location". Other than that, using a loop is better than continuously running the trigger.
 
I

IKilledKEnny

Guest
Thank you Rinpun I forgot to add the leak removal. *Edited*
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top