Spell 1000 Hammers

Tyman2007

Ya Rly >.
Reaction score
74
Well... 1000 hammers is metaphorically speaking. it's max amount of hammers it can throw is 75.. unless you change it of course.

I made this in 15 minutes. Don't expect a non-cliche or a professional spell because this is really the first vJass spell i've posted.

GUI/JASS/vJass: vJass
Leakless: Maybe. It's leaning towards leakless.
Lagless: Depends on how much you've set the amount thrown.
MUI/MPI: MUI
Import Difficulty: Easy
Requirements: NewGen


Picc.png

UPDATE: Fixed a bug where it would select dead units as well.

UPDATE: Fixed a MAJOR bug which made the spell only hit 1 or 0 units.

Spell:

JASS:
scope HammerSpell initializer Init

globals
    private constant integer SpellID = 'AHtc'         //The rawcode of the spell you are using.
    private constant integer DummyID = 'h000'         //The rawcode of the dummy unit.
    private constant integer ExpirID = 'BTLF'         //The Expiration Timer Type. (DO NOT CHANGE)
    private constant string BaseID = "thunderbolt"    //The order string of the base spell.
    private constant integer Units = 25               //Number of added units hit per spell level.
    private constant real Range = 300.00              //Range of the spell
    private constant string Missle = "Abilities\\Spells\\Human\\StormBolt\\StormBoltMissile.mdl" //If you use a different spell model then change this to that.
    private boolean Preloaded = false                 //Checks to see if model is preloaded.
    private location temp_point                       //Temperary Point. (DO NOT CHANGE)
    private group temp_group                          //Temperary Unit Group. (DO NOT CHANGE)
    private group temp_group2                         //Temperary Unit Group. (DO NOT CHANGE)
endglobals

//Do not edit below these lines unless you know what you're doing.//
////////////////////////////////////////////////////////////////////
//                                                                //
//                                                                //
////////////////////////////////////////////////////////////////////
//Do not edit below these lines unless you know what you're doing.//



private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SpellID
endfunction

private function Cond1 takes nothing returns boolean
    return IsUnitAliveBJ(GetEnumUnit()) == true
endfunction

private function Cond2 takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true
endfunction

private function UGConds takes nothing returns boolean
    return GetBooleanAnd( Cond1(), Cond2() )
endfunction

private function UGActions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, DummyID, GetOwningPlayer(GetTriggerUnit()), temp_point, bj_UNIT_FACING )
    call IssueTargetOrder( GetLastCreatedUnit(), BaseID, GetEnumUnit() )
    call UnitApplyTimedLife(GetLastCreatedUnit(), ExpirID, 0.50)
endfunction


private function Actions takes nothing returns nothing
    if (Preloaded == false) then
        call DestroyEffect (AddSpecialEffect (Missle, 0, 0))
        set Preloaded = true
    endif
    set temp_point = GetUnitLoc(GetTriggerUnit())
    set temp_group = GetUnitsInRangeOfLocMatching(( Range * I2R(GetUnitAbilityLevel(GetTriggerUnit(), SpellID)) ), temp_point, Condition(function Cond2))
    set temp_group2 = GetRandomSubGroup(( Units * GetUnitAbilityLevel(GetTriggerUnit(),SpellID)), temp_group)
    call ForGroup( temp_group2, function UGActions)
    call RemoveLocation(temp_point)
    call DestroyGroup(temp_group)
    call DestroyGroup(temp_group2)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope


EDIT: Added new map.
EDIT2: Forgot to remove temp_group 2
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
[Negative?]
Seems like a mass storm bolt.


[Positives]
Looks leakless.
 

DrEvil

FCRI Associate!
Reaction score
111
Nice Job

Im not realy a guy for looking at JASS code but , for once i actually understand what all this JASS code does.

" Picks [ 25 X level of spell ] units and sends hammers towards them stuning for 3 seconds. "
 

quraji

zap
Reaction score
144
If you don't want people changing certain variables, put them in a separate globals block. As a side note, I find those "Do not edit below unless you know what you are doing" messages funny. Like some people who actually don't know (jass) are just going to go in and change things all willy-nilly. :p
 

DrEvil

FCRI Associate!
Reaction score
111
Why would you do that ?



I killed all the little f*ckers with a lag avalanche of hammers

14,000 range
35,000 hammers per level


lol took a few seconds to start but then they stunned


And again i say

I like this spell , hope it gets approved Tyman2007
 

Flare

Stops copies me!
Reaction score
662
You're using a number of BJ's unnecessarily (CreateNUnitsAtLoc, UnitApplyTimedLifeBJ, IssueTargetOrderBJ, ForGroupBJ(!), GetUnitAbilityLevelSwapped, GetLastCreatedUnit instead of bj_lastCreatedUnit) and you've got a leak
Code:
GetRandomSubGroup

Also, there's no need for a variable for GetEnumUnit (since you're only using it once anyway), and there's no need to null it since it's a single global

You could handle the preloading in the same trigger (just use a boolean constant to determine whether it's enabled or not), and there's no need to preload the caster/targets (since that probably won't be applicable in the map that's importing the spell). You could really simply the preloading to
JASS:
call DestroyEffect (AddSpecialEffect ("Abilities\\Spells\\Human\\StormBolt\\StormBoltMissile.mdl", 0, 0)) //Store that model file as a constant, so that people will be allowed to use a different projectile model and still allow for preloading
 

DrEvil

FCRI Associate!
Reaction score
111
Yea i just kind of re-read and figured out what he said lol

Im still learning so ive gotta ( trial n error ) some things .

" Like learning to walk , once you learn ( jass ) theres no going back to the old times , e.g. crawling ( gui )
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
JASS:
//Make us all private. We want to be private globals.
globals
    constant integer SpellID = 'AHtc'         //The rawcode of the spell you are using.
    constant integer DummyID = 'h000'         //The rawcode of the dummy unit.
    constant integer ExpirID = 'BTLF'         //The Expiration Timer Type. (DO NOT CHANGE)
    constant string BaseID = "thunderbolt"    //The order string of the dummy spell.
    constant integer Units = 25               //Number of added units hit per spell level.
    constant real Range = 300.00              //Range of the spell per level.
    unit temp_unit                            //Temperary Unit. (DO NOT CHANGE)
    location temp_point                       //Temperary Point. (DO NOT CHANGE)
    group temp_group                          //Temperary Unit Group. (DO NOT CHANGE)
endglobals
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Don't expect a non-cliche or a professional spell because this is really the first vJass spell i've posted.

I'd expect there?
 

Tyman2007

Ya Rly >.
Reaction score
74
Technically yes. Making spells does pay if you work for something like blizzard in making spells.
 

DrEvil

FCRI Associate!
Reaction score
111
Technically yes. Making spells does pay if you work for something like blizzard in making spells.

The ONLY place you would probably ever get paid for making spells on THEIR game .

Well who else will pay you to make spells , not for there own product ( even if you could make it like however )
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top