Spell Black Arrow

Flare

Stops copies me!
Reaction score
662
GUI/JASS? GUI and JASS (JASS version can now be found here)
MUI? GUI is MUI for 1000 instances, JASS is fully MUI
Leaks? None to my knowledge in GUI version

Lag? With spell-spam, yes

To implement:[/U][/B]
Code:
--GUI version--
Copy the base ability, Black Arrow into your map.
Copy the dummy units, Hidden Dummy, Black Arrow and Nova into your map
(If your Editor isn't set to create unknown variables when copying triggers, go to file -> preferences, and check "automatically create unknown variables")
Copy the 3 spell triggers, BA cast, BA movement and BA damage.
Add the Black Arrow spell to a hero and enjoy :D


NOTE: If you are going to use the spell, please use the JASS version. It's more effecient, doesn't have a leak, doesn't use any imports and is MUCH easier to configure (hell, if you can't find the configurable stuff, you're blind!)



The relevant actions are highlighted within the code with red or blue text.
Default damage values are as follows:

-Ability Level X Intelligence in immediate damage/heal
-Each unit struck increases the end damage/heal (lets call it N) (depending on unit's alliance towards casting unit) by 10
-Damage/heal caused when the arrow explodes is N x Ability Level for casting hero


NOTICE!
If anyone wishes to use this spell in a map, PLEASE give me credit. I put alot of time and effort into making the spell work perfectly, and I don't want to see someone claiming that they created the spell from scratch.


Black Arrow
The Dark Rangers fires a dark arrow towards the target point. If an enemy is hit by the arrow, it will take damage and the arrow will store some damage. If an ally is hit, it will be healed and will store some healing. When the arrow reaches the target point, it explodes, healing allies for the accumulated healing and damaging enemies for the accumulated damage

The final damage/heal is 2 separate, independent values so if 50 enemies and 5 allies are hit, there is going to be much greater end damage than end heal

Code
Code:
BA cast
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Black Arrow 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                BACVal Less than or equal to 999
            Then - Actions
                Set BACVal = (BACVal + 1)
            Else - Actions
                Set BACVal = 1
        Set BACaster[BACVal] = (Triggering unit)
[COLOR="SeaGreen"][B]        Set BACasterLoc[BACVal] = (Position of BACaster[BACVal])[/B][/COLOR]
        Set BATargetLoc[BACVal] = (Target point of ability being cast)
        Set BAAngle[BACVal] = (Angle from BACasterLoc[BACVal] to BATargetLoc[BACVal])
        Set BADummySpawn[BACVal] = (BACasterLoc[BACVal] offset by 100.00 towards BAAngle[BACVal] degrees)
        Unit - Create 1 Black Arrow for (Owner of BACaster[BACVal]) at BADummySpawn[BACVal] facing BAAngle[BACVal] degrees
        Unit - Turn collision for (Last created unit) Off
        Set BADummy[BACVal] = (Last created unit)
        Unit - Set the custom value of (Last created unit) to BACVal
        Unit Group - Add (Last created unit) to BAArrowGroup
        Custom script:   call RemoveLocation (udg_BATargetLoc[GetUnitUserData(GetLastCreatedUnit())])
        Custom script:   call RemoveLocation (udg_BADummySpawn[GetUnitUserData(GetLastCreatedUnit())])

------------------------------------------------------------------------------------------------------------------------------------------------------------

BA movement
    Events
        Time - Every 0.02 seconds of game time
    Conditions
        (Number of units in BAArrowGroup) Greater than 0
    Actions
[B][COLOR="DarkOrange"]        Unit Group - Pick every unit in BAArrowGroup and do (Actions)
            Loop - Actions
                Set BADummyPt[(Custom value of (Picked unit))] = (Position of (Picked unit))
[COLOR="Sienna"]                Set BAMovePt[(Custom value of (Picked unit))] = (BADummyPt[(Custom value of (Picked unit))] offset by 10.00 towards BAAngle[(Custom value of (Picked unit))] degrees)[/COLOR]
                Unit - Move (Picked unit) instantly to BAMovePt[(Custom value of (Picked unit))]
                Unit - Create 1 Hidden Dummy for (Owner of BADummy[(Custom value of (Picked unit))]) at BACasterLoc[Custom value of (Picked Unit))] facing Default building facing degrees
                Unit - Set the custom value of (Last created unit) to (Custom value of BADummy[(Custom value of (Picked unit))])
                Unit - Add a 0.05 second Generic expiration timer to (Last created unit)
[COLOR="SeaGreen"][B]                Set BADist[(Custom value of (Picked unit))] = (Distance between BACasterLoc[(Custom value of (Picked unit))] and BAMovePt[(Custom value of (Picked unit))])[/B][/COLOR]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
[COLOR="Sienna"]                        BADist[(Custom value of (Picked unit))] Greater than or equal to 1500.00[/COLOR]
                    Then - Actions
                        Unit Group - Remove BADummy[(Custom value of (Picked unit))] from BAArrowGroup
                        Unit - Remove BADummy[(Custom value of (Picked unit))] from the game[/COLOR][/B]
                        Set BAEndDmgGroup[(Custom value of (Picked unit))] = (Units within 300.00 of BAMovePt[(Custom value of (Picked unit))] matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)))
                        Unit Group - Pick every unit in BAEndDmgGroup[(Custom value of (Picked unit))] and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Matching unit) belongs to an enemy of (Owner of BACaster[(Custom value of (Last created unit))])) Equal to False
                                    Then - Actions
