Spellpack Battle Roar & Deep Wound

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
My first JASS spellpack. Don't expect to see something amazing.. Each spell has only one level.
MUI? - Ofcourse
Leakless - As far as I know yes
Lagless - Yes (not counting the 1st time u cast)



Battle Roar /yeah, it's similar do DotA's Primal Roar/
Rexxar unleashes a terrifying roar, causing a target enemy unit to be stunned and lose 250 hit points. Units that are caught in the Roar's path will be slowed greatly for a short duration.

Screenie: http://img219.imageshack.us/img219/7739/battleroarop4.jpg

Code:
JASS:
 function BRConditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A004'
endfunction

function BRGroupConditions takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false ) and ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function BRActions takes nothing returns nothing
    local unit brcaster = GetTriggerUnit ()
    local location point1 = GetUnitLoc (brcaster)
    local location point2 = PolarProjectionBJ(point1, 150.00, GetUnitFacing(brcaster))
    local location point3 = PolarProjectionBJ(point2, 150.00, GetUnitFacing(brcaster))
    local location point4 = PolarProjectionBJ(point3, 150.00, GetUnitFacing(brcaster))
    local group g1
    local group g2
    local group g3
    local unit p
    local location pl
    local unit d
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl", point1))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl", point2))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl", point3))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl", point4))
    call TerrainDeformationWaveBJ( 0.5, point1, point4, 160.00, 90, 0 )
    set g1 = GetUnitsInRangeOfLocMatching(175.00, point2, Condition( function BRGroupConditions) )
        loop
            set p = FirstOfGroup(g1)
            exitwhen p == null
            set pl = GetUnitLoc(p)
            set d = CreateUnitAtLoc(GetOwningPlayer (brcaster), 'hfoo', pl, 270)
            call UnitAddAbility(d, 'A002')
            call IssueTargetOrder( d, "slow", p )
            call UnitApplyTimedLife(d, 'BTLF', 2.00)
            if GetUnitAbilityLevel(p, 'B001') > 0 then
                call KillUnit (p)
            endif
            call GroupRemoveUnit(g1, p)
            call RemoveLocation (pl)
        endloop
    call DestroyGroup (g1)
    set g2 = GetUnitsInRangeOfLocMatching(150.00, point3, Condition( function BRGroupConditions) )
        loop
            set p = FirstOfGroup(g2)
            exitwhen p == null
            set d = CreateUnitAtLoc(GetOwningPlayer (brcaster), 'hfoo', pl, 270)
            call UnitAddAbility(d, 'A002')
            call IssueTargetOrder( d, "slow", p )
            call UnitApplyTimedLife(d, 'BTLF', 2.00)
            if GetUnitAbilityLevel(p, 'B001') > 0 then
                call KillUnit (p)
            endif
            call GroupRemoveUnit(g2, p)
        endloop    
    call DestroyGroup (g2)
    set g3 = GetUnitsInRangeOfLocMatching(150.00, point4, Condition( function BRGroupConditions) )
        loop
            set p = FirstOfGroup(g3)
            exitwhen p == null
            set d = CreateUnitAtLoc(GetOwningPlayer (brcaster), 'hfoo', pl, 270)
            call UnitAddAbility(d, 'A002')
            call IssueTargetOrder( d, "slow", p )
            call UnitApplyTimedLife(d, 'BTLF', 2.00)
            if GetUnitAbilityLevel(p, 'B001') > 0 then
                call KillUnit (p)
            endif
            call GroupRemoveUnit(g3, p)
        endloop
    call DestroyGroup (g3)
    set brcaster = null
    set point1 = null
    set point2 = null
    set point3 = null
    set point4 = null
    set g1 = null
    set g2 = null
    set g3 = null
    set p = null
    set pl = null
    set d = null
endfunction

//===========================================================================
function InitTrig_Battle_Roar takes nothing returns nothing
    set gg_trg_Battle_Roar = CreateTrigger (  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Battle_Roar, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Battle_Roar, Condition(function BRConditions) )
    call TriggerAddAction( gg_trg_Battle_Roar, function BRActions )
endfunction

-----------------------------------------------
Deep Wound
Rexxar strikes an enemy unit with great power, creating an open wound. The target will take critical damage, losing random number of hit points over 10 seconds. The target cannot cast spells and if it gets affected by Battle Roar's slow it will die.

Screenie: http://img391.imageshack.us/img391/9337/deepwoundsb2.jpg

Code:
JASS:
 function DWConditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction

function DWActions takes nothing returns nothing
    local unit dwcaster = GetTriggerUnit ()
    local unit dwtarget = GetSpellTargetUnit ()
    local location dwtpos
    local real r
    local integer duration = 1
    call SetUnitAnimation (dwcaster, "attack")
    loop
        exitwhen duration > 32
        set dwtpos = GetUnitLoc (dwtarget)
        set r = GetRandomReal(5.00, 10.00)
        if GetUnitState(dwtarget, UNIT_STATE_LIFE) >= 0.406 then
            call DestroyEffect(AddSpecialEffectLoc( "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl", dwtpos ))
            call UnitDamageTarget( dwcaster, dwtarget, r , true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
        endif 
        call RemoveLocation (dwtpos)
        set duration = duration + 1
        call PolledWait (0.10)    
    endloop
    set dwcaster = null
    set dwtarget = null
    set dwtpos = null
endfunction

function InitTrig_Deep_Wound takes nothing returns nothing
    set gg_trg_Deep_Wound = CreateTrigger (  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Deep_Wound, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Deep_Wound, Condition(function DWConditions) )
    call TriggerAddAction( gg_trg_Deep_Wound, function DWActions )
endfunction
 

Attachments

  • [JASS Spellpack] By cr4xzZz.w3x
    73.5 KB · Views: 260

hell_knight

Playing WoW
Reaction score
126
If you want it like DotAs make dummy unit roars, and give them like -90 pitch roll or something play around with it.

Nice spells +rep
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Thanks :) But I don't wanna make it like DotA because 1. I like it this way 2. I don't know how to shove units aside o_O

EDIT: Erm... Is it necessary? Anyway, I made the damage non-magic type.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
GUI ? GUI stands for Graphic User Interface (or sth like that) - the normal triggers. What do you mean?
 

0zaru

Learning vJASS ;)
Reaction score
60
for full damage should be

ATTACK_TYPE_CHAOS and DAMAGE_TYPE_UNIVERSAL the other can be set to null
 

NapaHero

Back from the dead...
Reaction score
43
GUI ? GUI stands for Graphic User Interface (or sth like that) - the normal triggers. What do you mean?

GUI stands for Generic User Interface. I only told you that MAYBE your Battle Roar could be done in GUI.
 

NetherHawk

New Member
Reaction score
26
hey cr4zxxx if wanna know how 2 shove the units aside, look in my other spellpack >.> the many spells 1. Ace taught me the maths there.
we got a long way to go before being full fledged jass-ers =x

off topic@: i see you have stopped gui too haha
 

hell_knight

Playing WoW
Reaction score
126
Booo Im still using GUI -_- , to shove units aside maybe make a loop and set points inbetween the caster and target, and anybody within 150 of those points are "shoved" aside if they are not the target.

Then again I can convert my stuff to JASS and stick locals on every variable and pray to god it works?
 

0zaru

Learning vJASS ;)
Reaction score
60
no hell knight that isn't consider JASS, just GUI Converted. Also most of your functions won't work (Since Pick every unit, if them elses, etc, creates new functions for do those things.)
 

NetherHawk

New Member
Reaction score
26
yea, just converting would be for simple spells that only have how you say er, 1 trigger?

@cr4xzZz you might wanna try loading the skill before use. I think its something like create a unit, add and remove the ability you want to load. I think that would solve the lag. then again i might be wrong. someone double confirm =D
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Remove the BJs, then it will be easier to point out any mistakes.

>yea, just converting would be for simple spells that only have how you say er, 1 trigger?

Even when as simple as it can be, it probably can still be optimized in JASS. Unless it has like no conditions, function callbacks, no variables, and like just a wait function, that's it..

