Spellpack Bombard, Delayed Water Nova and Sheep Mines!

Vestras

Retired
Reaction score
249
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
249
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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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