Spell Shiva's Guard(Artic Blast)vJass

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
[vJass] Shiva's Guard(Artic Blast)

Shiva Guard(Artic Blast)

JASS:

////////////////////////////////////////////////////////////////////////////////////////////
//                      Artic Blast (Shiva Guard) by kingking                             //
//                                    -v 2.2-                                             //
//                    original created by Icefrog, DotA creator                           //
//                                                                                        //
//      How to implement ?                                                                //
//      1) Copy Dummy Slow+Buff and ShivaGuard ability in Object Editor into your map.    //
//      2) Copy Missle Dummy to your map.                                                 //
//      3) Copy this trigger.                                                             //
//      4) Change the rawcode to correct rawcode.                                         //
//                                                                                        //
//      Requires :                                                                        //
//      1) T32                                                                            //
//      2) GTrigger                                                                       //
//      3) DummyCaster                                                                    //
//      4) Recycle                                                                        //
//      5) Jasshelper v0.2.A.9                                                            //
////////////////////////////////////////////////////////////////////////////////////////////
scope ArticBlast

    globals
        private constant integer ABIL_ID = 'A000' //Ability's ID
        private constant integer MISSLE_ID = 'e001'  //Missle Dummy's ID
        private constant integer DUMMY_SLOW_ID = 'A001' //Dummy Slow's ID
        private constant string DUMMY_SLOW_ORDER_ID = "slow" //Dummy Slow's Order String
        private constant integer NUMBER_OF_BEAMS = 36 //No. of beams
        private constant attacktype ATTACK_TYPE = ATTACK_TYPE_MAGIC
        private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_MAGIC
        private constant group enumGroup = CreateGroup() //Leave it here, no touching.
    endglobals
    
    private keyword Data
    
    private constant function Damage takes integer level returns real
        return 200. * level //How much damage will deal to targets?
    endfunction
    
    private constant function Aoe takes integer level returns real
        return 600. + (0. * level) //How large the area is?
    endfunction
    
    private constant function Speed takes integer level returns real
        return 25. + (0. * level) //How fast the beam will slide?
    endfunction
    
    private function FilterUnits takes unit whichUnit, Data whichData returns boolean
        return IsUnitEnemy(whichUnit,whichData.owner) and IsUnitType(whichUnit,UNIT_TYPE_DEAD) == false and IsUnitType(whichUnit,UNIT_TYPE_STRUCTURE) == false
        //How the targets to be picked?
    endfunction
    
    //--------Restricted Area, No more touch, unless you know to edit it.---------\\
    private struct Data
        static real array cos
        static real array sin
        static real radian
        static conditionfunc func
        static Data this
        static unit u
        unit caster
        player owner
        group damagedUnits
        integer tick
        real damage
        real speed
        integer level
        real casterX
        real casterY
        real aoe
        unit array dummies [NUMBER_OF_BEAMS]
        
        private static method effects takes nothing returns boolean
            set Data.u = GetFilterUnit()
            if FilterUnits(Data.u,Data.this) and not IsUnitInGroup(Data.u,Data.this.damagedUnits) then
                call UnitAddAbility(DUMMY,DUMMY_SLOW_ID)
                call IssueTargetOrder(DUMMY,DUMMY_SLOW_ORDER_ID,Data.u)
                call UnitRemoveAbility(DUMMY,DUMMY_SLOW_ID)
                call UnitDamageTarget(Data.this.caster,Data.u,Data.this.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,null)
                call GroupAddUnit(Data.this.damagedUnits,Data.u)
            endif
            return false
        endmethod
        
        private method periodic takes nothing returns nothing
            local integer i = 0
            if this.tick >= T32_Tick then
                set this.casterX = GetUnitX(this.caster)
                set this.casterY = GetUnitY(this.caster)
                set this.aoe = this.aoe + this.speed
                loop
                exitwhen i >= NUMBER_OF_BEAMS
                    call SetUnitX(this.dummies<i>,this.casterX + this.aoe * Data.cos<i>)
                    call SetUnitY(this.dummies<i>,this.casterY + this.aoe * Data.sin<i>)
                    set i = i + 1
                endloop
                set Data.this = this
                call GroupEnumUnitsInRange(enumGroup,this.casterX,this.casterY,this.aoe,Data.func)
            else
                call this.destroy()
                call this.stopPeriodic()
            endif
        endmethod
        
        implement T32x
        
        private static method act takes nothing returns nothing
            local Data this = Data.allocate()
            local integer i = 0
            set this.caster = GetTriggerUnit()
            set this.casterX = GetUnitX(this.caster)
            set this.casterY = GetUnitY(this.caster)
            set this.level = GetUnitAbilityLevel(this.caster,ABIL_ID)
            set this.owner = GetOwningPlayer(this.caster)
            set this.speed = Speed(this.level)
            set this.damage = Damage(this.level)
            set this.aoe = 0.
            set this.tick = T32_Tick + R2I(Aoe(this.level) / this.speed)
            set this.damagedUnits = Group.get()
            loop
            exitwhen i &gt;= NUMBER_OF_BEAMS
                set this.dummies<i> = CreateUnit(Player(15),MISSLE_ID,this.casterX,this.casterY,(Data.radian * i) * 57.2958)
                set i = i + 1
            endloop
            call this.startPeriodic()
        endmethod
        
        private method onDestroy takes nothing returns nothing
            local integer i = 0
            loop
            exitwhen i &gt;= NUMBER_OF_BEAMS
                call KillUnit(this.dummies<i>)
                set this.dummies<i> = null
                set i = i + 1
            endloop
            call Group.release(this.damagedUnits)
        endmethod
        
        private static method onInit takes nothing returns nothing
            local integer i = 0
            set Data.radian = (2 * bj_PI) / NUMBER_OF_BEAMS
            loop
            exitwhen i &gt; NUMBER_OF_BEAMS
                set Data.cos<i> = Cos(Data.radian * i)
                set Data.sin<i> = Sin(Data.radian * i)
                set i = i + 1
            endloop
            call GT_AddStartsEffectAction(function Data.act, ABIL_ID)
            set Data.func = Condition(function Data.effects)
        endmethod
    endstruct
    // -Spell end-
