Spell Death Nova

D.V.D

Make a wish
Reaction score
73
I already told you why atype and dtype. The spell effect has been done and the return. I just didn't show it because I did it after I showed you the code that doesn't work. I nulled the struct variables just in case. I'll change everything i missed and to make you happy, I'll show you what it look like but alteast help me with those globals problems. The timer needs to be a global so it would work together without leaking a timer. And please read all my posts before postig because I don't want to repeat myself.
 

Romek

Super Moderator
Reaction score
963
> I already told you why atype and dtype.
I have an amazing plan: How about you make them configurable.
Thus, they are useless struct members.
 
Reaction score
341
I can't beleive how many times I (as well as others) have told you this...

JASS:
private function Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == ID ) ) then
        return false
    endif
    return true
endfunction


CHANGE TO!

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


Also, don't use polledwaits, they are no better than TSA's, in fact polledwait uses TSA's

People are beginning to repeat what others have said now.
To be frank, the code is a mess, and you don't seem to understand some basic things that apply to making spells in Jass. I suggest you learn [v]Jass properly, before submitting more spells, it'd benefit the community, as well as yourself.

QTF. I used to be the same way, submitting every little thing I made, now that I look back, just want to burn all of it.
 

D.V.D

Make a wish
Reaction score
73
Read the post above.

Edit: t is now a struct member. The globals radius, distance,amount still are messed. Cannot be assinged to DeathNova(main actions). Here's the code up to now:
JASS:
scope DeathNova initializer InitTrig

////////////////////////////////////////////////////////////////////////////////////////
//   Variables:                                                                       //
// 1.atype = AttackType of the damage                                                 //
// 2.dtype = DamageType of the damage                                                 //
// 3.damage = Damage done                                                             //
// 4.X = X of the middle of the nova                                                  //
// 5.Y = Y of the middle of the nova                                                  //
// 6.model = The model name when using CreateNovaDamageAllEffect()                    //
// 7.caster = The Casting Unit of the spell                                           //
////////////////////////////////////////////////////////////////////////////////////////
//   Methods:                                                                         //
// 1.OnDestroy = Nulls everything in the struct and sets it to 0                      //
// 2.CreateNovaDamageEffectAll() = Creates a nova that uses Special Effects and       //
// damages all the units even allies and yours.                                       //
// 3.CreateNovaDamageAllUnit() = Creates a nova made from units that damages all      //
// units including yours and allies.                                                  //
////////////////////////////////////////////////////////////////////////////////////////

globals
private constant integer endLoop = 10//This is the amount of times the novas will be made
private constant integer ID = 'AHtc'//This is the raw code for your ability
private constant real amount = 20.00//This variable indicates the amount of effects amde in one nova. CANNOT BE A DECIAML NUMBER!
private constant real distance = 100.00//This variable sets the distance the nova's are created from the x and y of your choice
private constant real radius = 50.00//This variable indicates the radius of the damage. Radius increases by 10 for all nova's made each time.
private constant real Time = 0.10//This is the time between the next nova is created
private constant timer t = CreateTimer()
endglobals

public struct nova
attacktype atype
damagetype dtype
real damage
real X
real Y
string model
timer t
unit caster

method onDestroy takes nothing returns nothing
    set .X = 0.00
    set .Y = 0.00
    set .caster = null
endmethod

method CreateNovaDamageAllEffect takes nothing returns nothing
    local real angle = 0
    local real intervals = 360 / amount
    local real x
    local real y
    local effect f
      loop
         exitwhen angle > 360
         set x = .X + distance * Cos(angle * bj_DEGTORAD)
         set y = .Y + distance * Sin(angle * bj_DEGTORAD)
         set f = AddSpecialEffect(.model, x, y)
         call UnitDamagePoint(.caster, 0.00, radius, x, y, .damage, true, false, .atype, .dtype, WEAPON_TYPE_WHOKNOWS)
         set angle = angle + intervals
      endloop
      call DestroyEffect(f)
      set f = null
endmethod

////////////////////////////////////////////////////////////////////////////////////////////////
endstruct
////////////////////////////////////////////////////////////////////////////////////////////////

