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

[Trigger] Any thoughts into how I should make this spell MUI?

Status
Not open for further replies.
Level 15
Joined
Sep 3, 2006
Messages
1,738
Hello GUI trigger wizzes. I have a challenge for you. I made this spell for my map a few months ago, and I've decided that I want to make it MUI. I know it's possible, because I already use hashtables and they can very easily store the real values. My challenge to you is: what's the most effective way to make this MUI?

The only thing that bugs is the boolean and the reals (meaning they're the only non-MUI things). Also, I'd like some feedback on my beam trigger, mainly whether it leaks or not.

  • Galick Gun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Galick Gun
    • Actions
      • Set Distance = 0.00
      • Set ChargeTime = 0.00
      • Set EnergySize = 100.00
      • Set Vegeta = (Triggering unit)
      • Set VegetaHandle = (Triggering unit)
      • Hashtable - Save Handle OfVegeta as 0 of (Key VegetaHandle) in GalickGunHash
      • Set VegetaPoint = (Position of (Load 0 of (Key VegetaHandle) in GalickGunHash))
      • Hashtable - Save Handle OfVegetaPoint as 1 of (Key VegetaHandle) in GalickGunHash
      • Animation - Change (Load 0 of (Key VegetaHandle) in GalickGunHash)'s animation speed to 0.00% of its original speed
      • Unit - Create 1 for (Owner of (Load 0 of (Key VegetaHandle) in GalickGunHash)) at VegetaPoint facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Ensnare to (Last created unit)
      • Unit - Order (Last created unit) to Orc Raider - Ensnare (Load 0 of (Key VegetaHandle) in GalickGunHash)
      • Unit - Create 1 for (Owner of (Load 0 of (Key VegetaHandle) in GalickGunHash)) at VegetaPoint facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Trigger - Turn on Energy Charge <gen>
      • Trigger - Turn on Energy Cancel <gen>
      • Wait until (EnergyCharged Equal to True), checking every 1.00 seconds
      • Trigger - Turn on Energy Beam <gen>
      • Trigger - Turn off Energy Charge <gen>
      • Trigger - Turn off Energy Cancel <gen>
      • Set EnergyCharged = False
      • Wait 1.00 seconds
      • Animation - Change (Load 0 of (Key VegetaHandle) in GalickGunHash)'s animation speed to 100.00% of its original speed
      • Unit - Order (Load 0 of (Key VegetaHandle) in GalickGunHash) to Stop
      • Hashtable - Clear all child hashtables of child (Key VegetaHandle) in GalickGunHash
      • Trigger - Turn off Energy Beam <gen>
      • Unit Group - Remove all units of AlreadyDamaged from AlreadyDamaged
      • Custom script: call RemoveLocation(udg_BeamLine)
      • Custom script: call RemoveLocation(udg_VegetaPoint)
  • Energy Charge
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 for (Owner of (Load 0 of (Key VegetaHandle) in GalickGunHash)) at (Load 1 of (Key VegetaHandle) in GalickGunHash) facing Default building facing degrees
      • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
      • Set EnergySize = (EnergySize + 15.00)
      • Set ChargeTime = (ChargeTime + 0.20)
      • Animation - Change (Last created unit)'s size to (EnergySize%, EnergySize%, EnergySize%) of its original size
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeTime Greater than or equal to 5.00
        • Then - Actions
          • Set EnergyCharged = True
        • Else - Actions
  • Energy Cancel
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(stop))
      • (Unit-type of (Load 0 of (Key VegetaHandle) in GalickGunHash)) Equal to (Unit-type of (Ordered unit))
      • ((Load 0 of (Key VegetaHandle) in GalickGunHash) has buff Ensnare (Ground)) Equal to True
    • Actions
      • Set EnergyCharged = True
      • Wait 1.00 seconds
      • Unit - Remove Ensnare (Ground) buff from (Load 0 of (Key VegetaHandle) in GalickGunHash)
  • Energy Beam
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeTime Less than or equal to 1.00
        • Then - Actions
          • Set Distance = (Distance + 6.60)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeTime Greater than 1.00
          • ChargeTime Less than 2.00
        • Then - Actions
          • Set Distance = (Distance + 11.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeTime Greater than 2.00
          • ChargeTime Less than or equal to 3.00
        • Then - Actions
          • Set Distance = (Distance + 16.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeTime Greater than 3.00
          • ChargeTime Less than or equal to 4.00
        • Then - Actions
          • Set Distance = (Distance + 19.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChargeTime Greater than 4.00
        • Then - Actions
          • Set Distance = (Distance + 27.00)
        • Else - Actions
      • Set EndPoint = ((Position of (Load 0 of (Key VegetaHandle) in GalickGunHash)) offset by (Facing of (Load 0 of (Key VegetaHandle) in GalickGunHash)) towards (Facing of (Load 0 of (Key VegetaHandle) in GalickGunHash)) degrees)
      • Hashtable - Save Handle OfEndPoint as 2 of (Key VegetaHandle) in GalickGunHash
      • Set BeamLine = ((Position of (Load 0 of (Key VegetaHandle) in GalickGunHash)) offset by Distance towards (Distance between (Load 1 of (Key VegetaHandle) in GalickGunHash) and (Load 2 of (Key VegetaHandle) in GalickGunHash)) degrees)
      • Unit - Create 1 for (Owner of (Load 0 of (Key VegetaHandle) in GalickGunHash)) at BeamLine facing Default building facing degrees
      • Unit - Add a 0.80 second Generic expiration timer to (Last created unit)
      • Set DamageGroup = (Units within 250.00 of BeamLine matching ((((Matching unit) belongs to an enemy of (Owner of (Load 0 of (Key VegetaHandle) in GalickGunHash))) Equal to True) and ((((Matching unit) is in AlreadyDamaged) Equal to False) and (((Matching unit) is A structure) E
      • Unit Group - Pick every unit in DamageGroup and do (Actions)
        • Loop - Actions
          • Unit - Cause (Load 0 of (Key VegetaHandle) in GalickGunHash) to damage (Picked unit), dealing ((ChargeTime x (Real((Level of Charging Energy for (Load 0 of (Key VegetaHandle) in GalickGunHash))))) x 25.00) damage of attack type Spells and damage type Normal
          • Unit Group - Add (Picked unit) to AlreadyDamaged
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DeathandDecay\DeathandDecayTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
      • Destructible - Pick every destructible within 256.00 of BeamLine and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
      • Custom script: call DestroyGroup(udg_DamageGroup)
      • Custom script: call RemoveLocation(udg_BeamLine)
      • Custom script: call RemoveLocation(udg_EndPoint)
 
Level 8
Joined
Aug 6, 2008
Messages
451
My challenge to you is: what's the most effective way to make this MUI?

To use Jass, naturally.

As a Jasser I can say that GUI is no way sufficient enough.


Anyways, some problems I see in this code are:


-It uses waits, which are used to count real time, not gametime, so its unaccurate as hell. ( We have timers for counting gametime )

-It creates dummies everytime the spell is casted, instead of using one dummy for all, which is really terrible when you think of how slow CreateUnit is. ( Solving this doesnt require Jass at all and can be easily done with GUI)

-Those groups leak . ( You cant really use groups without leaks in GUI )

- And it suffers from all the other GUI thingies every GUI trigger suffers. ( You can read these from any Jass vs GUI thread, so I dont list them here. )

Anyways, if you really wanna stick with GUI and make it MUI, you should probably use hashtables for it, since you already know how to use them.

But if you really care about efficiency, do it with Jass.
 
Level 8
Joined
Aug 6, 2008
Messages
451
TimerUtils with either hashtable or structs?

What on earth that is supposed to mean? o_O ( Makes no sense )
 
Level 15
Joined
Sep 3, 2006
Messages
1,738
Hi, thanks for the responds guys.

1) I know I don't need JASS to make this MUI. In fact, I know how to do it with hashtables. I'm just curious which would be the best way to go about doing it with a hashtable.
2) The groups leak?
3) Can you elaborate more on the dummy unit spawning plz? It works fine.
4) The waits actualyl work just fine, even if they are somewhat inaccurate, it doesn't affect the overall spell.

Thanks for the replies/suggestions.
 
Level 8
Joined
Aug 6, 2008
Messages
451
1) Dont really know. There isnt too many ways to use hashtables. What do you exactly mean?

2) Dummy thing is basicly done by creating one dummy in map init and then moving it to point of target and ordering it to cast some spell. For example ensnare or slow, or roots or some spell that can be casted instantly.

You just need to make sure that dummy has 0 sec cast aniamtion time thingies in object editor and that spell has 0 cast time and take care all the other stuff that makes casting non-instant.


3) Calling GroupEnum with temporary group ( with some group that gets destroyed ) leaks some memory. The best way is to do all GroupEnums with one group that is created in map init and never destroyed. This is, however pretty hard ( or maybe impossible ) with GUI.