I'm not sure if there are any GUI functions other than some of the "General" ones that are natives.

>@cr4xzZz you might wanna try loading the skill before use. I think its something like create a unit, add and remove the ability you want to load. I think that would solve the lag. then again i might be wrong. someone double confirm =D

Most lag comes from the spell, it is most likely not the ability loading that is the problem.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> off topic@: i see you have stopped gui too haha
Erm, yeah, I like JASS now xD I'll look at ur spellpack later, 'cuz now I have to go out with friends..

> Remove the BJs, then it will be easier to point out any mistakes.
I don't know how to remove these BJs I left in my code, because JassCraft gives me tons of functions which I can't understand >,< As I said I'm new to JASS and I can have lots of mistakes in my coding.

> Preloading helps remove lag on the first cast. I belive
True, but I don't see any reason to preload... This is just a spell map, not an RPG or AoS, etc.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
You should start using constant functions for raw codes! It makes implementing the spell to another map much more easier.

Note how you should add a prefix.

constant function DeepWound_AbilCode takes nothing returns integer
return 'A003'
endfunction


I would replace "GetUnitState(whichUnit, UNIT_STATE_LIFE) >= 0.406" with "IsUnitType(whichUnit, UNIT_TYPE_DEAD) != true)".

In addition, learn to use natives, which take reals instead of locations. Reals don't leak and you can forget about destroying locations.

"AddSpecialEffectLoc(modelName, where)" can be replaced with "AddSpecialEffect(modelName, x, y)"

Next, if you have an "if/then/else" statement and the "else" part leaves empty, you can remove it.

if (UnitHasBuffBJ(whichUnit, buff) == true) then
call KillUnit(whichUnit)
else
endif


if (UnitHasBuffBJ(whichUnit, buffcode) == true) then
call KillUnit(whichUnit)
endif


By the way, "UnitHasBuffBJ(whichUnit, buffcode)" is a BJ, like the name suggests, and it can be replaced
with "GetUnitAbilityLevel(whichUnit, buffcode) > 0".
 

NetherHawk

New Member
Reaction score
26
nice, i sure learnt form here. but could you explain the use of constant functions?

following your example, if i do GetUnitAbilityLevel, would it be
GetUnitAbilityLevel(whichunit,DeepWound_AbilCode)?
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
I'll fix the code, but what the heck are constant functions? o_O I don't see a point to replace LifeState with IsUnitDead, because they are the same. And that "AddSpecialEffect" X and Y should look like "X(<variable loc>), Y(<variable loc>)", right?
EDIT: And what are natives.. ?
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
if i do GetUnitAbilityLevel, would it be
GetUnitAbilityLevel(whichunit,DeepWound_AbilCode)?

Yes, provided "DeepWound_AbilCode" returns the ability code of 'Deep Wound'.

what the heck are constant functions?

A constant function is like any other function, but you cannot call a non-constant function from it and it's a little bit faster than a regular function (set statement is allowed).

An addition, the "constant" prefix is usually used by spells to return raw data or configuration values. That makes it easier to separate and recognize them from other functions.

I don't see a point to replace LifeState with IsUnitDead, because they are the same.

Yes, they do the same thing.

It's just a personal preference, and I find that typing true or false is faster and less subject to errors than typing 0.406.

Anyway, that's up to you.

And that "AddSpecialEffect" X and Y should look like "X(<variable loc>), Y(<variable loc>)", right?

"call AddSpecialEffect(modelName, GetLocationX(where), GetLocationY(where)"

But, in your case, you can forget about setting the unit's location into a variable and get it's coordinates directly.


"call AddSpecialEffect(modelName, GetUnitX(where), GetUnitY(where)"


what are natives.. ?

Native functions are functions which do not call any additional functions, unlike BJ's.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
I see... thanks andrew +repute I'll fix my code now
EDIT: Each time I try to use constant function JASS Craft shows me a big list of errors <,< And with that GetUnitX, GetUnitY it shows that I can't convert real to location (or something like that). Huh, I got confused :s
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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