Spellpack Bombard, Delayed Water Nova and Sheep Mines!

Vestras

Retired
Reaction score
248
Bombard

Screenshots:



Code:
JASS:
scope Bombard

//Configuration
globals
    private integer SpellID = 'A002'
    // Raw code of the "Bombard" ability
    private integer BombardID = 'h002'
    // Raw code of the "Bombard Dummy" unit
    private integer EndL = 6
    // Number of rockets which would hail down before the big rocket comes
endglobals
// End of configuration
// Do not edit below unless you know what you are doing

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

function BMain takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer i = EndL
    local real x = GetLocationX(GetSpellTargetLoc())
    local real y = GetLocationY(GetSpellTargetLoc())
    local rect r = Rect(x-170*.5,y-170*.5,x+170*.5,y+170*.5)
    local real x2 = GetRandomReal(GetRectMinX(r),GetRectMaxX(r))
    local real y2 = GetRandomReal(GetRectMinY(r),GetRectMaxY(r))
    local integer g = 1
    local unit d
    
    loop
        exitwhen g > i
        set d = CreateUnit(GetOwningPlayer(u),BombardID,x2,y2,GetRandomReal(0.0,360.0))
        call SetUnitFlyHeight(d,0,3000)
        call UnitApplyTimedLife(d,'BTLF',1.48)
        call TriggerSleepAction(0.4)
        set d = null
        set g=g+1
    endloop
    
    set d = CreateUnit(GetOwningPlayer(u),BombardID,x2,y2,GetRandomReal(0.0,360.0))
    call SetUnitFlyHeight(d,0,3000)
    call UnitApplyTimedLife(d, 'BTLF', 1.48)
    call SetUnitScale(d,3,3,3)
    call UnitDamagePoint(d,1.48,170,x2,y2,200,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    call TriggerSleepAction(1.48)
    call RemoveRect(r)
    set r = null
    set g =1
    set r = Rect(x2-170*.5,y2-170*.5,x2+170*.5,y2+170*.5)
    
    loop
        exitwhen g>7
        set x2 = GetRandomReal(GetRectMinX(r),GetRectMaxX(r))
        set y2 = GetRandomReal(GetRectMinY(r),GetRectMaxY(r))
        call DestroyEffect(AddSpecialEffect("war3mapImported\\NewGroundEX.mdx",x2,y2))
        call UnitDamagePoint(u,1.48,170,x2,y2,60,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
        set g = g+1
        call TriggerSleepAction(0)
    endloop
    
    set d = null
    set u = null
    set r = null
endfunction

//===========================================================================
function InitTrig_Bombard takes nothing returns nothing
    call OnAbilityEffect(SpellID, "BMain")
endfunction

endscope


Delayed Water Nova

Screenshots:
waternovauo9.jpg

Code:
JASS:
globals
integer spellId = 'A001'
// The "Delayed Water Nova" ability raw code.
integer dummyId = 'A000'
// The Delayed Water Nova Dummy Ability" raw code.
real waittime = 0.03
// The time that should be waited before the nova is executed.
endglobals

scope DelayedWaterNova

struct WNStruct
unit WNUnit
location WNLoc
location WNTemp
integer WNInt
endstruct

public function WNCond takes nothing returns boolean
return ( GetSpellAbilityId() == spellId )
endfunction

function WNMain takes nothing returns nothing
local WNStruct data = WNStruct.create()
set data.WNUnit= GetTriggerUnit()
set data.WNLoc= GetUnitLoc(data.WNUnit)
call TriggerSleepAction(waittime)
call CasterSetCastSourceLoc(data.WNLoc)
call CasterSetRecycleDelay(4)
set data.WNInt= 1
loop
    exitwhen data.WNInt> 60
    set data.WNTemp= PolarProjectionBJ(data.WNLoc, 30.0, data.WNInt*6)
    call CasterCastAbilityPointLoc( GetOwningPlayer(data.WNUnit), dummyId, "shockwave", data.WNTemp, false)
    call RemoveLocation(data.WNTemp)
    set data.WNInt= data.WNInt+1
    endloop
call RemoveLocation(data.WNLoc)
set data.WNLoc= null
set data.WNTemp= null
set data.WNUnit= null
call data.destroy()
endfunction

endscope

//===========================================================================
function InitTrig_DelayedWaterNova takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
call OnAbilityEffect(spellId, "WNMain")
endfunction


Sheep Mines

Screenshots:
attachment.php

Code:
JASS:
globals
// Configuration
integer SMSpellId = 'A003'
//Raw code of the main ability.
integer SMSheepId = 'h003'
//Raw code of the sheep unit.
integer SMDummyId = 'h001'
//Raw code of the dummy unit.
real SMWait = GetRandomReal(.25,.75)
//Real time waited between the sheeps creation.
real SMDamage = GetUnitAbilityLevel(GetTriggerUnit(), SMSpellId)*5+30
//The damage done when a sheep explodes.
integer SMFlyId = 'A004'
//The Sheep Fly ability.
// End of configuration
endglobals
// Do not edit below unless you know what you are doing

scope SheepMines

function SMConds takes nothing returns boolean
return ( GetSpellAbilityId() == SMSpellId )
endfunction

struct SMStruct
unit u
rect r
location l
location temp
integer int
unit f
endstruct

function SMMain takes nothing returns nothing
local SMStruct dat = SMStruct.create()
set dat.u = GetTriggerUnit()
set dat.l = GetUnitLoc(dat.u)
set dat.r = RectFromCenterSizeBJ(dat.l, 500.0, 500.0)
set dat.int = 1
loop
set dat.temp = GetRandomLocInRect(dat.r)
   exitwhen dat.int>GetRandomInt(10,15)
   set dat.f=CreateUnitAtLoc(GetOwningPlayer(dat.u), SMSheepId, dat.temp, 0.0)
   call AddSpecialEffectTargetUnitBJ( "origin", dat.f, "Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl" )
   call DestroyEffect(GetLastCreatedEffectBJ())
   call UnitApplyTimedLife(dat.f, 'BTLF', GetRandomReal(7.0,14.0))
   set dat.int = dat.int + 1
   set dat.f=null
   call TriggerSleepAction(SMWait)
endloop
call dat.destroy()
endfunction

endscope

//===========================================================================
function InitTrig_SheepMines takes nothing returns nothing
    call OnAbilityEffect(SMSpellId, "SMMain")
endfunction


JASS:
function SDCond takes nothing returns boolean
return GetUnitTypeId (GetDyingUnit ()) == SMSheepId
endfunction

function SDMain takes nothing returns nothing
    local unit u = GetDyingUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local unit d
    call UnitDamagePoint(u, 0, 300.0,x,y, SMDamage,false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    call DestroyEffect (AddSpecialEffect ("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", x, y))
    set d=CreateUnit(GetOwningPlayer(u), SMDummyId, x,y, GetRandomReal(0.0, 360.0))
    call UnitAddAbility(d, SMFlyId)
    call IssuePointOrder(d, "impale", x,y)
    call UnitApplyTimedLife(d, 'BTLF', 2.0)
endfunction

//===========================================================================
function InitTrig_SheepsDies takes nothing returns nothing
    set gg_trg_SheepsDies = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SheepsDies, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_SheepsDies, Condition( function SDCond ) )
    call TriggerAddAction( gg_trg_SheepsDies, function SDMain )
endfunction


Enjoy..

EDIT: Updated.
 

Trollvottel

never aging title
Reaction score
262
also,
local real x = GetLocationX(GetSpellTargetLoc())
local real y = GetLocationY(GetSpellTargetLoc())

GetSpellTargetLoc leaks a point so its 2 leaks in your bombard spell
 

Flare

Stops copies me!
Reaction score
662
Just looked at Sheep Mines code

Code:
    call UnitAddAbility(d, 'A004')

You set 'A004' to a constant, why not use it?

JASS:
function SDCond takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == SMSheepId ) ) then
        return false
    endif
    return true
