Spell Malicious Spawn (w/ custom model)

Hatebreeder

So many apples
Reaction score
381
Hey again,
I was bored, so I started to create a Spell and to model. I created a Model for the Spell, so it has something appealing about it.
Anyways, this is the Model I made:
Burning Coil
Model Viewer Screenshot:
BurningCoilArt.jpg

In-Game Screen Shot:
BurningCoildAction.jpg


NOTE: I changed the animation of the Coil a bit... I hope you like it =)

And here, the Spell for the Model:
Malicious Spawn
JASS / vJASS: vJASS
import difficulty: easy
MUI / MPI / Non-MUI: MUI
Jesp? Guess so
Requires: Jass New Gen Pack; TT (Timer Ticker) by Cohadar

Describtion: Creates a burning coil, that jumps from unit to unit. Heals friendly units and Damages enemies.

Now, to the Code:
JASS:
scope MaliciousSpawn initializer Init
//===============================================================================
//===                     M A L I C I O U S  S P A W N                        ===
//===                      B Y  H A T E B R E E D E R                         ===
//===============================================================================
//===    To Check raw-codes, open Object manager and press Control + D        ===
//===============================================================================
//===               Have fun with the Spell & The Model                       ===
//===============================================================================

    globals
        private constant integer ID = 'A000' //Raw Code of the Spell
        private constant integer DUMMY = 'u001' // Dummy ID
        private constant integer JUMPS = 8 // How often it should jump
        private constant real AOE = 325. // determines the AOE, of targeting the next Unit
        private constant real SPEED = 12. // Speed of the Missle
        private constant string SFX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl" // Damage/Heal SFX
        private constant string ATTACHMENT = "origin" // SFX attachmentpoint
    //===========================================
        private constant group GROUP = CreateGroup()
    endglobals
        
        private constant function Damage takes integer Level returns real
            return (75. * Level) / JUMPS //Max Damage of the Spell
        endfunction
        
        private constant function Heal takes real Dam, integer Level returns real
            return (Dam * (0.2 * Level)) //Healing of the Spell
        endfunction
//==================================================================================
//================== Do not Edit below, unless you know what you are doing =========
//==================================================================================

        private struct Spawn
            unit Caster
            unit Dummy
            unit Target
            integer Count = JUMPS
        endstruct

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

private function Group_Filter takes nothing returns boolean
    return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction

private function Timer takes nothing returns boolean
    local Spawn Data = TT_GetData()
    local real DummyX = GetUnitX(Data.Dummy)
    local real DummyY = GetUnitY(Data.Dummy)
    local real TargetX = GetUnitX(Data.Target)
    local real TargetY = GetUnitY(Data.Target)
    local real Angle = bj_RADTODEG * Atan2(TargetY - DummyY,TargetX - DummyX)
    local real X = DummyX + SPEED * Cos(Angle * bj_DEGTORAD)
    local real Y = DummyY + SPEED * Sin(Angle * bj_DEGTORAD)
    local real DX
    local real DY
    local real Dist
    local unit P
    local unit D
    
    call SetUnitXY(Data.Dummy,X,Y)
    call SetUnitFacing(Data.Dummy,Angle)
    set DX = TargetX - X
    set DY = TargetY - Y
    set Dist = SquareRoot(DX * DX + DY * DY)

        if Dist <= SPEED then

            set Data.Count = Data.Count - 1
        
                if IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == true then
                    call UnitDamageTarget(Data.Caster,Data.Target,Damage(GetUnitAbilityLevel(Data.Caster,ID)),false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
                elseif IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == false then
                    call SetUnitState(Data.Target,UNIT_STATE_LIFE,GetUnitState(Data.Target,UNIT_STATE_LIFE) + Heal(Damage(GetUnitAbilityLevel(Data.Caster,ID)),GetUnitAbilityLevel(Data.Caster,ID)))
                endif

            call DestroyEffect(AddSpecialEffectTarget(SFX,Data.Target,ATTACHMENT))
            call GroupEnumUnitsInRange(GROUP,X,Y,AOE,Condition(function Group_Filter))
            
            set D = Data.Target
            set Data.Target = null
            
                loop
                    set P = FirstOfGroup(GROUP)
                        exitwhen P == null
                            if P != D then
                                set Data.Target = P
                            endif
                            call GroupRemoveUnit(GROUP,P)
                endloop
                
            set P = null
            set D = null
            
                if Data.Count <= 0 or Data.Target == null then
                    call KillUnit(Data.Dummy)
                        call Data.destroy()
                            return true
                endif
                
        endif
return false
endfunction

private function Actions takes nothing returns nothing
    local Spawn Data = Spawn.create()
    local real CasterX
    local real CasterY
    local real TargetX
    local real TargetY
    local real X
    local real Y
    local real Angle
    
    set Data.Caster = GetTriggerUnit()
    set Data.Target = GetSpellTargetUnit()

    set CasterX = GetUnitX(Data.Caster)
    set CasterY = GetUnitY(Data.Caster)
    set TargetX = GetUnitX(Data.Target)
    set TargetY = GetUnitY(Data.Target)
    set Angle = bj_RADTODEG * Atan2(TargetY - CasterY,TargetX - CasterX)
    set X = CasterX + 100 * Cos(Angle * bj_DEGTORAD)
    set Y = CasterY + 100 * Sin(Angle * bj_DEGTORAD)

    set Data.Dummy = CreateUnit(GetOwningPlayer(Data.Caster),DUMMY,X,Y,Angle)
    
    call TT_Start(function Timer,Data)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger Trig = CreateTrigger(  )
    
    call Preload(SFX)
    
    call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( Trig, Condition( function Conditions ) )
    call TriggerAddAction( Trig, function Actions )
    set Trig = null
endfunction
endscope


Please tell me of what you think about this =)
 

