[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Spells


Reply
 
Thread Tools
The Hive Workshop Spells:
FireEscort
Images
Highslide JS
Details
Uploaded:15:40, 26th Apr 2012
Last Updated:15:51, 21st May 2012
Keywords:pet,escort,fire,bolt,mage,diablo,dragonball,bribe,nesthaurus,vortex,round
Type:No Target
Category:vJASS

DESCRIPTION:
Creates 6 fireballs escort/pet that rotates around and follows the caster, nearby enemy units shall be hit by focused fire from the fireballs. All fireballs will return to follow the caster when enemy dies or when the caster is far away.
Spell lasts 60 seconds or when the caster dies.

|cffffcc00Level 1|r - Each hit damages 5.
|cffffcc00Level 2|r - Each hit damages 7.
|cffffcc00Level 3|r - Each hit damages 9.
|cffffcc00Level 4|r - Each hit damages 11.
|cffffcc00Level 5|r - Each hit damages 13.


Code

Jass:
/*
=====Spell Name: Fire Escort v1.0
=====Created by: Mckill2009

REQUIRES:
- JassNewGenPack by Vexorian

REQUIRED LIBRARIES and CREDITS:
- CTL by Nesthaurus (http://www.hiveworkshop.com/forums/jass-resources-412/snippet-constant-timer-loop-32-a-201381/)
- Table by Bribe (http://www.hiveworkshop.com/forums/jass-resources-412/snippet-new-table-188084/)

HOW TO USE: Step by Step
- Copy ALL the custom units and abilities from the object editor.
- Copy ALL that is inside the folder 'FireEscort' to your trigger editor.
- If you want to make your own units and abilities, make sure you change the rawID indicated in the code.
- If you change the DUMMY_SPELL_ID rawID, make sure it will be casted by ORDER_ID.
- To view rawID, press CTRL+D in the object editor.
- Save and Done!

YOU MAY:
- Change the model of the fireballs.
- Change the firebolt into slow, nova, purge but you MUST change also the ORDER_ID for it.
- Change the confugurations below.
*/

library FireEscort uses CTL, Table

globals
    private constant integer           SPELL_ID = 'A002' //Howl of Terror(rawID)
    private constant integer     DUMMY_SPELL_ID = 'A000' //Firebolt(rawID)
    private constant integer           ORDER_ID = 852231 //Firebolt
    private constant integer           DUMMY_ID = 'h000' //rawID
    private constant integer            BOMB_ID = 'h001' //rawID
    private constant real              INTERVAL = 0.03125
endglobals

native UnitAlive takes unit u returns boolean

//! textmacro SE takes UNT
set x = GetUnitX($UNT$)
set y = GetUnitY($UNT$)
set angle = Atan2(y-yDum, x-xDum)
set distance = getDistance(x,y,xDum,yDum)
loop
    exitwhen index==maxbombs
    set bomb = TBA[index].unit[dumID]
    set gap = TBA[2000+index].real[dumID]
    call SetUnitX(bomb, xDum+.offset*Cos(gap))
    call SetUnitY(bomb, yDum+.offset*Sin(gap))
    call SetUnitFlyHeight(bomb, .flyheight, 0)
    set TBA[2000+index].real[dumID] = gap+gapdist
    set bomb = null
    set index = index + 1
endloop
if distance > distancetoreach then
    call SetUnitX(.dummy, xDum+followspeed*Cos(angle))
    call SetUnitY(.dummy, yDum+followspeed*Sin(angle))
endif
//! endtextmacro

private function LoadFirst takes nothing returns nothing
    local unit u = CreateUnit(Player(15), DUMMY_ID,0,0,0)
    call UnitAddAbility(u, DUMMY_SPELL_ID)
    call KillUnit(u)
    set u = null
endfunction

private struct FE extends array
    unit caster
    unit target
    unit dummy
    real duration
    real offset
    real search
    real flyheight
    player owner
    static TableArray TBA
    
    //Configurables:
    static integer maxbombs = 6
    static real rotationspeed = 1
    static real followspeed = 7
    static real gapdist = 1 //recommended for 6 bombs
    static real raisespeed = 2
    static real offsetspeed = 2
    static real maxoffset = 300
    static real aoe = 900
    static real searchinterval = 2
    static real maxheight = 400 //this should not be greater than your CAST RANGE
    static real maxduration = 60 //sets the life of the dummy captain
    static real distancetofollow = 640000 //SquareRoot is 800
    static real distancetoreach = 3600 //Squareroot is 60
    //==========
    
    method getDistance takes real x1, real y1, real x2, real y2 returns real
        return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)
    endmethod
    
    method filterThem takes unit caster, unit target returns boolean
        return UnitAlive(target) and IsUnitEnemy(caster,GetOwningPlayer(target)) and not (IsUnitType(target, UNIT_TYPE_STRUCTURE) and /*
        */ IsUnitType(target, UNIT_TYPE_MECHANICAL) and IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE))
    endmethod
    
    implement CTL
        local unit bomb
        local unit first
        local real x
        local real y
        local real xDum
        local real yDum
        local real gap
        local real angle
        local real distance
        local real distance2
        local integer index
        local integer dumID
    
    implement CTLExpire
        set index = 0
        set dumID = GetHandleId(.dummy)
        if UnitAlive(.caster) and .duration > 0 then
            set .duration = .duration - INTERVAL
            set xDum = GetUnitX(.dummy)
            set yDum = GetUnitY(.dummy)
            
            if .offset < maxoffset then
                set .offset = .offset + offsetspeed
            endif
            
            if .flyheight < maxheight then
                set .flyheight = .flyheight + raisespeed     
            endif
            
            if .target==null then
                //! runtextmacro SE(".caster")
                set .search = search + INTERVAL
                if .search > searchinterval and distance < 4000 then
                    call GroupEnumUnitsInRange(bj_lastCreatedGroup,xDum,yDum,aoe,null)
                    loop
                        set first = FirstOfGroup(bj_lastCreatedGroup)
                        exitwhen first==null
                        if filterThem(.caster, first) then
                            set .target = first 
                        endif
                        call GroupRemoveUnit(bj_lastCreatedGroup, first)
                    endloop
                    set searchinterval = 0
                endif
            else
                if UnitAlive(.target) then
                    //! runtextmacro SE(".target")
                    if .flyheight >= maxheight then
                        set distance2 = getDistance(GetUnitX(.caster),GetUnitY(.caster),xDum,yDum)
                        if distance2 < distancetofollow then
                            set index = 0
                            loop
                                exitwhen index==maxbombs
                                call IssueTargetOrderById(TBA[index].unit[dumID],ORDER_ID,.target)                    
                                set index = index + 1
                            endloop
                        else
                            set .target = null
                        endif
                    endif
                else
                    set .target = null
                endif
            endif
        else //End the Spell
            call KillUnit(.dummy)
            loop
                exitwhen index==maxbombs
                call KillUnit(TBA[index].unit[dumID])                 
                set index = index + 1
            endloop
            set .caster = null
            set .target = null
            set .dummy = null
            call .destroy()
        endif
    implement CTLNull
        set bomb = null
    implement CTLEnd 
    
    static method setup takes unit u, player p returns nothing
        local thistype this = create()
        local integer lvl = GetUnitAbilityLevel(u, SPELL_ID)
        local integer index = 0
        local real g = 0
        local integer dumID
        local unit bomb
        local real gap
        set .caster = u
        set .target = null
        set .duration = maxduration
        set .owner = p
        set .dummy = CreateUnit(p,DUMMY_ID,GetUnitX(u),GetUnitY(u),0)
        set .offset = 0
        set .flyheight = 0
        set .search = 0
        set dumID = GetHandleId(.dummy)
        loop
            exitwhen index==maxbombs
            set bomb = CreateUnit(p,BOMB_ID,0,0,0)
            set gap = g
            set TBA[index].unit[dumID] = bomb
            set TBA[2000+index].real[dumID] = gap
            call SetUnitFlyHeight(bomb, 0,0)
            call UnitAddAbility(bomb, DUMMY_SPELL_ID)
            call SetUnitAbilityLevel(bomb,DUMMY_SPELL_ID, lvl)
            set g = g + gapdist
            set index = index + 1
        endloop  
    endmethod 
    
    static method cast takes nothing returns boolean
        if GetSpellAbilityId()==SPELL_ID then
            call setup(GetTriggerUnit(), GetTriggerPlayer())
        endif
        return false
    endmethod   
    
    static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, function thistype.cast)
        call LoadFirst()
        set t = null
        set TBA = TableArray[5000]
    endmethod   
