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

Kamehameha, no spell model. v1.2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: Wrda
So after a long time I decided to rewrite my old kamehameha spell. I wanted to make it viable for both GUI users and Vjassers.
The spell is in full MUI and unlike other kamehameha spells this one doesn't use a custom model:grin:
  • Kamehameha Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------------------------------------------------- --------
      • -------- Set this to the Kamehameha ability --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_Ability = Kame-Hame-Ha
      • -------- -------------------------------------------------------------- --------
      • -------- Set this to the Kamehameha Dummy unit --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_DummyUnit = Kamehameha Dummy
      • -------- -------------------------------------------------------------- --------
      • -------- Set this to your damage value --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_Damage[1] = 100.00
      • Set Ka_Damage[2] = 200.00
      • Set Ka_Damage[3] = 300.00
      • -------- -------------------------------------------------------------- --------
      • -------- The range depends on the speed, if the speed is 20 then it will be maxrange x 2 --------
      • -------- so currently the range it x2 --------
      • -------- Change the maximum range of the spell --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_MaxRange[1] = 200.00
      • Set Ka_MaxRange[2] = 350.00
      • Set Ka_MaxRange[3] = 500.00
      • -------- -------------------------------------------------------------- --------
      • -------- This is how far from the caster the spell will start. I recommend 50 but you can change it if you want --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_Offset = 50.00
      • -------- -------------------------------------------------------------- --------
      • -------- How fast the spell will go --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_Speed[1] = 20.00
      • Set Ka_Speed[2] = 20.00
      • Set Ka_Speed[3] = 20.00
      • -------- -------------------------------------------------------------- --------
      • -------- This is the area around the spell that will deal damage. --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_Radius = 200.00
      • -------- -------------------------------------------------------------- --------
      • -------- This is for how long the ''line'' will last --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_DummyTimer = 0.45
      • -------- -------------------------------------------------------------- --------
      • -------- Set to true if you want to the spell to destroy trees, else set to false --------
      • -------- -------------------------------------------------------------- --------
      • Set Ka_DestroyTrees = True
      • -------- -------------------------------------------------------------- --------
      • -------- -------------------------------------------------------------- --------
  • Kamehameha Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Ka_Ability
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ka_Size Equal to (==) 0
        • Then - Actions
          • Trigger - Turn on Kamehameha Loop <gen>
        • Else - Actions
      • -------- -------------------------------------------- --------
      • -------- Set the index of the spell --------
      • -------- -------------------------------------------- --------
      • Set Ka_Size = (Ka_Size + 1)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Ka_Size Greater than (>) Ka_MaxSize
          • Then - Actions
            • Set Ka_IndexX[Ka_Size] = Ka_Size
            • Set Ka_MaxSize = Ka_Size
          • Else - Actions
      • Set TempInt = Ka_IndexX[Ka_Size]
      • -------- -------------------------------------------- --------
      • -------- Set the caster --------
      • -------- -------------------------------------------- --------
      • Set Ka_Caster[TempInt] = (Triggering unit)
      • -------- -------------------------------------------- --------
      • -------- Set point 1 and 2 to get the angle of the spell --------
      • -------- -------------------------------------------- --------
      • Set Tempoint1 = (Position of Ka_Caster[TempInt])
      • Set Tempoint2 = (Target point of ability being cast)
      • Set Ka_Angle[TempInt] = (Angle from Tempoint1 to Tempoint2)
      • -------- -------------------------------------------- --------
      • -------- Sets the start point of the spell --------
      • -------- -------------------------------------------- --------
      • Set Tempoint3 = (Tempoint1 offset by Ka_Offset towards Ka_Angle[TempInt] degrees)
      • -------- -------------------------------------------- --------
      • -------- Get the level of the ability from the caster --------
      • -------- -------------------------------------------- --------
      • Set Ka_AbilityLvl[TempInt] = (Level of Ka_Ability for Ka_Caster[TempInt])
      • -------- -------------------------------------------- --------
      • -------- Get the range/ level of the spell --------
      • -------- -------------------------------------------- --------
      • Set Ka_Range[TempInt] = 0.00
      • Set Ka_MaxRange[TempInt] = Ka_MaxRange[Ka_AbilityLvl[TempInt]]
      • -------- -------------------------------------------- --------
      • -------- Set the damage --------
      • -------- -------------------------------------------- --------
      • Set Ka_Damage[TempInt] = Ka_Damage[Ka_AbilityLvl[TempInt]]
      • -------- -------------------------------------------- --------
      • -------- Create the ''leader'' dummy --------
      • -------- -------------------------------------------- --------
      • Unit - Create 1 Ka_DummyUnit for (Owner of Ka_Caster[TempInt]) at Tempoint3 facing Ka_Angle[TempInt] degrees
      • Set Ka_Dummy[TempInt] = (Last created unit)
      • -------- -------------------------------------------- --------
      • -------- Create a group to check which units that have already taken damage. --------
      • -------- -------------------------------------------- --------
      • Custom script: set udg_Ka_UnitDamageGroup[udg_TempInt] = CreateGroup()
      • -------- -------------------------------------------- --------
      • -------- Remove the leaks --------
      • -------- -------------------------------------------- --------
      • Custom script: call RemoveLocation (udg_Tempoint1)
      • Custom script: call RemoveLocation (udg_Tempoint2)
      • Custom script: call RemoveLocation (udg_Tempoint3)
  • Kamehameha Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer Ka_Loop) from 1 to Ka_Size, do (Actions)
        • Loop - Actions
          • -------- Indexes the spell --------
          • Set TempInt = Ka_IndexX[Ka_Loop]
          • -------- Sets the position of the Dummy unit --------
          • Set Tempoint1 = (Position of Ka_Dummy[TempInt])
          • -------- This sets the speed of the Dummy unit --------
          • Set Tempoint2 = (Tempoint1 offset by Ka_Speed[Ka_AbilityLvl[TempInt]] towards Ka_Angle[TempInt] degrees)
          • Set Ka_UnitGroup[TempInt] = (Units within Ka_Radius of Tempoint1 matching ((((Matching unit) is A structure) Equal to (==) False) and ((((Matching unit) is alive) Equal to (==) True) and ((((Matching unit) belongs to an enemy of (Owner of Ka_Caster[TempInt])) Equal to (==) True) and (((
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Ka_Range[TempInt] Greater than or equal to (>=) Ka_MaxRange[TempInt]) or ((Terrain pathing at Tempoint2 of type Walkability is off) Equal to (==) True)
              • Then - Actions
                • Custom script: call DestroyGroup(udg_Ka_UnitGroup[udg_TempInt])
                • Custom script: call DestroyGroup(udg_Ka_UnitDamageGroup[udg_TempInt])
                • Unit - Kill Ka_Dummy[TempInt]
                • Set Ka_IndexX[Ka_Loop] = Ka_IndexX[Ka_Size]
                • Set Ka_IndexX[Ka_Size] = TempInt
                • Set Ka_Size = (Ka_Size - 1)
                • Set Ka_Loop = (Ka_Loop - 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Ka_Size Equal to (==) 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
              • Else - Actions
                • Set Ka_Range[TempInt] = (Ka_Range[TempInt] + 10.00)
                • Unit - Move Ka_Dummy[TempInt] instantly to Tempoint2
                • Unit - Create 1 Ka_DummyUnit for (Owner of Ka_Caster[TempInt]) at Tempoint1 facing (Facing of Ka_Dummy[TempInt]) degrees
                • Unit - Add a Ka_DummyTimer second Generic expiration timer to (Last created unit)
                • -------- Remove this if you don't want the Destroy Trees trigger in your map --------
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Ka_DestroyTrees Equal to (==) True
                    • Then - Actions
                      • Destructible - Pick every destructible within Ka_Radius of Tempoint1 and do (Actions)
                        • Loop - Actions
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Current life of (Picked destructible)) Greater than (>) 0.00
                            • Then - Actions
                              • Unit - Order Harvester to Harvest (Picked destructible)
                                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • (Current order of Harvester) Equal to (==) Harvest
                                  • Then - Actions
                                    • Destructible - Kill (Picked destructible)
                                  • Else - Actions
                                    • Unit - Order Harvester to Stop
                            • Else - Actions
                    • Else - Actions
                • Unit Group - Pick every unit in Ka_UnitGroup[TempInt] and do (Actions)
                  • Loop - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • ((Picked unit) is in Ka_UnitDamageGroup[TempInt]) Equal to (==) False
                      • Then - Actions
                        • Unit - Cause Ka_Caster[TempInt] to damage (Picked unit), dealing Ka_Damage[Ka_AbilityLvl[TempInt]] damage of attack type Spells and damage type Unknown
                        • Unit Group - Add (Picked unit) to Ka_UnitDamageGroup[TempInt]
                      • Else - Actions
          • Custom script: call RemoveLocation (udg_Tempoint1)
          • Custom script: call RemoveLocation (udg_Tempoint2)
  • Destroy Trees Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Harvesterloc = (Point(0.00, 0.00))
      • Unit - Create 1 Peasant for Neutral Passive at Harvesterloc facing Default building facing (270.0) degrees
      • Unit - Hide (Last created unit)
      • Unit - Make (Last created unit) Invulnerable
      • Set Harvester = (Last created unit)
      • Custom script: call RemoveLocation(udg_Harvesterloc)
JASS:
/**************************************************************************************************                                                                       *
* This spell requires TimerUtils, RegisterPlayerUnitEvent, SpellEffectEvent and IsDestructableTree*
***************************************************************************************************/

scope Kamehameha

    globals
        private constant integer AID                = 'A000' //Set AID = your ability id. To get a spells id go into the objekt editor and press ctrl+d.
    
    
        private constant real AOE                   = 200 //How large area around the spell that will take damage.
    
        private constant real OFFSET                = 50. //How long infront of the caster the unit will spawn.
    
        private constant integer DUMMY              = 'h000' //Set this to the Unit it of your dummy. Press ctrl+d in the objekt editor to find it.
    
        private constant attacktype ATTACK_TYPE     = ATTACK_TYPE_NORMAL
        private constant damagetype DAMAGE_TYPE     = DAMAGE_TYPE_NORMAL
    
        private constant real INTERVAL              = 0.0312500 //How often the spell will run, this is the same as GUIs Time - Every 0.03 seconds of game time
        
        private constant real DUMMYTIMER            = 0.45 //This is for how long the ''line'' will last
        
        private constant boolean DESTROYTREE        = true
    endglobals
    
    //This is the formula for the damage. You can make your own formula if you want.
    private constant function GetDamage takes integer lvl returns real
        return 20.*lvl
    endfunction
    
    //This is the range of the spell, it will multiply by the speed, check the WARNING below.
    private constant function GetRange takes integer lvl returns real
        return 200.*lvl
    endfunction
    
    //This is how fast the spell will move.
    /*********************************************************************
    *                     WARNING!!                                      *
    * The speed of the spell changes how long the range of the spell is! *
    * If the speed is 20 then is will multiply the range with 2*range.   *
    **********************************************************************/
    private constant function GetSpeed takes integer lvl returns real
        return 20. + 0*lvl
    endfunction    
    
    private function GetTree takes nothing returns nothing
        if IsDestructableTree(GetEnumDestructable()) then
           call KillTree(GetEnumDestructable())
        endif
    endfunction
    
    //This checks if a unit is alive so we can deal damage to it or not.
    native UnitAlive takes unit id returns boolean
    
    //This is the formula that filters out which units that should take damage.
    private function FilterUnits takes unit u, player p returns boolean
        return (UnitAlive(u)) and (IsUnitEnemy(u, p)) and (not IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE))
    endfunction
    
    //DON'T EDIT ANYTHING BELOW
    
    private struct Kamehameha extends array
        unit caster
        unit dummy
        real damage
        real angle
        player owner
        real range
        real inRange
        real speed
        integer lvl
        group g
       
        static integer array rn
        static integer ic = 0
    
    
    private static method line takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local thistype this = GetTimerData(t)
        local unit u
        local location l = GetUnitLoc(.dummy)
        local real x = GetUnitX(.dummy)
        local real y = GetUnitY(.dummy)
        local unit u2
        
        set .g = CreateGroup()
    
    if UnitAlive(.caster) and .inRange < .range then
         
         //This checks if the DestroyTree globals is true, and if it is then if will destroy all trees withing "aoe" range.
         if DESTROYTREE == true then
             call EnumDestructablesInCircleBJ( AOE, l, function GetTree)
         endif
         
         //Picks all units within "AOE" range and deals damage to them.
         call GroupEnumUnitsInRange( .g, x, y, AOE, null)
         set u2 = CreateUnit( .owner, DUMMY, x, y, GetUnitFacing(.dummy))
         loop
             set u = FirstOfGroup(.g)
             exitwhen u == null
             call GroupRemoveUnit(.g, u)
             if FilterUnits(u, .owner) then
                call UnitDamageTarget(.caster, u, .damage, false, false, ATTACK_TYPE, DAMAGE_TYPE, null)
             endif
         endloop
         call SetUnitX(.dummy, GetUnitX(.dummy)+.speed*Cos(.angle))
         call SetUnitY(.dummy, GetUnitY(.dummy)+.speed*Sin(.angle))
         call UnitApplyTimedLife(u2, 'BTLF', DUMMYTIMER)
         set u2 = null
         set .inRange = .inRange + 10.
    else
         call ReleaseTimer(t)
      
         call KillUnit(.dummy)
         //Deindex the spell
         set rn[this] = rn[0]
         set rn[0] = this
      
      
         //Null som of the variables
         set caster = null
         set owner = null
    endif
    //Clear the leaks
    call RemoveLocation(l)
    set l = null
    call DestroyGroup(.g)
    set u2 = null
    set t = null
    set u = null
    set g = null
    
   endmethod
    
    private static method run takes nothing returns nothing
        local thistype this
        local integer lvl
        local real x = GetUnitX(GetTriggerUnit())
        local real y = GetUnitY(GetTriggerUnit())
    
        //Index the spell
        set this = rn[0]
        if this == 0 then
           set ic = ic + 1
           set this = ic
        else
           set rn[0] = rn[this]
        endif
         
          
        set .owner   = GetTriggerPlayer()
        set .caster  = GetTriggerUnit()
        set  lvl     = GetUnitAbilityLevel(.caster, AID)
        set .damage  = GetDamage(lvl)
        set .range   = GetRange(lvl)
        set .angle   = Atan2(GetSpellTargetY()-y,GetSpellTargetX()-x)
        set .dummy   = CreateUnit(.owner,DUMMY,x + OFFSET*Cos(.angle),y + OFFSET*Sin(.angle),.angle*bj_RADTODEG)
        set .inRange = 0
        set .speed   = GetSpeed(lvl)
    
        call TimerStart(NewTimerEx(this), INTERVAL, true, function thistype.line)
    
    endmethod
    
    private static method onInit takes nothing returns nothing
        call RegisterSpellEffectEvent(AID, function thistype.run)
    endmethod
    
    
    endstruct
endscope
Magtheridon96 for RegisterPlayerUnitEvent
Bribe for SPellEffectEvent
Vexorian for TimerUtils
BPower for IsDestructableTree and help with VJass version
Alot of thanks to PurplePoot for helping me with the Vjass Version:thumbs_up:
Malhorne for pointing out leaks

1.0 Initial release.
1.1 Fixed the VJass version, removed the Remove Unit trigger.
1.2 Added a new group to check which units have been damaged in the GUI trigger to make the damage more reliable. I put the GetUnitX/Y into a locals.


Keywords:
Kamehameha, dbz, dragonball, wave, line, beam, TheGoldenGoblin, dragon, ball, GUI, VJass
Contents

Kamehameha (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 14:20, 16th Mar 2014 BPower: I've made some suggestions for the next update here...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

14:20, 16th Mar 2014
BPower:
I've made some suggestions for the next update here:

http://www.hiveworkshop.com/forums/spells-569/kamehameha-no-spell-model-v1-2-a-179104/index3.html#post2500184

[hidden="Old]12:41, 13th Mar 2014
BPower:

Refer to my last post


Reviewed by Maker, Kamehameha v1.1, 11th Jan 2013

Required changes:
  • The importing instructions are lacking, the ability condition and created
    dummy unit types must be set in the triggers
  • The tree detection is not good
    -> Check this

Suggested changes:
  • Use variables and set their value in the Hash trigger. This way the spell is more easy to configure
  • You could use CreateGroup in the line where you store the group
    into hastable. You wouldn't need a local variable then
  • Do (MissileGroup is empty) Equal to False check only after you remove a missile from the group
  • You spam effects and create tons of dummy units, try to reduce the amount
  • Ablity learn tooltip doesn't list hotkey and the tooltips don't list damage
  • The dummy doesn't need invulnerability ability, it has locust
[/hidden]
 
Level 6
Joined
Dec 6, 2009
Messages
168
1st. the point is do not use model...
2nd. why? it is needed, or else the kamehame ha will be something like 10 range...
3rd. I don't care about dmg, the user can change that by them selfs.
4th. No, I think it is better that is makes aoe so all units within the kamehameha get damaged.
5th. Don't know what atm are...
 
dude this spell is so poor
1st. you should get a kamehameha model
2nd. remove cooldowns
3rd. increase damage
4th. make it to knockback the target
5th. can't find one atm but ill tell you when i find it xD

@1: users can do that themselves... and its pretty against the rules to import models unless really needed + as he said the point is do not use model...

@2 and 3: why will he? you can do it yourself...

@5: why put a 5 if you dont know what it is atm?...

Judging by your comment, I think you dont know how spells uploaded in this section was constructed/supposed to be constructed... coz if yes, you wouldnt put number 2,3...
 
Level 18
Joined
Oct 17, 2012
Messages
820
Place (Picked unit) into a variable and use the variable instead of directly using (Picked unit). This is what you have done with the locations used. You referred back to them with variables.
lol Also, what I meant with (Owner of Kamehameha_Caster) is to completely remove Owner of.
Triggering player should be first in the list.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
Review:

Required changes:
1. Kamehameha1, Kamehameha2, You should rename these triggers to something better like Kamehameha1 > Kamehameha cast; Kamehameha2 > Kamehameha Loop, makes people get understood faster.
2.
  • Unit - Create 1 Kamehameha Dummy for (Owner of (Picked unit)) at Kamehameha_Point[4] facing (Facing of (Picked unit)) degrees
  • Unit - Add a 0.45 second Generic expiration timer to (Last created unit)
You could just create 1 unit for each cast, save it into the hashtable*, then load it at loop trigger and move it instead of creating too many unnecessary dummy effects.
3.
  • Special Effect - Create a special effect at Kamehameha_Point[4] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
This model should be configurable.
4.
  • Unit - Cause Kamehameha_Caster to damage (Picked unit), dealing ((Real((Level of Impale for Kamehameha_Caster))) x 20.00) damage of attack type Spells and damage type Magic
Damage should be configurable, attack type and damage type too.
5.
  • Set Kamehameha_Point[5] = (Kamehameha_Point[4] offset by 20.00 towards (Facing of (Picked unit)) degrees)
Location offset should be configurable.

Optional changes:
1. Save (Picked Unit) into a variable, makes the trigger run faster and it's faster itself for choosing which unit you are refering to (instead of wasting time trying to find the "Picked Unit") like GhostHunter123 said.
2. *This is might be complicated to you to do, you could use indexing for making this spell MUI, without making hashtables, as its number on a map is limited. If you want to do this, this can help you: http://www.hiveworkshop.com/forums/spells-569/gui-dynamic-indexing-template-144325/?prev=mmr%3D6

Needs many changes :b 3/5 for now, if you do good changes i give 4/5.
Keep coding, +rep :thumbs_up:
Edit: Also, please use hidden tags while posting triggers, posting triggers without them increases the thread.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I've never seen a kamehameha use a custom model o_O its all just a sideways tome of strength
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Why do you upload a vJass version, when it is obviously not working?
Get rid of it or fix it. When you need help, ask for it.

There is a folder "Kamehame ha not working" in your map. Delete triggers not related to the current version, because they will just confuse users.

1. Proper indentation
JASS:
function NotGood takes nothing returns nothing
call (...)
endif

function Good takes nothing returns nothing
    call(...)
endif

In general locations should only be used to determine a location offset in z axis.
An angle between two points is calculated this way Atan2(y0 -y, x0 - x) y/x are the casters coordinates and x0/y0 are the spell target coordinates.
Be careful because Atan2 returns an angle in radians. Multiplying an angle in radians by bj_RADTODEG will convert it to degrees.

Use just one global group for the FoG enumeration.

Why do you kill and remove the dummy unit?

There is no reason for a struct member called lvl. Use a local integer variable instead.
 
Last edited:
These are for the vJass version.

  • Your constants should be in ALL_CAPS.
  • You never state that IsDestructableTree is required.
  • Do not uselocationin JASS (under most circumstances).
  • You should inlineEnumDestructablesInCircleBJbecause it leaks an is relatively inefficient.
  • You leak a unit group.gbecause you never destroy it. I would use GroupUtils' ENUM_GROUP instead of creating/destroying groups on the fly.
You should probably also add the vJass tag to this in addition to GUI / Triggers.

Although if the vJass version doesn't work and you don't want to update it, then scrap it like BPower said.
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
if IsDestructableTree(GetEnumDestructable()) == true then
->
if IsDestructableTree(GetEnumDestructable())then

JASS:
set .angle   = Atan2(GetSpellTargetY()-GetUnitY(.caster),GetSpellTargetX()-GetUnitX(.caster))
        set .dummy   = CreateUnit(.owner,DUMMY,GetUnitX(.caster) + Offset*Cos(.angle),GetUnitY(.caster) + Offset*Sin(.angle),.angle*bj_RADTODEG)
->
Store GetUnitX(.caster)/GetUnitY(.caster) into some real x/y local !


I suggest only one timer and use dynamic indexing (see in my sign if you don't see what I mean).

Don't use locations....

JASS:
if DestroyTree == true then
             call EnumDestructablesInCircleBJ( aoe, l, function GetTree)
         endif
->
JASS:
if DestroyTree then
    //Put the code of the BJ because it leaks ...
endif


JASS:
//Null all the variables
         call RemoveLocation(l)
         set l = null
         set g = null
         set u = null
         set t = null
         set owner = null
         set caster = null
         set t = null
         set u2 = null
Put this outside the if block otherwise you will not clean every time and it leaks ><
 
Level 6
Joined
Dec 6, 2009
Messages
168
If I put owner and caster to null outside of the else block the spell won't work. But I did put the rest outside of the else section and I also added GetUnitX/Y to locals.

I don't know how to get the trees unless I'm using locations since it won't allow me to pick all trees withing AOE of x/y of the dummy unit..

Maby I should scrap the vJass version since this is a really simple spell and there is no real reason to make it in vjass.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Get rid of call EnumDestructablesInCircleBJ( AOE, l, function GetTree)

--> TEMP is a rect added to the globals block. private rect TEMP = Rect(0,0,0,0)
JASS:
call SetRect(TEMP, minx, miny, maxx, maxy)
call EnumDestructablesInRect(TEMP, null, function GetTree)
Furthermore use only one global group for the FoG enumeration, also added to the globals block private group GROUP = CreateGroup()
-->call GroupEnumUnitsInRange(GROUP, x, y, AOE, null)

You have two needless GetTriggerUnit() function calls. Set x/y later once you initialized
the struct member caster. Variable lookups are much faster than function calls.

I don't want to see any use of locations in the next update.

In the GUI version the picked destructable could be stored into a variable, as pick destructable is a function call.
The harvest ability comparison is displayed as unknown in my editor. What kind of editor are you using?
It also crashes my editor if I try to change it (Someone please confirm that.)
 
Top