• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Automatic hide in the bushes when stop in Certain region

Status
Not open for further replies.
Level 1
Joined
May 27, 2018
Messages
4
I wanted to make units hide in the big grasses when they stop something like the nightelf when night they hide but it is similar to that. I want to make units like footman automatic hide in the grass(or certain region) when they stop and unhide when move Please! Help!
Screenshot (71).png
 
Last edited:
Level 13
Joined
Oct 12, 2016
Messages
769
OK. So:
1) Start with adding the unit to a "hidden in bushes" unit group when they enter a "bushes" region.
2) Turn on a periodic trigger whenever the unit group has greater than 0 units in it.
3) Check all units in the unit group every 0.25 seconds or so (periodic event). If the unit is attacking or moving, remove the Permanent Invisibility ability. Else, add the Permanent Invisibility ability. Set the fade time for the ability and unit to something appropriate for you.
4) If the unit dies or leaves said region, remove it from the unit group. Turn off the periodic trigger if number of units in the unit group = 0

You'll need a total of 3 triggers for this.
I'm actually doing something similar for terrain effects on one of my projects, where forests hide certain units :D
 
Level 1
Joined
May 27, 2018
Messages
4
Wow! Thanks I did not that someone will actually reply Thanks i helps me a lot.... this is a good forum
 
Level 1
Joined
May 27, 2018
Messages
4
But can you make a little screenshot to your trigger to understand much better I know I am asking a lot but please your only my help..
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
OK. So:
1) Start with adding the unit to a "hidden in bushes" unit group when they enter a "bushes" region.
2) Turn on a periodic trigger whenever the unit group has greater than 0 units in it.
3) Check all units in the unit group every 0.25 seconds or so (periodic event). If the unit is attacking or moving, remove the Permanent Invisibility ability. Else, add the Permanent Invisibility ability. Set the fade time for the ability and unit to something appropriate for you.
4) If the unit dies or leaves said region, remove it from the unit group. Turn off the periodic trigger if number of units in the unit group = 0

You'll need a total of 3 triggers for this.
I'm actually doing something similar for terrain effects on one of my projects, where forests hide certain units :D

You forgot to mention that there is no native way to detect if a unit is moving or not.
Luckily, there is a system in the spells section that does that + a few other things.
Grab that, you'll need it.

Also, wouldn't it be better to have a dummy unit cast something like a 0.25 seconds invisibility instead of adding/removing permanent invisibility ?

Why 3 triggers ?
Need 1 to add units that enter the grass region and 1 to manage it (loop).
2 total.
What else would it need ?

@WaterKnight @Daffa the Mage
Isn't Shadowmeld hardcoded to work only during the night?

regards
-Ned
 
Level 13
Joined
Oct 12, 2016
Messages
769
I got a test map going, and ran into some problems.
I tried @nedio95 's suggestion to have a dummy unit cast invisibility continuously on the unit group, but that causes all units in the regions to "flicker" between invisible and visible constantly.
So, I used my idea: permanent invisibility.

There's still a problem. It doesn't detect movement or attacking, so units will remain invisible in "bush" regions.
I added debug messages to check everything. You can turn those off or delete them.

EDIT:
Got this system to work properly now. New version's posted here. The regions seemed to have required a buffer zone.
 

Attachments

  • HidingInBushesV2.w3x
    20.4 KB · Views: 20
Last edited:
Level 1
Joined
May 27, 2018
Messages
4
Hive workshop members I am really thankfull for your reply I AM VERY HAPPY RIGHT NOW!!!! I will be here if I need anything again Thanks:cool:
 
Status
Not open for further replies.
Top