private function DeathNova takes nothing returns nothing
    local nova d = nova.create()
    local integer beginloop = 0
      call PauseTimer(d.t)
      call DestroyTimer(d.t)
      set d.t = CreateTimer()
      set d.caster = GetTriggerUnit()
      set d.X = GetUnitX(d.caster)
      set d.Y = GetUnitY(d.caster)
      set d.model = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
      set d.damage = GetUnitAbilityLevel(d.caster,'AHtc') * 10
      set d.atype = ATTACK_TYPE_MAGIC
      set d.dtype = DAMAGE_TYPE_NORMAL
      if (beginloop != endLoop) then
         set amount = amount + 5.00
         set distance = distance + 100.00
         set radius = radius + 10.00
         set beginloop = beginloop + 1
           call d.CreateNovaDamageAllEffect()
           call TimerStart(d.t, Time, false, function DeathNova)
           call d.destroy ()
      endif
endfunction

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

//===========================================================================
private function InitTrig takes nothing returns nothing
    local trigger e = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( e, EVENT_PLAYER_UNIT_SPELL_EFFECT )  
    call TriggerAddAction(e, function DeathNova )
endfunction

endscope
 
Reaction score
341
JASS:
set d.model = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"


Change into a global, no need to store the effect each time, that will also make it configurable.

JASS:
         set amount = amount + 5.00
         set distance = distance + 100.00
         set radius = radius + 10.00


You cannot change constant values, hence the word constant.
 

D.V.D

Make a wish
Reaction score
73
So I change it into private integer amount = 20? Ill make the effect a configurable but, Im not removing the model from the struct.

EDIT: Basically, I changed the globals. Now here's the proble. First time you cast the ability, first nova is made in the right location, all the others are made in Centre of Playable map area. Next time you cast it nothing happens because the map keeps getting laggier and laggier till it crashes so I guess the loop never ends. here's the code:
JASS:
scope DeathNova initializer InitTrig

////////////////////////////////////////////////////////////////////////////////////////
//   Variables:                                                                       //
// 1.atype = AttackType of the damage                                                 //
// 2.dtype = DamageType of the damage                                                 //
// 3.damage = Damage done                                                             //
// 4.X = X of the middle of the nova                                                  //
// 5.Y = Y of the middle of the nova                                                  //
// 6.model = The model name when using CreateNovaDamageAllEffect()                    //
// 7.caster = The Casting Unit of the spell                                           //
////////////////////////////////////////////////////////////////////////////////////////
//   Methods:                                                                         //
// 1.OnDestroy = Nulls everything in the struct and sets it to 0                      //
// 2.CreateNovaDamageEffectAll() = Creates a nova that uses Special Effects and       //
// damages all the units even allies and yours.                                       //
// 3.CreateNovaDamageAllUnit() = Creates a nova made from units that damages all      //
// units including yours and allies.                                                  //
////////////////////////////////////////////////////////////////////////////////////////

globals
private constant integer endLoop = 10//This is the amount of times the novas will be made
private constant integer ID = 'AHtc'//This is the raw code for your ability
private real amount = 20.00//This variable indicates the amount of effects amde in one nova. CANNOT BE A DECIAML NUMBER!
private real distance = 100.00//This variable sets the distance the nova's are created from the x and y of your choice
private real radius = 50.00//This variable indicates the radius of the damage. Radius increases by 10 for all nova's made each time.
private constant real Time = 0.10//This is the time between the next nova is created
private constant string Effect = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
endglobals

public struct nova
attacktype atype
damagetype dtype
real damage
real X
real Y
string model
timer t
unit caster

method onDestroy takes nothing returns nothing
    set .X = 0.00
    set .Y = 0.00
    set .caster = null
endmethod

method CreateNovaDamageAllEffect takes nothing returns nothing
    local real angle = 0
    local real intervals = 360 / amount
    local real x
    local real y
    local effect f
      loop
         exitwhen angle > 360
         set x = .X + distance * Cos(angle * bj_DEGTORAD)
         set y = .Y + distance * Sin(angle * bj_DEGTORAD)
         set f = AddSpecialEffect(.model, x, y)
         call UnitDamagePoint(.caster, 0.00, radius, x, y, .damage, true, false, .atype, .dtype, WEAPON_TYPE_WHOKNOWS)
         set angle = angle + intervals
      endloop
      call DestroyEffect(f)
      set f = null
endmethod

////////////////////////////////////////////////////////////////////////////////////////////////
endstruct
////////////////////////////////////////////////////////////////////////////////////////////////

private function DeathNova takes nothing returns nothing
    local nova d = nova.create()
    local integer beginloop = 0
      call PauseTimer(d.t)
      call DestroyTimer(d.t)
      set d.t = CreateTimer()
      set d.caster = GetTriggerUnit()
      set d.X = GetUnitX(d.caster)
      set d.Y = GetUnitY(d.caster)
      set d.model = Effect
      set d.damage = GetUnitAbilityLevel(d.caster,'AHtc') * 10
      set d.atype = ATTACK_TYPE_MAGIC
      set d.dtype = DAMAGE_TYPE_NORMAL
      if (beginloop != endLoop) then
         set amount = amount + 5.00
         set distance = distance + 100.00
         set radius = radius + 10.00
         set beginloop = beginloop + 1
           call d.CreateNovaDamageAllEffect()
           call TimerStart(d.t, Time, false, function DeathNova)
           call d.destroy ()
      endif
endfunction

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

//===========================================================================
private function InitTrig takes nothing returns nothing
    local trigger e = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( e, EVENT_PLAYER_UNIT_SPELL_EFFECT )  
    call TriggerAddAction(e, function DeathNova )
endfunction

endscope
 

Romek

Super Moderator
Reaction score
963
Would you mind reading, and re-reading the rest of my post until you get it?

It does annoy me when I post all that stuff there, and you completely ignore it. (Just like the amount of people who told you to fix the condition until you actually did it)
 
Reaction score
341
So I change it into private integer amount = 20? Ill make the effect a configurable but, Im not removing the model from the struct.

any good reason for that?

Before you start posting vJASS resources, read this, until you understand what your doing.

Once done, practice alot.

As of now, it looks like you have no idea what your doing.

The least you could do is listen to peoples suggestions.
 

D.V.D

Make a wish
Reaction score
73
Read my edit above your post. I did what people said. And I changed the things the way the people told me and now, my code works so badly, that your map will crash.
 

Flare

Stops copies me!
Reaction score
662
Hmm, I can't see this thread going anywhere - if people don't have anything new to contribute or don't want to point out anything that had been overlooked, why do you even bother replying? Re-iterating the same stuff over and over is only going to get you so far ¬_¬ The condition has been mentioned 5 times.
If D.V.D doesn't want to take heed of the suggestions for improvement, he doesn't have to and, as such, I'm sure you can all guess what should (or, has already, in this case) happen to the resource.

JASS:
      call PauseTimer(d.t)
      call DestroyTimer(d.t)

The timer shouldn't even exist when you call those - move those to your onDestroy method.

Your d.destroy () call should be at the end i.e. after the whole if block, not just at the end of the if. The reason why your second, third, fourth (etc) novas are being created at the center of the map is because you are destroying the struct after the first loop iteration, which is setting everything to 0, so your projections are ending up as '0 + Cos (angle) * offset' which would put you fairly close to the center of the map :p

JASS:
call TimerStart(d.t, Time, false, function DeathNova)

Until you understand timers a bit more, I suggest that you stick to TriggerSleepAction or PolledWait - honestly, TriggerSleepAction's inaccuracy is much better than what you are doing right now. Once the spell is cast, it starts the timer to call the spell action function in 0.1 seconds. So, every 0.1s, the timer starts again, repeating the same function. Quite a vicious cycle, especially considering you are creating special effects
 

Steamsteam

New Member
Reaction score
1
i downloaded this map and this is a pretty sick spell.. way to week .. was hoping for like instant kills :p
 

D.V.D

Make a wish
Reaction score
73
You can change the damage,effect,etc. Im probably going to change it so its not in the graveyard.
 

Azlier

Old World Ghost
Reaction score
461
>You can change...
Not easily. This is why we have constants.
 

Jesus4Lyf

Good Idea™
Reaction score
397

D.V.D

Make a wish
Reaction score
73
Somewhere in the other posts, they told me to remove that condition line and it still works. Gonna change the wait.
 

Jesus4Lyf

Good Idea™
Reaction score
397

D.V.D

Make a wish
Reaction score
73
Updated code with the condition and reduced the lines of the condition.

I didn't do the condition thing cause when I posted in Jass Help, someone told me to remove it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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