[COLOR="Red"]                                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + BAEndHeal[(Custom value of (Last created unit))])[/COLOR]
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Matching unit) belongs to an enemy of (Owner of BACaster[(Custom value of (Last created unit))])) Equal to True
                                    Then - Actions
[COLOR="Red"][B]                                        Unit - Cause BACaster[(Custom value of (Last created unit))] to damage (Picked unit), dealing BAEndDamage[(Custom value of (Last created unit))] damage of attack type Spells and damage type Normal[/B][/COLOR]
                                    Else - Actions
                        Unit - Create 1 Nova for (Owner of BADummy[(Custom value of (Picked unit))]) at BAMovePt[(Custom value of (Picked unit))] facing Default building facing degrees
                        Unit - Turn collision for (Last created unit) Off
                        Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                        Custom script:   call DestroyGroup (udg_BAEndDmgGroup[GetUnitUserData(GetEnumUnit())])
                        -------- Damage Text --------
[COLOR="Red"]                        Floating Text - Create floating text that reads (String((Integer(BAEndDamage[(Custom value of (Picked unit))])))) at BAMovePt[(Custom value of (Picked unit))] with Z offset 0.00, using font size 10.00, color (60.00%, 10.00%, 60.00%), and 0.00% transparency[/COLOR]
                        Floating Text - Change (Last created floating text): Disable permanence
                        Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
                        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                        -------- Heal Text --------
[COLOR="Red"]                        Floating Text - Create floating text that reads (String((Integer(BAEndHeal[(Custom value of (Picked unit))])))) at BAMovePt[(Custom value of (Picked unit))] with Z offset 0.00, using font size 10.00, color (10.00%, 100.00%, 10.00%), and 0.00% transparency[/COLOR]
                        Floating Text - Change (Last created floating text): Disable permanence
                        Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
                        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 270.00 degrees
                    Else - Actions
                Custom script:   call DestroyGroup (udg_BADmgGroup[GetUnitUserData(GetEnumUnit())])
                Custom script:   call DestroyGroup (udg_BAEndDmgGroup[GetUnitUserData(GetEnumUnit())])
                Custom script:   call RemoveLocation (udg_BADummyPt[GetUnitUserData(GetEnumUnit())])
                Custom script:   call RemoveLocation (udg_BAMovePt[GetUnitUserData(GetEnumUnit())])

------------------------------------------------------------------------------------------------------------------------------------------------------------

BA damage
    Events
    Conditions
    Actions
        Unit Group - Pick every unit in BAArrowGroup and do (Actions)
            Loop - Actions
                Set BADummyPt[(Custom value of (Picked unit))] = (Position of BADummy[(Custom value of (Picked unit))])
                Set BATargetLoc[(Custom value of (Picked unit))] = (Position of (Triggering unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between BADummyPt[(Custom value of (Picked unit))] and BATargetLoc[(Custom value of (Picked unit))]) Less than or equal to 101.00
                        ((Triggering unit) belongs to an enemy of (Owner of BACaster[(Custom value of (Picked unit))])) Equal to False
                        ((Triggering unit) is alive) Equal to True
                    Then - Actions
[COLOR="Blue"][B]                        Set BAEndHeal[(Custom value of (Picked unit))] = (BAEndHeal[(Custom value of (Picked unit))] + 10.00)[/B][/COLOR]
[B][COLOR="Blue"]                        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((0.50 x (Real((Level of Black Arrow  for BACaster[(Custom value of (Picked unit))])))) x (Real((Intelligence of BACaster[(Custom value of (Picked unit))] (Exclude bonuses))))))[/COLOR][/B]
                        Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                        Special Effect - Destroy (Last created special effect)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between BADummyPt[(Custom value of (Picked unit))] and BATargetLoc[(Custom value of (Picked unit))]) Less than or equal to 101.00
                        ((Triggering unit) belongs to an enemy of (Owner of BACaster[(Custom value of (Picked unit))])) Equal to True
                        ((Triggering unit) is alive) Equal to True
                    Then - Actions
[COLOR="Red"][B]                        Set BAEndDamage[(Custom value of (Picked unit))] = (BAEndDamage[(Custom value of (Picked unit))] + 10.00)[/B][/COLOR]
[COLOR="Red"][B]                        Unit - Cause BADummy[(Custom value of (Picked unit))] to damage (Triggering unit), dealing ((0.50 x (Real((Level of Black Arrow  for BACaster[(Custom value of (Picked unit))])))) x (Real((Intelligence of BACaster[(Custom value of (Picked unit))] (Exclude bonuses))))) damage of attack type Spells and damage type Normal[/B][/COLOR]
                        Unit - Set life of BACaster[(Custom value of (Picked unit))] to ((Life of BACaster[(Custom value of (Picked unit))]) + ((0.50 x (Real((Level of Black Arrow  for BACaster[(Custom value of (Picked unit))])))) x (Real((Intelligence of BACaster[(Custom value of (Picked unit))] (Exclude bonuses))))))
                        Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
                        Special Effect - Destroy (Last created special effect)
                    Else - Actions
                Custom script:   call RemoveLocation (udg_BADummyPt[GetUnitUserData(GetEnumUnit())])
                Custom script:   call RemoveLocation (udg_BATargetLoc[GetUnitUserData(GetEnumUnit())])

Screenshots (taken from GUI version)
blackarrowpic3vj0.png
blackarrowpic4yo1.png

GUI version officially approved as of 9th Dec 2007.
 

Attachments

  • Black Arrow MUI fix, damage fix.w3x
    37.6 KB · Views: 518
  • Black Arrow (handle leak fixed).w3x
    43.6 KB · Views: 414

Flare

Stops copies me!
Reaction score
662
its MUI for up to 100 simultaneous casts, why would you need anymore (unless you intend to apply the spell to normal units rather than heroes) would be pretty damn hard to create 100 instances of the spell within about 2-3 second gap though
edit: ok, just realised that BACasterLoc leaks, i mustve forgotten to remove it once the dummy is removed.
also does this leak

Code:
Add last created unit to BAArrowGroup
Remove last created unit from BAArrowGroup

if that is looped 10 times (no units in the group originally), and i dont use 'Set Variable' at any time, will it just re-use the same group over and over, rather than overwrite the previous group setting and create a leak? its the first time ive used add/remove for unit groups and i dont remember seeing anything about it in any of the leak tutorials.

EDIT! New version uploaded, fixed the BACasterLoc leak, added hotkey to the ability tooltip, added a level-up action at map initiliazation, fixed the end damage/heal dealt and the floating text, should now do Level of Ability X End damage/heal value, and floating text should display the correct value
 

Darkchaoself

What is this i dont even
Reaction score
106
Hmm, nice spell, It looks nice from screenies and triggering is good, but i haven't seen in game. And the MUI Thing wont work if Custom Values are used for other things, but it is an efficient way to do it. +Rep.
 

FireBladesX

Eating my wings!
Reaction score
123
It'd be a huge pain, but it'd be sweet if you added a ! at the end of your floating texts.
You'd have to re-do your strings for the floating text, heh, but it might be worth it.
Nice spell btw
 

Flare

Stops copies me!
Reaction score
662
i did have the ! at end of floating texts, but forgot to re-add them after i made the spell MUI lol.

And the MUI Thing wont work if Custom Values are used for other things

The custom value is used ONLY for those dummies i.e. everytime i use custom value for spells, i used a totally different variable (in that case, it wud be BACVal, another spell i have uses OrbCV and BoltCV), so there would never be a situtation where one dummy unit has conflicting custom values
 

Tinki3

Special Member
Reaction score
418
Cool spell, and GUI-MUI, too! ;)

Leak:
Code:
Unit - Create 1 Hidden Dummy for (Owner of BADummy[(Custom value of (Picked unit))]) at [B](Center of (Playable map area))[/B] facing Default building facing degrees
Store the content in bold into a point variable, reference that content
via that variable and remove the variable immediately after use.

Here:
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        BACVal Less than or equal to 99
    Then - Actions
        Set BACVal = (BACVal + 1)
    Else - Actions
        Set BACVal = 1
...is fine, though you're adding multiple events to that damage trigger
with the BACVal basically as an array value index for the event source unit,
which could get messy once the BACVal loops back to 1 again, which
could cause double-executes of the damage trigger.

I would change 99 to 1000 to prevent something like that that could happen.
 

Flare

Stops copies me!
Reaction score
662
Thanks for pointing out the leak, I forgot to set its spawn point to casters location ^^

Even if it double-executes the trigger, can a unit be added to the same unit group twice and if so, would it executes the actions for the unit twice?

EDIT: Fixed version updated, the Center of Playable Map Area leak has been fixed, and slight alteration to the BA damage trigger (the events are added at map init)
 

Tinki3

Special Member
Reaction score
418
> slight alteration to the BA damage trigger (the events are added at map init)

Annoyingly, events aren't dynamic so whatever event you add will be the same
for the time it's there, which means initializing the "BADummy[]" variable would
do nothing to the event that "uses" that specific variable with its index, so you'd
have to manually add it again to make something happen to that unit/variable.
(Spell does not work atm in saying this because events are added at map init).

I'm not actually entirely sure as to if the trigger would double-execute, but
safety first I'd say :D. Just set your cast trigger out like this and it'll be fine:
Code:
BA cast
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Black Arrow 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                BACVal Less than or equal to [B]999[/B]
            Then - Actions
                Set BACVal = (BACVal + 1)
            Else - Actions
                Set BACVal = 1
        Set BACaster[BACVal] = (Triggering unit)
        Set BACasterLoc[BACVal] = (Position of BACaster[BACVal])
        Set BATargetLoc[BACVal] = (Target point of ability being cast)
        Set BAAngle[BACVal] = (Angle from BACasterLoc[BACVal] to BATargetLoc[BACVal])
        Set BADummySpawn[BACVal] = (BACasterLoc[BACVal] offset by 100.00 towards BAAngle[BACVal] degrees)
        Unit - Create 1 Black Arrow for (Owner of BACaster[BACVal]) at BADummySpawn[BACVal] facing BAAngle[BACVal] degrees
        Unit - Turn collision for (Last created unit) Off
        Set BADummy[BACVal] = (Last created unit)
        Unit - Set the custom value of (Last created unit) to BACVal
        Unit Group - Add (Last created unit) to BAArrowGroup
        [B]Trigger - Add to BA damage <gen> the event (Unit - A unit comes within 100.00 of BADummy[BACVal])[/B]
        Custom script:   call RemoveLocation (udg_BATargetLoc[GetUnitUserData(GetLastCreatedUnit())])
        Custom script:   call RemoveLocation (udg_BADummySpawn[GetUnitUserData(GetLastCreatedUnit())])

It would be good if you could also add some implementation instructions.
 

Tinki3

Special Member
Reaction score
418
> how/when exactly does a spell get approved?

When all conditions are true:
- Code is leakless
- Code is decently optimised
- <Spell> comes with implementation instructions
- <Spell's> tooltips are up-to-scratch
- <Spell> does not lag too much
- <Spell> has to fully work, and must not "bug" at anytime

Your spell meets the/my requirements, so it can be "approved" :).
 

Flare

Stops copies me!
Reaction score
662
fine with me, i dont mind if someone uses the spell/altered it in their own way, but unless you are going to drastically change what the spell does (i.e. make it so that it doesnt do the effects shown in the tooltip, or something like that), would you just give me credit for the basic idea of the spell at least (can't really take credit for the triggering if you convert it to JASS, especially since I have no knowledge of JASS ^^)
 

Cohadar

master of fugue
Reaction score
209
I don't plan to drastically change it, I was actually thinking of submitting it here to be put alongside your GUI version.
 

Cohadar

master of fugue
Reaction score
209
I decided not to make a full Jass version after all.

What I did was install PUI and used it instead of that 0..999 thing you used.
Spell is now 100% MUI (it is still all in GUI)

So instead of 1000 slots spell is now using only 1 slot for every unit that has that spell.

If there are 30 units with black arrow it will use 30 slots.

The other advantage of using PUI is that you can also have unlimited number of spells that use Unit's custom data while with that 0..999 method you could have only one spell, lolz.

The "disadvantage" is that PUI needs NewGen to compile.

I also optimized some things, and put comments about it.
You should read it, it will improve your GUI mapping.
 

Attachments

  • Black Arrow - PUI,GUI,MUI.w3x
    44.7 KB · Views: 301

Flare

Stops copies me!
Reaction score
662
interesting... unfortunately, i rly dont have time atm to try and understand JASS stuff (got exams coming up) and as long as noone casts the spell 1001 times in 3 seconds, im happy with the spell and how its currently triggered.

you can have large amount of spells using 0-999, just have a different variable for each spell (BACVal for that spell, another CVal variable for another spell. it may take more time than implementing 1 system (the PUI thing), but it makes it more easy to work with imo)
 

Flare

Stops copies me!
Reaction score
662
Added a few more instructions on how to edit the spell. If I have left out any instructions that would be important, please tell me.

Hmmm, just took a look at your PUI version of the spell and noticed this:
when you could do Set BACVal = (Custom value of (Picked unit))
and use BACVal from that point

If I set BACVal to the dummy's custom value, it -could- totally f*ck up the arrays (not fully sure on that, but there's always a possibility ^^) as BACVal could be changed from it's original regular increase.

And yes, I know I did waste alot of time/effort/space with Custom Value of Picked Unit, but it was my first MUI spell, and I had never thought of using a reference integer variable

Whether you will even look at this message, cohadar, I don't really know ^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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

      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