Spell Power Draft (GUI)

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
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: 437
  • Power Draft 1.1.w3x
    26.4 KB · Views: 513

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
613
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: 402

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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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