4) Ok.
 
Level 15
Joined
Sep 3, 2006
Messages
1,738
3) Calling GroupEnum with temporary group ( with some group that gets destroyed ) leaks some memory. The best way is to do all GroupEnums with one group that is created in map init and never destroyed. This is, however pretty hard ( or maybe impossible ) with GUI.
So basically create a static unit group that won't leak and just add/remove units from it?
 
Level 12
Joined
Feb 23, 2007
Messages
1,030
Add units to the group, clear the group, add units to the group, clear the group. And you really should learn JASS. Every single JASSer on the planet will tell you to learn JASS. It's just simply better, and when you learn JASS, it's so easy to make things MUI that everything you make will be MUI. You may be tired of hearing it, but it's honestly the best advice anyone could give. LEARN JASS!
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
TimerUtils with either hashtable or structs?

What on earth that is supposed to mean? o_O ( Makes no sense )

Since he uses waits and 2 different periodic events, i thought of giving every spell it's own timer (TimerUtils), and then you can just use Hashtable or Structs to secure the MUI part of the spell. Makes sense now?
 
Level 8
Joined
Aug 6, 2008
Messages
451
TimerUtils with hashtables and structs just sounds lil bit weird, since TimerUtils kinda requires you to use structs and already uses hashtables ( At least Blue version does )

But yea, it was just a short and very unclear sentence that caused confusion.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
as far as I know everything what is possible in JASS is also possible with GUI + Custom Script (except the performance part)
however it is a lot harder to archive

learn JASS :grin:

and hashtables are slow
very slow
if you want a maximum of performance you should use indexing
but creating units or even special effects is a thousand times slower so if you experience any performance issues this will be the cause (I made my GUI knockback system able to handle 300 units at once just by cutting down the special effects from 33 per unit per second to 3.3 which still looks good enough)

I didn't read your code (I stopped at "vegetapoint" :ugly:) but as I already said: it is possible

but if you are using waits you should use an array with the duration and increase it every period
 
Status
Not open for further replies.
Top