• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Sun Strike v1.3.0.0

  • Like
Reactions: Jay-B
The ability to look like, on the ability of invoke of DotA.
Creates the effect, and then explodes.
Only now you can configure all the functions.
The code is very easy, even you can understand this!
Use: Vexorian - TimerUtils
Thank Magtheridon96 :)
JASS:
scope SunStike initializer Init
/**********************
 *
 *   Sun Strike
 *   v1.3.0.0
 *   By tRu.Style
 *
 *   - Creates the effect of the point of the used capacity, after some time the effect is removed. 
 *   - Created another effect and all the enemies in the x AoE causes damage.
 *
 *   Requirements:
 *   -------------
 *
 *       TimerUtils v 2.0 - by Vexorian
 *           - http://www.wc3c.net/showthread.php?t=101322
 *
 *   Implementation Instructions
 *   ---------------------------
 *
 *       1. Copy ability Sun Strike
 *       2. Copy trigger SunStrike and TimerUtils
 *       3. Setup variable
 *       4. Now ready
 *
 *   Credits:
 *   --------
 *
 *       - Magtheridon96 (Explained it all to the smallest detail and gave form filling :D)
 *
 **********************/

////////////////////
//     SetUp      //
////////////////////
globals
    //Damage = SSDAMAGE * SS lvl
    private constant integer    SSID        = 'A000' // SS ability ID
    private constant integer    SSDAMAGE    = 50 // Standart dagame on SS
    private constant string     SSBOOMEF    = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" // Destroy SS effect
    private constant string     SSEFFECT    = "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl" // Cast SS effect
    private constant real       SSAOE       = 175. // SS AoE
    private constant real       SSAOEFM     = 225. // SS fog AoE
    private constant real       SSTIMECAST  = 1.70 // SS time to stike
    // AoE info - If gathered change the radius, then do not forget to change it in the ability of the SS
    
    private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL // Attack type damage
    private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_FIRE // Damage type use fire or DAMAGE_TYPE_NORMAL
    
    private constant boolean PRELOAD        = true  // Preload effect, true preload , false dont preload
endglobals
////////////////////
// End  SetUp     //
////////////////////

//Do not touch struct/////
/* */struct SS          //
/* */   unit caster     //
/* */   integer damage  //
/* */   real x          //
/* */   real y          //
/* */   effect ef       //
/* */   fogmodifier fm  //
/* */endstruct          //
//////////////////////////

    function SSBool takes unit u,unit e returns boolean
        return /*
        */ GetWidgetLife(e) > .405 and /* // target is alive
        */ IsUnitEnemy(e,GetOwningPlayer(u)) and /* // target is an enemy of caster
        */ not IsUnitType(e, UNIT_TYPE_STRUCTURE) and /* // target is not a structure
        */ not IsUnitType(e, UNIT_TYPE_MECHANICAL) and /* // target is not mechanic
        */ not IsUnitType(e, UNIT_TYPE_MAGIC_IMMUNE) // targer is not magic immune
    endfunction

    function LocalEffect takes string ef, real x, real y, player pl returns effect
    // this function crate effect for local player aka one player
        local string e = ""
            if (GetLocalPlayer() == pl) then
                set e = ef
            endif
        return AddSpecialEffect(e,x,y)
    endfunction
    
    function SSStike takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local SS data = GetTimerData(t)
        local unit e
        local group g = CreateGroup()
        call DestroyEffect(data.ef)
        call DestroyEffect(AddSpecialEffect(SSBOOMEF,data.x,data.y))
        call GroupEnumUnitsInRange(g,data.x,data.y,SSAOE, null)
        loop 
            set e = FirstOfGroup(g) 
            exitwhen(e == null)
            call GroupRemoveUnit(g,e)
                if SSBool(data.caster,e) then
                    call UnitDamageTarget(data.caster,e,data.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,null)
                endif
        endloop
        call DestroyFogModifier(data.fm)
        call data.destroy()
        call ReleaseTimer(t)
        call DestroyGroup(g)
        set g = null
        set e = null
        set t = null
    endfunction
    
    function SSAct takes nothing returns boolean
        local SS data
            if GetSpellAbilityId() == SSID then
                set data = SS.create()
                set data.caster = GetTriggerUnit()
                set data.damage =  SSDAMAGE * GetUnitAbilityLevel(data.caster,SSID)
                set data.x = GetSpellTargetX()
                set data.y = GetSpellTargetY()
                set data.ef = LocalEffect(SSEFFECT,data.x,data.y,GetTriggerPlayer())
                set data.fm = CreateFogModifierRadius(GetTriggerPlayer(),FOG_OF_WAR_VISIBLE,data.x,data.y,SSAOEFM,true,true)
                call FogModifierStart(data.fm)
                call TimerStart(NewTimerEx(data),SSTIMECAST,false,function SSStike)
            endif
        return false
    endfunction

    function Init takes nothing returns nothing
        local trigger trg = CreateTrigger()
        static if PRELOAD then
            call Preload(SSEFFECT)
            call Preload(SSBOOMEF)
        endif
        call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(trg,Condition(function SSAct))
        set trg = null
    endfunction