endstruct

endlibrary


CREDITS:
- Nesthaurus (CTL)
- Bribe (Table)
Rating - 0.00 (0 votes)
(Hover and click)
Moderator Comments
Recommended
21st May 2012
Bribe: I recommend that you prefix the "SE" textmacro for the sake of relevance.

Spell and code look good, approved.

This spell is approved and works properly.


Download FireEscort.w3x
(34.93 KB, 197 Downloads)

Old 04-27-2012, 03:29 AM   #2 (permalink)
Registered User Almia
Oh Data Structures <3
 
Almia's Avatar
 
Join Date: Apr 2012
Posts: 2,989
Almia is a name known to all (639)Almia is a name known to all (639)
Just like Wisp's Spirits,is it??
Hey,do you want to join me to make Wisp's(dota)Spell Pack???
i know how to make Relocate and Tether...i made them Months ago(its mui i think cause it doesnt have any waits)
would you like too?
for that ill give it 4/5 because its like you got it from other Spells
After 10 days actually ^^
Almia is offline   Reply With Quote
Old 04-27-2012, 11:47 AM   #3 (permalink)
Registered User mckill2009
SSJ99999 Pinoy!
 
mckill2009's Avatar
 
Join Date: Mar 2009
Posts: 4,378
mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)
- I dont know what's Wisp's Spirits, is it a spell/map?...
- No waits doesnt mean it's MUI :D...
- What you mean that I got it from other spells?...
__________________
My Resources:
My Maps
My Systems/Spells

