Spell Power Draft (GUI)

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
Power Draft
By KaerfNomekop (First submission :D)
378754_316348701708715_100000007635796_1271752_157937047_n.jpg

Description:
Code:
Strikes the target with magic energy, dealing damage. Every second that this spell
is not in cooldown reduces this damage by 5, to a maximum reduction of 50.

Level 1 - 100 base damage.
Level 2 - 150 base damage.
Level 3 - 200 base damage.
Level 4 - 250 base damage.

Cooldown: 2 seconds
Manacost: 35/40/45/50

Info:
This spell was made for spamming (thus the low cooldown and manacost).
Pros:
  • Made in GUI, so it's easy to understand.
  • MUI - uses hashtables.
  • Customizable - Maximum/minimum damage, interval between damage reductions, damage reduction amount, floating text, cooldown, manacost, effect and spell name can all be changed.
  • Easy to duplicate - just copy the triggers and change the variables.
  • Uses a periodic trigger, so it's more accurate.
  • AFAIK, does not leak.

Cons:
  • Made in GUI, so it's hugely inefficient.
  • Uses hashtables, so it might be a tiny bit complicated. Ok, so maybe it's a little bit complicated.
  • Uses a periodic trigger. May reduce performance.
  • May contain leaks.
  • Has no missile art.
  • Lacks a nice backstory.
  • Has 6 cons versus 6 pros.


Trigger Code:
Trigger:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Using the hashtable makes the spell MUI. --------
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
      • -------- Whether or not floating text is displayed. --------
      • Set DisplayTextBoolean = True
      • -------- For the rest of the globals, the array index is the level, i.e. Cooldown[1] is the cooldown for level 1. --------
      • -------- Increase/decrease the array sizes to suit the number of levels. --------
      • -------- Cooldown of the spell. --------
      • Set Cooldown[1] = 2.00
      • Set Cooldown[2] = 2.00
      • Set Cooldown[3] = 2.00
      • Set Cooldown[4] = 2.00
      • -------- Interval between reduction of damage. --------
      • Set Interval[1] = 1.00
      • Set Interval[2] = 1.00
      • Set Interval[3] = 1.00
      • Set Interval[4] = 1.00
      • -------- Reduction of damage that occurs at every interval. --------
      • Set Reduction[1] = 5.00
      • Set Reduction[2] = 5.00
      • Set Reduction[3] = 5.00
      • Set Reduction[4] = 5.00
      • -------- Maximum damage that the spell deals. --------
      • Set DamageMax[1] = 100.00
      • Set DamageMax[2] = 150.00
      • Set DamageMax[3] = 200.00
      • Set DamageMax[4] = 250.00
      • -------- Minimum damage that the spell deals. Reduction happens at every interval until this value is reached. --------
      • Set DamageMin[1] = 50.00
      • Set DamageMin[2] = 100.00
      • Set DamageMin[3] = 150.00
      • Set DamageMin[4] = 200.00

Trigger:
  • Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Power Draft
    • Actions
      • Set TempInt = (Level of Power Draft for (Triggering unit))
      • Hashtable - Save DamageMax[TempInt] as (Key (Triggering unit)) of (Key PowerDraftDamage) in Hashtable
      • Hashtable - Save 0.00 as (Key (Triggering unit)) of (Key PowerDraftTime) in Hashtable
      • Unit Group - Add (Triggering unit) to PowerDraftGroup

