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

2 GUI tricks I haven't seen anyone mention before.

Status
Not open for further replies.
Level 4
Joined
Jan 27, 2016
Messages
89
Since I can't post this in the GUI tutorial section due to access denied, I'll post it here as I think these are very useful and not covered anywhere. But basically, I've searched around, and saw that no one has tried out these 2 "tricks" before. They're very simple but help avoid having to use projectile and damage detection systems for their nieches, which can be helpful in a map where a ton of stuff is running.
Here's the first one:

Pocket factory as an AoE point projectile.
Basically, in most cases, if you want to send out a projectile that does something at an AoE, you have to use a projectile system that runs every few times in a second to detect if a projectile reached its destination. With the pocket factory example, all you need to do is replace the ability with pocket factory, projectile with a projectile you want, and make the unit summoned a specific dummy for the spell (eg if the ability is Storm Bolt, use Dummy Storm Bolt, as detection for summoning units for pocket factory is a bit screwed up). Set the units life duration to 0.01, health to 1 and HP regen to 0, make the dummy have nothing going for it (no model or anything). The Spawned units fields are irrelevant. Then, just have a trigger like this to detect its death:
  • Hell Coil
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Hell Coil Dummy
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Unit - Create 1 Dummy Dummy for (Owner of (Triggering unit)) at Temp_Point facing (Facing of (Triggering unit)) degrees
      • Unit - Add DummyHell Coil to (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Inferno Temp_Point
      • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_Temp_Point)
And voila, easy, no real performance issues, no need for anything complex. Of course, if you want the projectile to do something other than go to its target point including changing of target point or whatever, you won't find that here.

Second example is the batrider example:
Generally, if you want to do something when a projectile hits a unit, you need to have either a damage detection system or a projectile system. An example of this would be Chain Frost from DotA as I think its famous enough, and it is considered impossible to do with GUI. But with GUI it is in fact possible to do with 2 triggers and a hashtable. This is done with the Unstable Concoction of the batrider, which basically turns the unit into a projectile and, when it hits, it is then considered its death, instead of when it is cast, meaning it is I think the only workaround to detecting a projectile hit in GUI easily. Here's what it looks like (I changed the example around because I was too lazy to follow through with a proper example of chain Frost but its similar enough).

  • Chain Frost
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Projectile Killer
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Set Temp_Unit2 = (Target unit of ability being cast)
      • Unit - Create 1 Projectile Killer Dummy for (Owner of (Triggering unit)) at Temp_Point facing (Facing of (Triggering unit)) degrees
      • Set Temp_Unit = (Last created unit)
      • Custom script: set udg_Temp_Integer = GetHandleId(udg_Temp_Unit)
      • Hashtable - Save Handle OfTemp_Unit2 as 0 of Temp_Integer in DummyHash
      • Hashtable - Save 8 as 1 of Temp_Integer in DummyHash
      • Unit - Add DummyProjectile Killer to Temp_Unit
      • Unit - Order Temp_Unit to Orc Batrider - Unstable Concoction Temp_Unit2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Temp_Unit2 is alive) Not equal to True
        • Then - Actions
          • Unit - Add a 0.01 second Generic expiration timer to Temp_Unit
        • Else - Actions
      • Custom script: call RemoveLocation (udg_Temp_Point)
  • Chain Frost 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Projectile Killer Dummy
    • Actions
      • Set Temp_Unit = (Triggering unit)
      • Set Temp_Point = (Position of Temp_Unit)
      • Custom script: set udg_Temp_Integer = GetHandleId(udg_Temp_Unit)
      • Unit - Create 1 Dummy Dummy for (Owner of (Triggering unit)) at Temp_Point facing (Facing of (Triggering unit)) degrees
      • Unit - Add DummyProjectileKiller Stun to (Last created unit)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Load 0 of Temp_Integer in DummyHash)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 1 of Temp_Integer from DummyHash) Greater than 0
        • Then - Actions
          • Set Temp_Group = (Units within 512.00 of Temp_Point)
          • Set Temp_Group2 = (Random 1 units from Temp_Group)
          • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Projectile Killer Dummy for (Owner of (Triggering unit)) at Temp_Point facing (Facing of (Triggering unit)) degrees
              • Unit - Add DummyProjectile Killer to (Last created unit)
              • Unit - Order (Last created unit) to Orc Batrider - Unstable Concoction (Picked unit)
              • Set Temp_Integer2 = ((Load 1 of Temp_Integer from DummyHash) - 1)
              • Set Temp_Unit = (Last created unit)
              • Hashtable - Clear all child hashtables of child Temp_Integer in DummyHash
              • Custom script: set udg_Temp_Integer = GetHandleId(udg_Temp_Unit)
              • Hashtable - Save Handle Of(Picked unit) as 0 of Temp_Integer in DummyHash
              • Hashtable - Save Temp_Integer2 as 1 of Temp_Integer in DummyHash
          • Custom script: call DestroyGroup(udg_Temp_Group)
          • Custom script: call DestroyGroup(udg_Temp_Group2)
        • Else - Actions
          • Hashtable - Clear all child hashtables of child Temp_Integer in DummyHash
      • Custom script: call RemoveLocation (udg_Temp_Point)