Your ideas tend to result in unnecessary violence so shut the F*** up!
mckill2009 is offline   Reply With Quote
Old 04-28-2012, 02:02 AM   #4 (permalink)
Registered User Almia
Oh Data Structures <3
 
Almia's Avatar
 
Join Date: Apr 2012
Posts: 2,989
Almia is a name known to all (639)Almia is a name known to all (639)
-uhhmmm its a hero from DotA Guardian Wisp
-but i use some Hashtables in my practice :D
-Sorry For the Mistake cause they are very look alike XD
Almia is offline   Reply With Quote
Old 05-06-2012, 04:40 AM   #5 (permalink)
Registered User Striker21
Dota's Fan
 
Striker21's Avatar
 
Join Date: Aug 2009
Posts: 362
Striker21 has little to show at this moment (31)Striker21 has little to show at this moment (31)Striker21 has little to show at this moment (31)Striker21 has little to show at this moment (31)
The Fireballs move quite "un-smoothy"
And i think i would prefer to use the Locust ability if it doesn't have some more advances :D Like:
The caster has a sub-ability to call the balls to target a unit
Or
Switching them between defensive and offensive. In defensive, they heal allies. Offensive, they attack
etc...
Just my opinion to improve the spell. Hope you welcome it :D
PM me when the next update comes, cause i don't want to vote for a bad result :P

=======Edit=======
Oh... and i think i found a bug. When the balls goes out the borders of the map (playable area), my warcraft III crashes. (it happens twice so... check out for it :D) (but maybe it because my comp is sucks :( )
__________________
Wanna see DotA heroes on paper? ===> Click to visit <===
Nothing is IMPOSSIBLE but Nothing is EASY
Striker21 is offline   Reply With Quote
Old 05-06-2012, 05:07 AM   #6 (permalink)
Registered User Shadowleaves
The damned return...
 
Shadowleaves's Avatar
 
Join Date: Jan 2012
Posts: 12
Shadowleaves has little to show at this moment (1)
Especially the ball touches the bottom boundary
I think the unit with ability 'locust' cant be moved to there:-)

Hot to fix it
Shadowleaves is offline   Reply With Quote
Old 05-06-2012, 12:55 PM   #7 (permalink)
Registered User mckill2009
SSJ99999 Pinoy!
 
mckill2009's Avatar
 
Join Date: Mar 2009
Posts: 4,378
mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)mckill2009 is a splendid one to behold (845)
Its not really a bug coz any unit that goes beyond map boundaries will cause a map to crash, its normal, but you may use BoundSentinel library to fix the crash...
I am open and considerate enough to any suggestions and thank you for that :)...
__________________
My Resources:
My Maps
My Systems/Spells

Your ideas tend to result in unnecessary violence so shut the F*** up!
mckill2009 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 04:55 PM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle