1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  5. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  6. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  7. The results are out! Check them out.
    Dismiss Notice
  8. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  9. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Summon Roflcopter v0.3

Submitted by Garfield1337
This bundle is marked as approved. It works and satisfies the submission rules.
A lulzy spell i made. The Roflcopter is made of floating text as well as the bombs he drops.

Summon Roflcopter
Call for the aid of a Roflcopter. The Rolfcopter will fly in a line and throw bombs beneath it.
Level 1 - 50 damage per bomb.
Level 2 - 100 damage per bomb.
Level 3 - 150 damage per bomb.

Requires:
-SpellEffectEvent (by Bribe) (Also the libraries that are required by this one: Table and RegisterPlayerUnitEvent)
-TimerUtils (Any, i used Vexorian's though)

Code
Code (vJASS):
library Roflcopter initializer Init requires TimerUtils, II, SpellEffectEvent, Z

    //Configurables and whatnot
    globals
        private constant integer SPELL_RAW         = 'A000'
        private constant string EXPLOSION_EFFECT   = "Abilities\\Weapons\\CannonTowerMissile\\CannonTowerMissile.mdl"
        private constant real HEIGHT               = 350.0 //Roflcopter height
        private constant real SPIN_PERIOD          = 0.16 //Period between each propeller change
        private constant attacktype ATTACK_TYPE    = ATTACK_TYPE_NORMAL
        private constant damagetype DAMAGE_TYPE    = DAMAGE_TYPE_NORMAL
        private constant weapontype WEAPON_TYPE    = WEAPON_TYPE_WHOKNOWS
    endglobals
   
    private constant function DAMAGE takes unit caster,integer lvl returns real
        return lvl * 50. //Damage dependency of level.
        //You can also make damage depend on caster's stats by refering to unit variable 'caster'
    endfunction
   
    private constant function TRAVEL_LENGTH takes integer lvl returns real
        return 1400. //How long does roflcopter fly
    endfunction
   
    private constant function BOMB_PERIOD takes integer lvl returns real
        return 0.5 //How often will roflcopter throw bombs
    endfunction
   
    private constant function BOMB_AOE takes integer lvl returns real
        return 200. //Area of effect for bomb explosion
    endfunction
   
    private constant function ROFLCOPTER_SPEED takes integer lvl returns real
        return 7. //Movement speed or roflcopter
    endfunction
   
    private constant function BOMB_SPEED takes integer lvl returns real
        return 7. //Fall speed of bombs
    endfunction
   
    private function FILTER takes unit caster,unit target,integer lvl returns boolean
        //Filters which units will be damaged on explosion
        return IsPlayerEnemy(GetOwningPlayer(caster),GetOwningPlayer(target)) /*
        */
and IsUnitType(target,UNIT_TYPE_GROUND) /*
        */
and not IsUnitType(target,UNIT_TYPE_DEAD)
    endfunction
   
    private function EFFECTS takes unit caster,unit target,real x,real y,real z,integer lvl returns nothing
        //You can add here anything you want to happen on explosion given the above arguments
        //For example, you can set damaged targets on fire with a spell casted by dummy or something
    endfunction
   
    //Don't change stuff below
    //===================================================================
    globals
        private constant string R1 = "ROFL:ROFL:LOL\n                      ^\n             ---------------\\           L\n           / [   ]            =====   O\n         /                  /             L\n        [_________/\n           I            I\n       \\-----------------"
        private constant string R2 = "                   LOL:ROFL:ROFL\n                      ^\n             ---------------\\\n           / [   ]            ===== LOL\n         /                  /\n        [_________/\n           I            I\n       \\-----------------"
        private constant string R3 = "   ROFL:ROFL:LOL\n                        ^\n               /---------------\nLOL =====             [   ] \\\n                  \\                  \\\n                    \\_________]\n                        I            I\n                    -----------------/"
        private constant string R4 = "                      LOL:ROFL:ROFL\n                        ^\n   L          /---------------\n  O   =====             [   ] \\\n   L             \\                  \\\n                    \\_________]\n                        I            I\n                    -----------------/"
        private constant real DEVIATION = 100.0
    endglobals
   
    private keyword roflcopter
   
    private struct instance
        integer n
        unit u
        real bs
        real rs
        real d
        real a
        integer lv
   
        method add takes nothing returns nothing
            set .n = .n + 1
        endmethod
       
        method sub takes nothing returns nothing
            set .n = .n - 1
            if .n == 0 then
                call .destroy()
            endif
        endmethod
   
        static method create takes unit u,real x,real y returns thistype
            local thistype this = thistype.allocate()
            local integer l = GetUnitAbilityLevel(u,SPELL_RAW)
            set .u = u
            set .bs = BOMB_SPEED(l)
            set .rs = ROFLCOPTER_SPEED(l)
            set .d = DAMAGE(u,l)
            set .a = BOMB_AOE(l)
            set .lv = l
            call roflcopter.create(this,x,y,TRAVEL_LENGTH(l),BOMB_PERIOD(l))
            return this
        endmethod
   
    endstruct
   
    private keyword bomb
   
    private struct roflcopter
        texttag t = CreateTextTag()
        instance i
        real x
        real y
        real l
        real a
        timer bp
        timer sp
        integer p
       
        method execute takes nothing returns nothing
            set .x = .x + .i.rs * Cos(.a)
            set .y = .y + .i.rs * Sin(.a)
            call SetTextTagPos(.t,.x - DEVIATION,.y,HEIGHT)
            set .l = .l - .i.rs
            if .l <= 0 then
                call .destroy()
            endif
        endmethod
   
        implement II
       
        static method bombdrop takes nothing returns nothing
            local thistype this = thistype(GetTimerData(GetExpiredTimer()))
            call bomb.create(.i,.x,.y,HEIGHT)
        endmethod
       
        static method spin takes nothing returns nothing
            local thistype this = thistype(GetTimerData(GetExpiredTimer()))
            if .p == 1 then
                call SetTextTagText(.t,R2,0.023)
                set .p = 2
            elseif .p == 2 then
                call SetTextTagText(.t,R1,0.023)
                set .p = 1
            elseif .p == 3 then
                call SetTextTagText(.t,R4,0.023)
                set .p = 4
            else
                call SetTextTagText(.t,R3,0.023)
                set .p = 3
            endif
        endmethod
   
        static method create takes instance i,real x,real y,real l,real p returns thistype
            local thistype this = thistype.allocate()
            local real a = Atan2(y - GetUnitY(i.u),x - GetUnitX(i.u))
            if a < 0 then
                set a = 2 * bj_PI + a
            endif
            set .i = i
            set .l = l
            set .a = a + bj_PI / 2
            set .bp = NewTimer()
            call TimerStart(.bp,p,true,function thistype.bombdrop)
            call SetTimerData(.bp,this)
            set .sp = NewTimer()
            call TimerStart(.sp,SPIN_PERIOD,true,function thistype.spin)
            call SetTimerData(.sp,this)
            call SetTextTagPermanent(.t,false)
            call SetTextTagVisibility(.t,true)
            set .x = x + l / 2 * Cos(a - bj_PI / 2) - DEVIATION
            set .y = y + TRAVEL_LENGTH(i) / 2 * Sin(a - bj_PI / 2)
            call SetTextTagPos(.t,.x,.y,HEIGHT)
            if a < bj_PI then
                set .p = 1
                call SetTextTagText(.t,R1,0.023)
            else
                set .p = 3
                call SetTextTagText(.t,R3,0.023)
            endif
            call .start()
            call .i.add()
            return this
        endmethod
       
        method destroy takes nothing returns nothing
            call DestroyTextTag(.t)
            call ReleaseTimer(.bp)
            call ReleaseTimer(.sp)
            call .end()
            call .i.sub()
            call .deallocate()
        endmethod
   
    endstruct
   
    private struct bomb
        static thistype This
        static group g = CreateGroup()
        texttag t = CreateTextTag()
        instance i
        real x
        real y
        real h
       
        method execute takes nothing returns nothing
            set .h = .h - .i.bs
            call SetTextTagPos(.t,.x,.y,.h)
            if .h <= 3.00 then
                call .destroy()
            endif
        endmethod
       
        implement II
       
        static method create takes instance i,real x,real y,real h returns thistype
            local thistype this = thistype.allocate()
            set .i = i
            set .x = x
            set .y = y
            set .h = h
            call SetTextTagPermanent(.t,false)
            call SetTextTagVisibility(.t,true)
            call SetTextTagPos(.t,x,y,h)
            call SetTextTagText(.t,"*",0.04)
            call .start()
            call .i.add()
            return this
        endmethod
       
        static method explosion takes nothing returns boolean
            local thistype this = .This
            local unit u = GetFilterUnit()
            local real x
            local real y
            local real z
            local real z2
            if FILTER(.i.u,u,.i.lv) then
                set x = GetUnitX(u) - .x
                set y = GetUnitY(u) - .y
                set z2 = GetZ(.x,.y) + .h
                set z = GetUnitZ(u) - z2
                if x*x+y*y+z*z <= .i.a*.i.a then
                    call UnitDamageTarget(.i.u,u,.i.d,false,false,ATTACK_TYPE,DAMAGE_TYPE,WEAPON_TYPE)
                    call EFFECTS(.i.u,u,.x,.y,z2,.i.lv)
                endif
            endif
            set u = null
            return false
        endmethod
       
        method destroy takes nothing returns nothing
            call DestroyTextTag(.t)
            call DestroyEffect(AddSpecialEffect(EXPLOSION_EFFECT,.x,.y))
            set .This = this
            call GroupEnumUnitsInRange(.g,.x,.y,.i.a,Filter(function thistype.explosion))
            call .end()
            call .i.sub()
            call .deallocate()
        endmethod
       
    endstruct
   
    private function Cast takes nothing returns nothing
        call instance.create(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY())
    endfunction
   
    private function Init takes nothing returns nothing
        call RegisterSpellEffectEvent(SPELL_RAW, function Cast)
    endfunction

endlibrary

How to import
-Copy the triggers from Roflcopter trigger category or the whole category itself
-Copy the spell from object editor
-Configure the spell to your needs with Roflcopter trigger's constants

Note: the roflcopter text gets messed up if you test the spell with JNGP, but it does display properly if you test it by normally starting the game even if the spell is saved under JNGP. It also displays properly if you test it from vanilla WE.

Keywords:
Roflcopter, gyrocopter, flying, machine, copter, bombs, explosion, lmao, rofl, lol, lolz, lulz, funny, derp, obvious, win, awesome, Bob Marley
Contents

Summon Roflcopter (Map)

Reviews
Moderator
15 Oct 2015 08:41 Bribe: No longer a director's cut resource as this is literally a joke. Bribe: Leakless Very MUI Absolutely no lag Highly entertaining Very creative Looks just about flawless Highly Recommended, I'll ask...
  1. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    The idea isn't mine, it's kind of a meme.
     
  2. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,527
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    still...it's getting famous^^
     
  3. EndOfWorld

    EndOfWorld

    Joined:
    Dec 13, 2010
    Messages:
    68
    Resources:
    0
    Resources:
    0
    GJ! Nice Spell! Using ur Spell!
    I got a problem......
    Always, when the roflcopter goes out of the map it lags hard...
    After some seconds it stops to lag.
    my map is small and the cam-border and the map-border are the same
    I dont like to change the borders. then the map would be too small
     
  4. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Updated.
    Recoded everything in vJass for better configurability, performance and readability.
    Also fixed the bug mentioned by EndOfWorld.
     
  5. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Glad you updated this :)
    You could improve your structs by making them extend arrays though.
     
  6. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    What's the advantage of making them extend arrays? Custom allocation?
     
  7. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,059
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Magtheridon96, for a really crazy, hundreds of allocations/deallocations per second system, allocation speed matters.

    But there are way more factors in programming than simply speed. Some relevant things why he should keep it as it is:

    - Readability
    - Intuitivity
    - The safety on the built-in allocate helps to defend against double-frees and leaks
    - Learning curve for users to understand what's happening
    - Time constraints when writing code

    The main advantage here is saving map file size, not saving speed, and for that I think if a mapmaker wants the file size compression he could change the allocators/deallocators of the systems his/herself.

    I am the kind of guy who says "no project is ever finished" however I also can respect that there are better uses of time and energy and much better reasons for updating/not updating than doing manual allocation.
     
  8. Matarael

    Matarael

    Joined:
    Dec 9, 2005
    Messages:
    513
    Resources:
    12
    Models:
    10
    Icons:
    1
    Maps:
    1
    Resources:
    12
    Lmfao...!
     
  9. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    But as JASS is so slow, speed's equal to better map performance in most cases and is not way too hard to implement (manual allocation can easily be done with the Aloc module by seph as an example). I fully agree with readability, the optimizer removes all the whitespaces and comments anyway and compresses variablesnames. But the double-free protection point I disagree with. No spell that leaks struct instances will ever be approved here anyway and you know that so it's a waste comparison really. And map size? Come on, I think the optimizer does a great job (even when it's destroying UnitAlive native but what a heck).

    And is it just me or is the code on the description page not updated? I don't have wc3 installed on this computer nor JNGP so cannot check.
     
  10. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,059
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    JASS is only slow if you are trying to do some really complex timer thing or a really crazy loop-within-loop-within-loop string parser like for a save/load system.

    And allocation/deallocation is extremely quick. One single CreateUnit call is about 2000 allocate/deallocate calls.
     
  11. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    And this aint complex handling texttags? :)

    Anyway went thru the code, the struct member: texttag t = CreateTextTag() will not work ey? As Texttags have nice limit of 100 and members are arrays?
     
  12. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Functions used directly on members get executed on allocation, not initially.
     
  13. Alfagar

    Alfagar

    Joined:
    May 23, 2009
    Messages:
    1,312
    Resources:
    2
    Models:
    2
    Resources:
    2
    Lol wut, this is osom!
     
  14. CoLd Bon3

    CoLd Bon3

    Joined:
    Aug 8, 2010
    Messages:
    948
    Resources:
    4
    Spells:
    4
    Resources:
    4
    The sickest thing i have ever seen in the hive! :DDDDD
     
  15. KnnO

    KnnO

    Joined:
    Sep 18, 2011
    Messages:
    156
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
  16. buraxia3

    buraxia3

    Joined:
    Mar 13, 2010
    Messages:
    121
    Resources:
    0
    Resources:
    0
    What kind of sorcery is this? :D
     
  17. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,839
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    If this has been casted 100 times without any of the copter dying,the next one will not show
     
  18. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Even less because of bombs, but I don't think there's a workaround for that.
    But it shouldn't be a problem in practice.
     
  19. GreeN!X

    GreeN!X

    Joined:
    Oct 20, 2012
    Messages:
    2,346
    Resources:
    2
    Maps:
    1
    Template:
    1
    Resources:
    2
  20. Zirukurt01

    Zirukurt01

    Joined:
    Aug 16, 2008
    Messages:
    275
    Resources:
    0
    Resources:
    0
    This is AWESOME!:ogre_datass:
    Make more meme spells!!