I should add, Dummy Projectile Killer Stun is a storm bolt ability, didnt make it a slow out of laziness, Dummy Projectile Killer is Unstable concoction and Projectile Killer is the original "chain frost" ability.

Now, if you want varied projectile speeds you need to use multiple Unstable Concoction, but each UC can be used multiple times for each bit of projectile speed. Actually, I think that UC just manipulates the speed of the unit, so you could get away with using only one, though I'm not 100% certain on this.
Don't know about disjointability, though you can also use an expiration timer or other triggers detecting if the unit is alive for such things if you so desire, though in most cases its, performance wise, more efficient not to bother.

But it works with amazing reliability and is incredibly useful as I found. Pic related, stunned ghouls were already hit, Death Coil is the Chain Frost particle, and after the proper amount of bounces it bounced no more, pretty cool considering its simple GUI.

There's also a 2.5 version, where you use suicide squad attack if you want to at least somewhat manipulate the movement, if it is say disjointed with a really long distance you could order the dummy to suicide at the units last known point or something, plus you can manipulate the unit in other ways, though I don't find this too reliable or useful.

This stuff is intended for those using GUI and mostly interested in simpler things, and those who don't want to deal with the potential performance hogging of using a damage detection system with a lot of units. Also, it can be used for allied units as well as other kinds of targets.

Hope this is useful to someone at least.
 

Attachments

  • Untitled.png
    Untitled.png
    2.3 MB · Views: 163

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
If you posted this one week ago I would support these workarounds, more or less.

However, once I started to understand this: http://www.hiveworkshop.com/forums/jass-resources-412/missile-265370/
I can't go back, it's simply too good. It may actually be faster to use, even compared to the short trigger in your first example. And it's certainly better for the second one.
 
Level 11
Joined
Jun 2, 2004
Messages
849
It absolutely can pass the 522 limit. This is probably because the game doesn't need to check pathing at all.

I've considered using it for a quick movement ability. If you can keep the unit from finishing hitting whatever it was targeting, it'll survive.
 
Level 9
Joined
Jul 30, 2012
Messages
156
Notice that Unstable concoction doesn't actually move the unit, it just hides the unit in its current position and creates a missile with the same model as the unit. When that missile reaches its target the caster will be instantly moved to that position, and then killed, if the spell is successful. (If the target becomes invalid when reached by the projectile, the explosion doesn't happen and the caster doesn't die)
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
Notice that Unstable concoction doesn't actually move the unit, it just hides the unit in its current position and creates a missile with the same model as the unit. When that missile reaches its target the caster will be instantly moved to that position, and then killed, if the spell is successful. (If the target becomes invalid when reached by the projectile, the explosion doesn't happen and the caster doesn't die)

nice to know. so there are no way to track it down if the target become unreachable? the unit will appear at the old spot?
also selection still available. that's unique hiding if you ask me, just like cyclone
 
Level 9
Joined
Jul 30, 2012
Messages
156
nice to know. so there are no way to track it down if the target become unreachable? the unit will appear at the old spot?
also selection still available. that's unique hiding if you ask me, just like cyclone

I didn't test it much but the unit never appeared in the old spot, it always appears in the location where the projectile hits, whether the target is valid or not. And it does seem to be a unique hiding, as it doesn't remove the selection from the unit, however, if the player de-selects the hidden unit, they can't select it again.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Sphere launches a projectile for any targeted spell.

Regardless, the amount of Object Editor data this requires is astounding. Different projectile speed, art, size will each have to be unique objects, and that bloats the map size and increases load time. A projectile system is one script to handle a myriad of differences, and can even do things like collide with other missiles.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,502
I am a massive fan of little GUI tricks like this; utilizing the Object Editor to it's furthest extent, and minimizing the Trigger Editor.

I'll admit, though, the usage of the examples escapes me. Particularly the first one; it's nice that Pocket Factory is a point-targeted spell with a missile, but what's the point/usage of the spawned dummy unit? Last I tested, the game was unable to catch units summoned with the Pocket Factory as "a unit is summoned" (or maybe that was with the neutral/passive "Factory" spell, another source of AMAZING GUI TRIX by the way).

Ok, I'll bite; what other uses does the UC-trick have?
 
That's the tragedy about Pocket Factory - it doesn't count as a summoned unit, to the extent that you can't identify a summoner from it. So the uses are limited - you can't credit any damage triggered from the appearance of the dummy unit spawned by Pocket Factory to the caster, which is damn shame as that would make AoE Fireball spells a million times easier to make. The best you can do is credit player kills, which I guess works for some people.

This is why you should use a custom projectile system for your missile needs :D

PS: UC?
 
Status
Not open for further replies.
Top