endscope

Keywords:
Invoke,sun,stike
Contents

Еще одна карта (Map)

Reviews
15:01, 23rd Jan 2013 Magtheridon96: Approved. I like this. I'm looking past the fact that it's unoriginal. The code is short and sweet. Well done.

Moderator

M

Moderator

15:01, 23rd Jan 2013
Magtheridon96: Approved.
I like this. I'm looking past the fact that it's unoriginal. The code is short and sweet. Well done.
 
why do you add a comment //MyComment after /*?
We have comment blocks since JASS you know?

Review:
1)You dont need lvl as a private type of the struct.You just need damage instead.then get it like
set data.damage = GetUnitAbilityLevel(whichunit,whichability) * whatdamage
2)I think you should give the struct a meaningful name,it sounds like a ship's name for me.
3)You dont need prefixes for a library private function.The vJASS syntax simply writes the library name to its private function so remove it.(the vJASS syntax will look like mylibrary_myfunction.Note that this is the same w/ structs,methods and scopes.
4)Does
[jass=]
if GetLocalPlayer() == myplayer then
call AddSpecialEffect(string,x,y)
endif
[/code]
desync?If not,replace local effect function
5)[jass=] private function SSCast takes nothing returns nothing
local timer t = NewTimer()
local SS data = SS.create()
set data.caster = GetTriggerUnit()
set data.lvl = GetUnitAbilityLevel(data.caster,SSID)
set data.x = GetSpellTargetX()
set data.y = GetSpellTargetY()
set data.ef = LocalEffect(SSEFFECT,data.x,data.y,GetOwningPlayer(data.caster))
set data.fm = CreateFogModifierRadius(GetOwningPlayer(data.caster),FOG_OF_WAR_VISIBLE,data.x,data.y,SSAOEFM,true,true)
call FogModifierStart(data.fm)
call SetTimerData(t,data)
call TimerStart(t,SSTIMECAST,false,function SSStike)
set t = null
endfunction

private function SSAct takes nothing returns boolean
if GetSpellAbilityId() == SSID then
call SSCast()
endif
return false[/code]
combining this too should be a better idea
6)Base on the code,you are using TimerUtils am i right? First of all,you should add the TimerUtils in the requires list,then credit Vexorian(because he is the writer)
7)Because of what I said on #5,replace this:GetOwningPlayer(data.caster) to GetTriggerPlayer() then cache it into a local player so that it will add some speed in interpretation.
8)You have some messed indention

Needs Fix
Though this is a bit simple,i liked it.But it needs some changes as i suggested above so that this will have a chance to be approved by the mods.
 
Top