• 🏆 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!

Hello Editors.

Status
Not open for further replies.
Level 1
Joined
Jul 2, 2020
Messages
1
Hello, Hive editors, so im making a map and i want to make, like a region, and inside that region units get stunned at random. Can someone help me out figuring this one out?
I can't seem to find the random number generator, and im not that good with variables.
 
Level 9
Joined
Sep 20, 2015
Messages
385
Hi, so.

As always there are different ways to do things, ill tell you how i would do it.

First of all let's see what things you need.

1. A region
2. A "dummy caster".
3. Custom Stun spell.
4. (Optional) A timer.
5. A Unit group.

1. To make a region simply switch to region tab in the editor. You can open the Region tool, Layers>Regions., or press R. Create a new region into the world space.

2. Dummy Caster. A dummy caster is basically a unit that is invulnerable and invisible whos only purpose is to cast the stun spell. To create it i suggest to find a toutorial or a thread on the site. But basically open the Unit Layers, create a new unit based on a critter. Set the unit model none, give him immune ability, locus ability, and increase the mana points and mana regen.


3. Custom spell is the one that the Dummy caster uses on units. You want to base it on strombolt(single target stun) or stomp(area sun) based on what kind of stun you want. You can set all the variables of the spell yourself based on your needs, like duration of the stun, visual effects and so on. MAKE SURE to add the custom spell to the abilities of the Dummy Caster once you finished making it.

4. This is optional. Timer. This timer will be the amount of time between each stun( Order the Dummy caster to cast stun to a random unit). From the trigger editor you can create a New global variable, click on the green +X button in the tool bar. Give it a name, a value and set the type to Timer.

5. Unit group. This is needed if you choose to base your Custom spell from strombolt. If you base it on stomp it would not be necessary. To create A unit group the it's the same as the Timer, but pick unit group as variable type.



Now that you have all the things set let's use them.

I don't know if you use GUI or JASS, but since you are new i'll just use GUI, even tho i suggest to try to learn JASS because it's much better.

From the unit layer create a Dummy Caster unity and put in into the battle field.


So every time a unit enters the stun-region they are added into the unit group you created, when they leave the are removed from the group. You can pick a random unit from a unit group.


There are 2 triggers. One for the entering units and one for the leaving units.



  • Untitled Trigger 001
    • Events
      • Unit - A unit enters StunRegion <gen>
    • Conditions
    • Actions
      • Unit Group - Add (Entering unit) to stununitgroup
  • Untitled Trigger 002
    • Events
      • Unit - A unit leaves StunRegion <gen>
    • Conditions
    • Actions
      • Unit Group - Remove (Leaving unit) from stununitgroup.
Okay now the unit group will be made of all the units in the region.

Now let's say you used strombolt as base spell, you need a trigger that orders the Dummy Caster to stun a random unit from the group.

  • Untitled Trigger 002
    • Events
      • Time - Every (Random real number between 2.00 and 4.00) seconds of game time
    • Conditions
    • Actions
      • Unit - Order DummyStunCaster to Human Mountain King - Storm Bolt (Random unit from stununitgroup)
This simple trigger will order the unit to cast strombolt every 2 or 3 or 4 seconds. To make it just click on the blue number and then pick Random number between x and y.

And it's done. Since you were generic i will stop here.

But obviously this is just one way to do it, If you want aoe stun you can move the dummy caster to a random point in region and order it to cast stomp.

It's really about what you want.
 
Last edited:
Status
Not open for further replies.
Top