Trigger:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Power Draft
    • Actions
      • Set TempInt = (Level of Power Draft for (Triggering unit))
      • Set TempInt2 = (Integer((Load (Key (Triggering unit)) of (Key PowerDraftDamage) from Hashtable)))
      • -------- Floating text displays the damage dealt. Set DisplayTextBoolean to "false" to disable this. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DisplayTextBoolean Equal to True
        • Then - Actions
          • Set TempPoint = (Position of (Target unit of ability being cast))
          • Floating Text - Create floating text that reads ((String(TempInt2)) + !) at TempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown :(" loading="lazy" data-shortname=":(" /> Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real(TempInt2)) damage of attack type Spells and damage type Magic
      • Unit Group - Remove (Triggering unit) from PowerDraftGroup
      • Wait Cooldown[TempInt] seconds
      • Hashtable - Save 0.00 as (Key (Triggering unit)) of (Key PowerDraftTime) in Hashtable
      • Hashtable - Save DamageMax[TempInt] as (Key (Triggering unit)) of (Key PowerDraftDamage) in Hashtable
      • Unit Group - Add (Triggering unit) to PowerDraftGroup

Trigger:
  • Reduction
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
      • (Number of units in PowerDraftGroup) Greater than 0
    • Actions
      • Unit Group - Pick every unit in PowerDraftGroup and do (Actions)
        • Loop - Actions
          • Set TempInt = (Level of Power Draft for (Picked unit))
          • Set TempReal = (Load (Key (Picked unit)) of (Key PowerDraftTime) from Hashtable)
          • Set TempReal2 = (Load (Key (Picked unit)) of (Key PowerDraftDamage) from Hashtable)
          • Hashtable - Save (TempReal + 0.05) as (Key (Picked unit)) of (Key PowerDraftTime) in Hashtable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempReal Equal to Interval[TempInt]
            • Then - Actions
              • Hashtable - Save 0.00 as (Key (Picked unit)) of (Key PowerDraftTime) in Hashtable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempReal2 Greater than DamageMin[TempInt]
                • Then - Actions
                  • Hashtable - Save (TempReal2 - Reduction[TempInt]) as (Key (Picked unit)) of (Key PowerDraftDamage) in Hashtable
                • Else - Actions
            • Else - Actions

Changelog:
29/11/2011, 0005 - v1.0 First release.
05/12/2011, 2322 - v1.1 Changed interval, added a condition to Reduction trigger.
 

Attachments

  • Power Draft.w3x
    26.3 KB · Views: 429
  • Power Draft 1.1.w3x
    26.4 KB · Views: 504

Dirac

22710180
Reaction score
147
  • Instead of having 1 array index per level (like you do on the first trigger) make the user use equations, add variables such as "damage per level" and "base damage" instead
  • You don't need hashtables for this, only any GUI indexing system, or even, any indexing system
  • 0.01 second timer, way too fast, use 0.1, if this were JASS you wouldn't need a periodic timer at all.
  • The description has 1 typo: "this" damage -> "it's" damage or "damage done by Power Draft"
  • It leaks a hashtable, but that can't be avoided in GUI
 

Dirac

22710180
Reaction score
147
Creating a new hashtable per spell causes a leak and takes you closer to the 255 limit
In JASS only 1 hashtable is used for every purpose.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
>In JASS only 1 hashtable is used for every purpose.

I suppose you mean in your jass scripts.

But you shouldn't generalize it. Even dota (a map with huge script) uses at least 2 hashtables (read it somewhere [perhaps in the global section =)]).

Edit:
Nope actually the 6.72f version of dota uses exactly 2 hashtables.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
What I don't get is why anyone would even think gui has to use a ton of different hashtables, before I stopped working on my rpg my hashtable stored everything from unit stats to ability information in one, and threat or "AI" targeting algorithm inputs in another without any problems, he should just make it so the integers used to save the information can be edited via a variable, so they don't overlap with other spells

Also pkmnfrk...
To reduce lag add an if then else statement in the periodic to turn it off if there are no units in the group, and turn it on when u add units to it, so its not always running, and as I believe someone said earlier, u should increase the interval, maybe to 0.02 - 0.04
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
Instead of having 1 array index per level (like you do on the first trigger) make the user use equations, add variables such as "damage per level" and "base damage" instead
On certain occasions, an equation can't be found. Other times you're too lazy to find them or just aren't capable of thinking it out. Either way it saves time and can be changed easily.

You don't need hashtables for this, only any GUI indexing system, or even, any indexing system
It leaks a hashtable, but that can't be avoided in GUI
I never liked indexing systems. Maybe because I once tried (and failed) to make one when I was first dabbling in the editor. Anyway the hashtable is used for dozens of other spells.

0.01 second timer, way too fast, use 0.1, if this were JASS you wouldn't need a periodic timer at all.
To reduce lag add an if then else statement in the periodic to turn it off if there are no units in the group, and turn it on when u add units to it, so its not always running, and as I believe someone said earlier, u should increase the interval, maybe to 0.02 - 0.04
Interval reduced to 0.05, condition added.

The description has 1 typo: "this" damage -> "it's" damage or "damage done by Power Draft"
Clarificatoin please?

he should just make it so the integers used to save the information can be edited via a variable, so they don't overlap with other spells
I don't use simple integers, I use Key(String). Correct me if I'm wrong, but I'm quite sure that's unique to every string so there shouldn't be any overlaps.
 

Attachments

  • Power Draft 1.1.w3x
    26.4 KB · Views: 397

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
I don't use simple integers, I use Key(String). Correct me if I'm wrong, but I'm quite sure that's unique to every string so there shouldn't be any overlaps.

Ahh just noticed that, ya u shouldnt have a problem with overlaps, so i would let them choose what hashtable to sue for it rather than using a new one

ps. I cant see where you added the condition and all that, did you update the code to show that?

EDIT:

I see it now and that would help but thats not what i was meaning, i was meaning do something like this at the end of it:

Trigger:
  • Actions
    • If (Conditions), Then (Do Actions, Else (Do Else Actions)
      • If - Conditions
        • Number of Units in group is equal to 0
      • Then - Actions
        • Trigger - Turn off this trigger
      • Else - Actions


then from there you turn on the trigger when you add units to it
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top