endscope
</i></i></i></i></i></i></i></i></i>


71455380.jpg
 

Attachments

  • Shiva's Guard.w3x
    75.2 KB · Views: 361

Kenny

Back for now.
Reaction score
202
JASS:
//      Requires :                                                                         //
//      1) HVAS v5x5                                                                       //
//      2) XY snippet                                                                      //


1) Whats that?
2) You should be inlining those functions yourself.

JASS:
unit array dummies [37]


37 should be a constant global.

JASS:
static method generate takes nothing returns Data
    return Data.allocate()
endmethod


?!?! Just use the normal create method?

JASS:
set g = CreateGroup()


Should be using a global group.

JASS:
call TimerStart(NewStructTimer(a),.03125,true,function Move)


Interval should be global constant.

JASS:
exitwhen i &gt; 36


That should be configurable as well.

JASS:
private function Init takes nothing returns nothing
    call TriggerAnyUnitEvent(EVENT_PLAYER_UNIT_SPELL_CAST,Condition(function Cond),function Act)
endfunction


Whats that? Does this require another library. If it does, you should convert it to use GTrigger from thehelper's systems section.
 

wraithseeker

Tired.
Reaction score
122
HVAS is the one you made? If you still have that requirement then this will go to graveyard fast ATM.

Why are you using SetUnitPosition for the projectiles?

Use GetWidgetLife and not GetUnitState as it's faster.

Like kenny! said, I don't know what are you thinking with the extra function calls of generates.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
>>Whats that?
My system make the spell easier and timer attaching system. Feel free to change it if you want. Just a demo here for the spell.
>>37 should be a constant global.
Does it affect the whole spell?
>>Should be using a global group
If I do so, it becomes unfully MUI.
>>Interval should be global constant.
>>That should be configurable as well.
I think this value is healthy and bad to change it.
Whats that? Does this require another library. If it does, you should convert it to use GTrigger from thehelper's systems section.
A feature of HVAS v5x5.It does same function as GTrigger. I think multiple system will cause some map creators scratch their head, so I use the one in HVAS v5x5.


If you want ABC version, feel free to reply at here, I will make it. :D
 

Kenny

Back for now.
Reaction score
202
> My system make the spell easier and timer attaching system. Feel free to change it if you want. Just a demo here for the spell.

Has it been approved here or on any other site? If not, it is useless to us. Anyway, there are much more efficient systems that you can use. You should be using a struct array loop anyway, as this spell is shit easy and is optimal for that type of "attachment".

> Does it affect the whole spell?

To me, and other who like to see decent work, yes it does.

> If I do so, it becomes unfully MUI.

Groups that are enumerated instantly are still fine MUI-wise. Anyway, if I'm wrong about this, just make this spell use a struct array loop, then make it global and be done with it.