Attachments

  • BurningCoil.zip
    5 KB · Views: 225
  • Spells And Models - Malicious Spawn.w3x
    45.7 KB · Views: 261

Flare

Stops copies me!
Reaction score
662
Haven't looked through the code in great detail, but:
JASS:
    set Angle = bj_RADTODEG * Atan2(TargetY - CasterY,TargetX - CasterX)
    set X = CasterX + 100 * Cos(Angle * bj_DEGTORAD)
    set Y = CasterY + 100 * Sin(Angle * bj_DEGTORAD)

Why not remove the RADTODEG/DEGTORAD conversions? End result will be exactly the same :p

And you could handle the group actions within the GroupEnum filter i.e.
JASS:
globals
  private Spawn gdata //Declare this below the struct
endglobals

function GroupFilter takes nothing returns boolean
  local unit u = GetFilterUnit ()
if (blablabla) then
call DoSomeStuffWith (gdata)
endif
return false
endfunction

...
set gdata = Data
call GroupEnumUnitsInRange (whichGroup, x, y, radius, Condition (function GroupFilter))

And that'll allow you to keep the group empty and keep all the group functionality in one block (rather than having it in 2 places)

Other than that (I'm too lazy right now to actually examine code properly), it looks pretty cool (both model and the spell concept), shame I can't test it atm though :(
 
Reaction score
456
Excuse me, but what did you have in your mind when you wrote this:
JASS:
private function Timer takes nothing returns boolean
    local Spawn Data = TT_GetData()
    local real DummyX = GetUnitX(Data.Dummy)
    local real DummyY = GetUnitY(Data.Dummy)
    local real TargetX = GetUnitX(Data.Target)
    local real TargetY = GetUnitY(Data.Target)
    local real Angle = bj_RADTODEG * Atan2(TargetY - DummyY,TargetX - DummyX)
    local real X = DummyX + SPEED * Cos(Angle * bj_DEGTORAD)
    local real Y = DummyY + SPEED * Sin(Angle * bj_DEGTORAD)
    local real DX
    local real DY
    local real Dist
    local unit P
    local unit D
    
    call SetUnitXY(Data.Dummy,X,Y)
    call SetUnitFacing(Data.Dummy,Angle)
    set DX = TargetX - X
    set DY = TargetY - Y
    set Dist = SquareRoot(DX * DX + DY * DY)

        if Dist <= SPEED then

            set Data.Count = Data.Count - 1
        
                if IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == true then
                    call UnitDamageTarget(Data.Caster,Data.Target,Damage(GetUnitAbilityLevel(Data.Caster,ID)),false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
                elseif IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == false then
                    call SetUnitState(Data.Target,UNIT_STATE_LIFE,GetUnitState(Data.Target,UNIT_STATE_LIFE) + Heal(Damage(GetUnitAbilityLevel(Data.Caster,ID)),GetUnitAbilityLevel(Data.Caster,ID)))
                endif

            call DestroyEffect(AddSpecialEffectTarget(SFX,Data.Target,ATTACHMENT))
            call GroupEnumUnitsInRange(GROUP,X,Y,AOE,Condition(function Group_Filter))
            
            set D = Data.Target
            set Data.Target = null
            
                loop
                    set P = FirstOfGroup(GROUP)
                        exitwhen P == null
                            if P != D then
                                set Data.Target = P
                            endif
                            call GroupRemoveUnit(GROUP,P)
                endloop
                
            set P = null
            set D = null
            
                if Data.Count <= 0 or Data.Target == null then
                    call KillUnit(Data.Dummy)
                        call Data.destroy()
                            return true
                endif
                
        endif
return false
endfunction

I cleaned it up for you:
JASS:
private function Timer takes nothing returns boolean
    local Spawn Data = TT_GetData()
    local real DummyX = GetUnitX(Data.Dummy)
    local real DummyY = GetUnitY(Data.Dummy)
    local real TargetX = GetUnitX(Data.Target)
    local real TargetY = GetUnitY(Data.Target)
    local real Angle = Atan2(TargetY - DummyY, TargetX - DummyX)
    local real X = DummyX + SPEED * Cos(Angle)
    local real Y = DummyY + SPEED * Sin(Angle)
    local real DX
    local real DY
    local real Dist
    local unit P
    local unit D
    
    call SetUnitXY(Data.Dummy, X, Y)
    call SetUnitFacing(Data.Dummy, Angle)
    set DX = TargetX - X
    set DY = TargetY - Y
    set Dist = SquareRoot(DX * DX + DY * DY)

    if Dist <= SPEED then
        set Data.Count = Data.Count - 1
        
        if IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == true then
            call UnitDamageTarget(Data.Caster,Data.Target,Damage(GetUnitAbilityLevel(Data.Caster,ID)),false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
        elseif IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == false then
            call SetUnitState(Data.Target,UNIT_STATE_LIFE,GetUnitState(Data.Target,UNIT_STATE_LIFE) + Heal(Damage(GetUnitAbilityLevel(Data.Caster,ID)),GetUnitAbilityLevel(Data.Caster,ID)))
        endif

        call DestroyEffect(AddSpecialEffectTarget(SFX,Data.Target,ATTACHMENT))
        call GroupEnumUnitsInRange(GROUP,X,Y,AOE,Condition(function Group_Filter))
            
        set D = Data.Target
        set Data.Target = null
            
        loop
            set P = FirstOfGroup(GROUP)
            exitwhen P == null
            if P != D then
                set Data.Target = P
            endif
            call GroupRemoveUnit(GROUP,P)
        endloop
                
        set P = null
        set D = null
            
        if Data.Count <= 0 or Data.Target == null then
            call KillUnit(Data.Dummy)
            call Data.destroy()
            return true
        endif      
    endif

    return false
endfunction
 

Hatebreeder

So many apples
Reaction score
381
Excuse me, but what did you have in your mind when you wrote this:
JASS:
private function Timer takes nothing returns boolean
    local Spawn Data = TT_GetData()
    local real DummyX = GetUnitX(Data.Dummy)
    local real DummyY = GetUnitY(Data.Dummy)
    local real TargetX = GetUnitX(Data.Target)
    local real TargetY = GetUnitY(Data.Target)
    local real Angle = bj_RADTODEG * Atan2(TargetY - DummyY,TargetX - DummyX)
    local real X = DummyX + SPEED * Cos(Angle * bj_DEGTORAD)
    local real Y = DummyY + SPEED * Sin(Angle * bj_DEGTORAD)
    local real DX
    local real DY
    local real Dist
    local unit P
    local unit D
    
    call SetUnitXY(Data.Dummy,X,Y)
    call SetUnitFacing(Data.Dummy,Angle)
    set DX = TargetX - X
    set DY = TargetY - Y
    set Dist = SquareRoot(DX * DX + DY * DY)

        if Dist <= SPEED then

            set Data.Count = Data.Count - 1
        
                if IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == true then
                    call UnitDamageTarget(Data.Caster,Data.Target,Damage(GetUnitAbilityLevel(Data.Caster,ID)),false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
                elseif IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == false then
                    call SetUnitState(Data.Target,UNIT_STATE_LIFE,GetUnitState(Data.Target,UNIT_STATE_LIFE) + Heal(Damage(GetUnitAbilityLevel(Data.Caster,ID)),GetUnitAbilityLevel(Data.Caster,ID)))
                endif

            call DestroyEffect(AddSpecialEffectTarget(SFX,Data.Target,ATTACHMENT))
            call GroupEnumUnitsInRange(GROUP,X,Y,AOE,Condition(function Group_Filter))
            
            set D = Data.Target
            set Data.Target = null
            
                loop
                    set P = FirstOfGroup(GROUP)
                        exitwhen P == null
                            if P != D then
                                set Data.Target = P
                            endif
                            call GroupRemoveUnit(GROUP,P)
                endloop
                
            set P = null
            set D = null
            
                if Data.Count <= 0 or Data.Target == null then
                    call KillUnit(Data.Dummy)
                        call Data.destroy()
                            return true
                endif
                
        endif
return false
endfunction

I cleaned it up for you:
JASS:
private function Timer takes nothing returns boolean
    local Spawn Data = TT_GetData()
    local real DummyX = GetUnitX(Data.Dummy)
    local real DummyY = GetUnitY(Data.Dummy)
    local real TargetX = GetUnitX(Data.Target)
    local real TargetY = GetUnitY(Data.Target)
    local real Angle = Atan2(TargetY - DummyY, TargetX - DummyX)
    local real X = DummyX + SPEED * Cos(Angle)
    local real Y = DummyY + SPEED * Sin(Angle)
    local real DX
    local real DY
    local real Dist
    local unit P
    local unit D
    
    call SetUnitXY(Data.Dummy, X, Y)
    call SetUnitFacing(Data.Dummy, Angle)
    set DX = TargetX - X
    set DY = TargetY - Y
    set Dist = SquareRoot(DX * DX + DY * DY)

    if Dist <= SPEED then
        set Data.Count = Data.Count - 1
        
        if IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == true then
            call UnitDamageTarget(Data.Caster,Data.Target,Damage(GetUnitAbilityLevel(Data.Caster,ID)),false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
        elseif IsUnitEnemy(Data.Target,GetOwningPlayer(Data.Caster)) == false then
            call SetUnitState(Data.Target,UNIT_STATE_LIFE,GetUnitState(Data.Target,UNIT_STATE_LIFE) + Heal(Damage(GetUnitAbilityLevel(Data.Caster,ID)),GetUnitAbilityLevel(Data.Caster,ID)))
        endif

        call DestroyEffect(AddSpecialEffectTarget(SFX,Data.Target,ATTACHMENT))
        call GroupEnumUnitsInRange(GROUP,X,Y,AOE,Condition(function Group_Filter))
            
        set D = Data.Target
        set Data.Target = null
            
        loop
            set P = FirstOfGroup(GROUP)
            exitwhen P == null
            if P != D then
                set Data.Target = P
            endif
            call GroupRemoveUnit(GROUP,P)
        endloop
                
        set P = null
        set D = null
            
        if Data.Count <= 0 or Data.Target == null then
            call KillUnit(Data.Dummy)
            call Data.destroy()
            return true
        endif      
    endif

    return false
endfunction

Did you just remove the bj_DEGTORAD and RADTODEG thing?
Can I always leave that out?
 

Trollvottel

never aging title
Reaction score
262
if you get a radians value and convert it to degrees just to convert it back to radians to use it in a trigonometrical function it is nonsense ^^.

and

Burning Coil

i didnt see any fire. looks very nice though, i will check the spell later
 

Hatebreeder

So many apples
Reaction score
381
if you get a radians value and convert it to degrees just to convert it back to radians to use it in a trigonometrical function it is nonsense ^^.

and



i didnt see any fire. looks very nice though, i will check the spell later

Look closly =P and check out the Spell =P

@ Uberplayer: There is a small problem with your suggestion... When the Dummy moves, it doesn't change it's facing - It stays as it was when you cast it. But I was able to remove the bj_DEGTORAD and RADTODEG from the Actions function, without it malfunctioning.
 
Reaction score
456
> When the Dummy moves, it doesn't change it's facing
Yeah, sorry. I didn't notice that you use SetUnitFacing function.
 

Hatebreeder

So many apples
Reaction score
381
> When the Dummy moves, it doesn't change it's facing
Yeah, sorry. I didn't notice that you use SetUnitFacing function.

No need to say sorry ^_^

@ Saw, I'll try that =P
EDIT: srry, doesn't work =( I guess I'll have to leave it like it is, no?
 

Tukki

is Skeleton Pirate.
Reaction score
29
JASS:
set Dist = SquareRoot(DX * DX + DY * DY)

    if Dist <= SPEED then

You are using a squareroot which you may remove.

JASS:
set Dist = DX*DX+DY*DY

    if Dist <= SPEED*SPEED then


It sure does look fine! Will test as soon as possible.
 

waaaks!

Zinctified
Reaction score
255
can u add a fiery trail on the model while moving?

anyways, the model is nice and the spell too
 

Hatebreeder

So many apples
Reaction score
381
can u add a fiery trail on the model while moving?

anyways, the model is nice and the spell too

Actually, i find the Model doesn't need a fiery trail, since it has a red glow trail behind it... BUT, I might make one and upload it seperatly
 
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