endfunction


Horrific converted GUI condition :eek:
Change to
JASS:
function SDCond takes nothing returns boolean
return GetUnitTypeId (GetDyingUnit ()) == SMSheepId
endfunction


In SheepDies trigger, you should use XY's instead of location (since you can get the XY of the dying unit without having to clear a leak and null the variable). And, you can use the natives UnitDamagePoint and CreateUnit instead of the BJ's

Also, for your special effect, you can create and destroy it on the same line i.e.

JASS:
//s is just an example string
call DestroyEffect (AddSpecialEffect (s, x, y))


And, yet again, XY coordinates reduce the BJ usage.


Also, you don't need to make 2 triggers in the same way you would in GUI. Just create your second trigger within the InitTrig like so
JASS:
function InitTrig_Melee_Initialization takes nothing returns nothing
    local trigger TestTrig = CreateTrigger ()
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ (TestTrig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition (TestTrig, Condition (function TestCond))
    call TriggerAddAction (TestTrig, function TestActions)
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction
 

Vestras

Retired
Reaction score
248
Just looked at Sheep Mines code

Code:
    call UnitAddAbility(d, 'A004')

You set 'A004' to a constant, why not use it?

JASS:
function SDCond takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == SMSheepId ) ) then
        return false
    endif
    return true
endfunction


Horrific converted GUI condition :eek:
Change to
JASS:
function SDCond takes nothing returns boolean
return GetUnitTypeId (GetDyingUnit ()) == SMSheepId
endfunction


In SheepDies trigger, you should use XY's instead of location (since you can get the XY of the dying unit without having to clear a leak and null the variable). And, you can use the natives UnitDamagePoint and CreateUnit instead of the BJ's

Also, for your special effect, you can create and destroy it on the same line i.e.

JASS:
//s is just an example string
call DestroyEffect (AddSpecialEffect (s, x, y))


And, yet again, XY coordinates reduce the BJ usage.


Also, you don't need to make 2 triggers in the same way you would in GUI. Just create your second trigger within the InitTrig like so
JASS:
function InitTrig_Melee_Initialization takes nothing returns nothing
    local trigger TestTrig = CreateTrigger ()
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ (TestTrig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition (TestTrig, Condition (function TestCond))
    call TriggerAddAction (TestTrig, function TestActions)
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

Okay, updated.

SheepsDies code shortened ALOT.

Will it get approved?
 
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