> I think this value is healthy and bad to change it.

That value may lag for some, and others may not like it. I for one like to use 0.04 for most things, as that is 25 FPS, anything more than that, and it is un-detectable by the human eye.

> A feature of HVAS v5x5.It does same function as GTrigger. I think multiple system will cause some map creators scratch their head, so I use the one in HVAS v5x5.

So what your saying is you ripped of GTrigger? Anyway, just make this use a struct array loop, and GTrigger, and fix up the things that have been pointed out, the spell will be better because of it. Oh and i doubt it does the same as GTrigger.
 

BlackRose

Forum User
Reaction score
239
Screenshot please! Lemme test it now.....

- WTF? The food used keeps going up by 1 continuously after the spell ends.
- Why does it damage enemies AFTER the wave ends.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
>>WTF? The food used keeps going up by 1 continuously after the spell ends.
It is time. :D

- Why does it damage enemies AFTER the wave ends.
There are some delay for Frost Nova.
 

BlackRose

Forum User
Reaction score
239
JASS:
    loop
    exitwhen i &gt; 36
        set a.dummies<i> = CreateUnit(a.p,slideDummyId,OffsetX(a.X,0.,10.*i),OffsetY(a.Y,0.,10.*i),10*i)
        set i = i + 1
    endloop</i>

Number of beams configurable?
JASS:
call TimerStart(NewStructTimer(a),.03125,true,function Move)
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Number of beams configurable?
Good idea.
This too
Will make it.
distance travelled
Change it at the AoE.

The new version is available.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
You just like, ignored [del]all[/del] most of kenny!'s comments.
A screenshot would be nice;
But fix all the things kenny! said.
 

Viikuna

No Marlo no game.
Reaction score
265
JASS:
set u = CreateUnit(a.p,CasterDummyId,GetUnitX(temp),GetUnitY(temp),0.)



omg.. Dont create dummies like that. Use one global dummy to cast all those frostnovas. And use nova only for slowing, damage must come from casting hero, otherwise it sucks. ( Your hero doesnt get credit for kill, etc. )

And there is loads of other things needing for optimization too. Ill point them out for you if I got time later.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
set u = CreateUnit(a.p,CasterDummyId,GetUnitX(temp),GetUnitY(temp),0.)



omg.. Dont create dummies like that. Use one global dummy to cast all those frostnovas. And use nova only for slowing, damage must come from casting hero, otherwise it sucks. ( Your hero doesnt get credit for kill, etc. )

And there is loads of other things needing for optimization too. Ill point them out for you if I got time later.

Is it possible to make a dummy to cast all nova to units? I tested but it seems not working....
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
EDIT : It works now. I changed some settings on the dummy caster. Thanks a lot. :D
 

emjlr3

Change can be a good thing
Reaction score
395
just from what I can see through the script posted in the thread topic post:

JASS:
static method generate takes nothing returns Data
        return Data.allocate()
    endmethod


really??
just do a Data.create() and call it a day...

not need to null your trigger, and why SPELL_CAST? its buggable

please use a timer stack, creation of timers is sooo two years ago (same with group stack)

shouldnt things like AoE, speed, NumberOfBeam and such be levelable?

if you started your dummmies array at 0 you could set it with NumberofBeam instead of limiting it to 72 (though it is a large number)

you dont state by using a large number (such as 72) you limit the max simultanoeus casts to 113 :), inflated, I know

SetUnitX/Y is faster then SetUnitPosition

no need to loop through your group, do everything in the enum function (pass your struct over)

just a hunch, but your caster dummy shouldn't work if casting twice in the same timer callback

you enuming through all units in a large circle each go, just grab the ones near each dummy
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
just do a Data.create() and call it a day...
Will change it since many replies request me to do so.
not need to null your trigger, and why SPELL_CAST? its buggable
Is it? I didn't heart about this. Nevermind, I change it to SPELL_EFFECT
please use a timer stack, creation of timers is sooo two years ago (same with group stack)
Will use it.
SetUnitX/Y is faster then SetUnitPosition
I tried to use SetUnitX/Y but it does not work magically. lol!
no need to loop through your group, do everything in the enum function (pass your struct over)
I heard loop is faster and better than ForGroup...
 

Azlier

Old World Ghost
Reaction score
461
FirstOfGroup and filter usage are about the same in speed (the filter being a bit faster), when you use no real filter when using FirstOfGroup. What you have right now is slower and more unreadable than just using the filter.

No, not ForGroup. Filter.
 
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