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: 547
  • Black Arrow (handle leak fixed).w3x
    43.6 KB · Views: 452
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
 
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.
 
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
 
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
 
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.
 
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)
 
> 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.
 
> 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" :).
 
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 ^^)
 
I don't plan to drastically change it, I was actually thinking of submitting it here to be put alongside your GUI version.
 
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: 326
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)
 
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.
  • Ghan Ghan:
    But the electorate would have to demand it and vote people in to do it.
  • Ghan Ghan:
    Government spending, foreign policy, and the southern border are all bigger issues than the income tax right now I'd say.
  • The Helper The Helper:
    For you those are the bigger issues. Cannabis legalization and get rid of Income tax are mine.
  • Ghan Ghan:
    We have so much cannabis up here in Oklahoma. Can't go a block without running into 3 dispensaries. xD
  • The Helper The Helper:
    if the demand is there
  • jonas jonas:
    I think the biggest issue in USA is how divided the country has become
  • Ghan Ghan:
    There's a big split happening in fundamental values that is very worrisome.
  • jonas jonas:
    I think there's always been a split in values. But now there's a split in what reality is. No matter whom you ask, they think a third of the country is insane and wants to destroy the country
  • The Helper The Helper:
    pretty big split
  • The Helper The Helper:
    Happy Saturday!
    +1
  • V-SNES V-SNES:
    Happy Saturday!
    +1
  • The Helper The Helper:
    Dont forget to check out the list of all the recipes on the site at the Recipe Index - I am about to take Ghan up on the offer of making that a site :) https://www.thehelper.net/threads/main-recipes-menu-recipes-index-version-2-0.189517/
  • The Helper The Helper:
    We should add that as part of site navigation
  • Varine Varine:
    I just don't think Trump actually understands how the government works. I'm not going to pretend like I can understand the entirety of government but in my industry he kind of caused massive fucking issues. Tarriffs and the international counters had a pretty significant impact on what I do, it was actually kind of interesting to see though. I live in Idaho so I'm not really concerned with it, it'll be R pretty much the entire way down. We do have ranked choice on our ballot this year though and I DO really care about that. But if we are going to have a federal government we kind of need income tax. They could abolish it and tax states I guess, but then states are just going to raise income taxes. It's not really viable without a very significant and holistic overhaul of how the federal government works, and that isn't something I would expect Trump to do.
  • Varine Varine:
    I don't expect Harris to do it either. I want to see wealth and church taxes, but those also aren't things I'm going to hold my breath for.
  • jonas jonas:
    I mean he definitely doesn't, which is why he had to retract most of his executive orders, didn't manage to get rid of obamacare etc.
  • jonas jonas:
    B
  • jonas jonas:
    Replacing income tax with a wealth tax would be amazing imho, but I can't even imagine that this would happend
  • Ghan Ghan:
    Wealth tax would be a disaster. Imagine having to liquidate retirement accounts because you have a tax bill just for unrealized gains. Or your house goes up in price and you have to sell it to pay the tax bill.
  • jonas jonas:
    I'm not talking about an income tax on wealth gain.
  • jonas jonas:
    we already have a wealth tax on our house, it's called a property tax. I'm talking about extending that to other income-generating assets like private equity, bonds and stocks.
  • jonas jonas:
    I agree that the effect of that would be to depress asset prices, but I think that's a good thing. Makes it easier for hard working young people to grow their retirement income
    +1
  • seph ir oth seph ir oth:
    Potential problem for a wealth tax for the US would be the ultra rich just offshoring assets in another country without a wealth tax. Those that would eat the wealth tax on, say, stocks, would be the middle class that puts money slowly into the market via the likes of funds.
  • seph ir oth seph ir oth:
    happy US election day btw!
  • Varine Varine:
    Oh election day

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top