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.

Multi Shock (VJASS)

Submitted by Septimus
This bundle is marked as approved. It works and satisfies the submission rules.
Detail
Status

Forum: http://septimus.invisionplus.net
Coding: VJASS
Current Version: 1.01

Ability Description

Unleash an multiple shockwaves to the targeted enemies. Target this ability far from heroes to cluster the shots.
Target this ability close to heroes to scatter the shots. Each shockwaves deals 75 damage. Number of shockwaves increases with level.

Level 1 - Unleash 3 shockwaves.
Level 2 - Unleash 6 shockwaves.
Level 3 - Unleash 9 shockwaves.

Changelog
Version 1.01 Update

Fix shockwaves angle (Full credits goes to Dr Super Good).
Change the dummy ability from shockwaves to carrion swarm under the recommendation of the public.




Credit
Dark-Dragon - For pointing out a few errors in my coding and gives me a valuable information.
Kingz - For optimize the coding and given me a few helpful tips.
Dr Super Good - Fix the shockwaves angle.

VJASS Scripting
Code (vJASS):
library MultiShock initializer Init

globals

    private constant integer ACTIVATOR_RAWCODE = 'A003'

    private constant integer DUMMY_RAWCODE  = 'h000'

    private constant string DUMMY_STRING  = "carrionswarm"

    private constant real TARGET_ARC = 300

    private constant integer WAVE_NUMBER_PER_LEVEL = 3
    private constant integer WAVE_NUMBER_BASE = 0

    private constant real TARGET_ARC_CUTOFF = TARGET_ARC/6.28319

    private constant real TARGET_OFFSET = 150

    private constant real DUMMY_DURATION = 1
endglobals

private function MSCondition takes nothing returns boolean
    return GetSpellAbilityId() == ACTIVATOR_RAWCODE
endfunction

private constant function DummyFilter takes nothing returns boolean
    return true
endfunction

private function MultiShock takes nothing returns nothing
    local unit tu = GetTriggerUnit()
    local location tl = GetSpellTargetLoc()
    local unit lu
    local player p = GetOwningPlayer(tu)
    local integer im = WAVE_NUMBER_BASE + GetUnitAbilityLevel(tu,ACTIVATOR_RAWCODE) * WAVE_NUMBER_PER_LEVEL
    local integer i = 0
    local real x = GetUnitX(tu)
    local real y = GetUnitY(tu)
    local real tx = GetLocationX(tl)
    local real ty = GetLocationY(tl)
    local real distance = SquareRoot((x-tx)*(x-tx)+(y-ty)*(y-ty))
    local real circum
    local real r

    call RemoveLocation(tl)
    set tl = null
   
   
    if distance > TARGET_ARC_CUTOFF then
        set circum = TARGET_ARC/distance
        set r = Atan2(ty-y,tx-x) - circum/2
    else
        set circum = 6.28319
        set r = GetUnitFacing(tu)*bj_DEGTORAD
    endif
    set circum = circum/im
   
    loop
        exitwhen i == im
        set lu = CreateUnit(p,DUMMY_RAWCODE,x,y,r*bj_RADTODEG)
        call UnitApplyTimedLife(lu,'BTLF',DUMMY_DURATION)
        call IssuePointOrder(lu,DUMMY_STRING,x+TARGET_OFFSET*Cos(r),y+TARGET_OFFSET*Sin(r))
        set r = r + circum
        set i = i + 1
    endloop
   
    set tu = null
    set lu = null
    set p = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0
    local filterfunc ff = Filter(function DummyFilter)
    loop
        exitwhen (i >= bj_MAX_PLAYER_SLOTS)
        call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, ff)
        set i = i + 1
    endloop
    call TriggerAddCondition(t,Condition(function MSCondition))
    call TriggerAddAction(t,function MultiShock)
    call DestroyFilter(ff)
    set ff = null
endfunction
endlibrary


Keywords:
Shock, Multiple, Cluster, Scatter
Contents

Multi Shock Spells (Map)

Reviews
Moderator
18:52, 3rd Jun 2009 hvo-busterkomo: The spell was pretty good for a first attempt at vJASS. The effect was basic, but well executed. I've attached a script containing a small improvement. You should also be using a constant function with a take and...
Thread Status:
Not open for further replies.
  1. 18:52, 3rd Jun 2009
    hvo-busterkomo:
    The spell was pretty good for a first attempt at vJASS. The effect was basic, but well executed. I've attached a script containing a small improvement. You should also be using a constant function with a take and return value instead of WAVE_NUMBER_PER_LEVEL and WAVE_BASE.
    Script
    Code (vJASS):
    library MultiShock initializer Init

    globals

        private constant integer ACTIVATOR_RAWCODE = 'A003'

        private constant integer DUMMY_RAWCODE  = 'h000'

        private constant string DUMMY_STRING  = "carrionswarm"

        private constant real TARGET_ARC = 300

        private constant integer WAVE_NUMBER_PER_LEVEL = 3
        private constant integer WAVE_NUMBER_BASE = 0

        private constant real TARGET_ARC_CUTOFF = TARGET_ARC/6.28319

        private constant real TARGET_OFFSET = 150

        private constant real DUMMY_DURATION = 1
    endglobals

    private function MSCondition takes nothing returns boolean
        return GetSpellAbilityId() == ACTIVATOR_RAWCODE
    endfunction

    private constant function DummyFilter takes nothing returns boolean
        return true
    endfunction

    private function MultiShock takes nothing returns nothing
        local unit tu = GetTriggerUnit()
        local location tl = GetSpellTargetLoc()
        local unit lu
        local player p = GetOwningPlayer(tu)
        local integer im = WAVE_NUMBER_BASE + GetUnitAbilityLevel(tu,ACTIVATOR_RAWCODE) * WAVE_NUMBER_PER_LEVEL
        local integer i = 0
        local real x = GetUnitX(tu)
        local real y = GetUnitY(tu)
        local real dx = x-GetLocationX(tl)
        local real dy = y-GetLocationY(tl)
        local real distance = SquareRoot(dx*dx+dy*dy)
        local real circum
        local real r

        call RemoveLocation(tl)
        set tl = null
       
       
        if distance > TARGET_ARC_CUTOFF then
            set circum = TARGET_ARC/distance
            set r = Atan2(dy,dx) - circum/2
        else
            set circum = 6.28319
            set r = GetUnitFacing(tu)*bj_DEGTORAD
        endif
        set circum = circum/im
       
        loop
            exitwhen i == im
            set lu = CreateUnit(p,DUMMY_RAWCODE,x,y,r*bj_RADTODEG)
            call UnitApplyTimedLife(lu,'BTLF',DUMMY_DURATION)
            call IssuePointOrder(lu,DUMMY_STRING,x+TARGET_OFFSET*Cos(r),y+TARGET_OFFSET*Sin(r))
            set r = r + circum
            set i = i + 1
        endloop
       
        set tu = null
        set lu = null
        set p = null
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        local filterfunc ff = Filter(function DummyFilter)
        loop
            exitwhen (i >= bj_MAX_PLAYER_SLOTS)
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, ff)
            set i = i + 1
        endloop
        call TriggerAddCondition(t,Condition(function MSCondition))
        call TriggerAddAction(t,function MultiShock)
        call DestroyFilter(ff)
        set ff = null
    endfunction
    endlibrary
     
  2. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,175
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    This is my first vjass spells which have been view by Dark Dragon and improve by him & Kingz.

    It might be rather simple, that was because I make this vjass spells straight after I read 1 tutorial about vjass. You can consider that I jump off from GUI to VJASS without learning JASS.

    I still very weak about JASSING :xxd:

    P/S : Don't look at me as I was a mad man just because I jump off from GUI to VJASS by barely reading 1 tutorial. I code everything at GUI and convert it to JASS and slowly make it into VJASS, you can try to view the WIP of it. :eekani:
     
  3. Aeroblyctos

    Aeroblyctos

    Joined:
    Aug 14, 2006
    Messages:
    6,597
    Resources:
    24
    Models:
    1
    Packs:
    1
    Maps:
    22
    Resources:
    24
    Shockwaves are super laggy because of ground shaking. For example when I do more than couple shockwaves sametime in TCO the campaign lags like hell. FPS goes under 5. X_x

    Shockwaves are horrible laggy. I suggest change to Carrion Swarm, but shockwave's effect.
     
  4. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Never cast shockwaves, use as aero said, carrion swarm

    Also isn't this possible in GUI too? :)
     
  5. Blaxor

    Blaxor

    Joined:
    Sep 6, 2008
    Messages:
    411
    Resources:
    7
    Models:
    1
    Icons:
    6
    Resources:
    7
    @baassee
    Septimus said
    And I guess he means that he made it in GUI, converted it to Jass and made it vJass. :cute:
     
  6. Aeroblyctos

    Aeroblyctos

    Joined:
    Aug 14, 2006
    Messages:
    6,597
    Resources:
    24
    Models:
    1
    Packs:
    1
    Maps:
    22
    Resources:
    24
    Another thing is that the spell is simple. Too simple. :p

    I could do this type of spell with GUI in 5 mins without any leaks and works as good as JASS or vJASS. X_X_X_X_X_X_X
     
  7. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    well, although I hate GUI and prefer vJass... it's a bad idea rushing into Jass or vJass... dont rush ;)

    My advice to you is to stick a bit longer to GUI before you jump into vJass.
     
  8. Rmx

    Rmx

    Joined:
    Aug 27, 2007
    Messages:
    1,088
    Resources:
    18
    Icons:
    3
    Spells:
    15
    Resources:
    18
    Well think of it that way ........ U cast Shockwave from VJASS and the Shockwave effect or Knockback or push is not nor GUI or vJASS or JASS .. so it's only efficient as GUI...

    But if u did Like a Custom shockwave that will be very very very impressive so for now i consider it as a vJASS = GUI trigger ...

    Also see me i don't ruch into JASS and i'm now learning it ... going to have my vJASS spell soon :)
     
  9. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,175
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    lol... just create a carrion swarm ability for dummy unit and change the path of shockwave to carrionswarm at vjass code. It is very simply :p

    Hate to say this, but I already done that. :p

    Also, it was indeed easy to code in GUI. But how easy it was for people who know nothing about vjass and barely read 1 tutorial about vjass just to make it? :p

    Why settle for JASS when you could use VJASS :p

    GUI almost have little to no connection with JASS.

    lol, I beat you into it. :p

    JK, I am curious to know how helpful 1 tutorial could be naturally...
     
  10. aaron

    aaron

    Joined:
    Oct 18, 2008
    Messages:
    512
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    this is a nice beginner vjass spell even if it does lag o_O since it was your first 4/5 (only reason its not a 5/5 its because of the idea... seen it b4 :D)
     
  11. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,175
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    That is why I hate to create a normal spells, almost all normal spells now a days was a complete retro.
     
  12. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    believe me Septimus... there are still alot of simple ideas to make ;)

    Creativity has no boundaries!
     
  13. -JonNny

    -JonNny

    Joined:
    Jan 31, 2007
    Messages:
    486
    Resources:
    12
    Icons:
    3
    Maps:
    4
    Spells:
    4
    Tutorials:
    1
    Resources:
    12
    Hmm.. simple.. but simply nice , especially for your first Vjass / Jass Spell

    But there are little things which could be optimized:
    hints

    -Your calculations can be inlined
        local real xr = x + dist * Cos(angle * bj_DEGTORAD)
    return xr


    --->
       return x + dist * Cos(angle * bj_DEGTORAD)


    else there can be inlined some other things


    -also your use of bj_DEGTORAD and bj_DEGTORAD is quite useless , you could use the Radians directly instead of converting them twice
    dont forget to change your
    set r = (r + 20.00)
    if you change it


    -those
    PolarProjectionX
    and
    PolarProjectionY
    calculations could be used in the script directly because they are used once , but cuz they are not private its ok


    -Youve created a
    AngleBetweenPoints2
    function but in the script your using
    GetUnitFacing(tu)
    which could cause some differences because the unit starts casting before it completely faced the target point


    -some more constants or spell level related calculations can be moved above to ensure a easy modification
    e.g. your
    local integer im = GetUnitAbilityLevel(tu,Multi_Shock) * 3
    can be made into a function which takes the level and returns the number of shockwaves because i can image many would not find where to modificate that
    or your
    "shockwave"
    order string could be a global string above because the order depends on the used spell (e.g. if its changed to a carrionswarm ability it would bug)


    All in all its a decent spell :) these things are minor and its MUI and leakfree
    your on a good way
    and converting GUI to Jass was also something i made at first, an easy process of learning ;) but possibility to search functions in JNPG (JassCraft) is also a great help
     
    Last edited: May 18, 2009
  14. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    596
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    yes yes as -JonNny said very nice for first vJass spell. as well i can see you even coded your own PolarProjection functions which means you learned quite a lot of math (well at least enough for making such a spells like this one). there is as well that thing i agree that you could make global constant string which will hold that string "shockwave" or any other just to be easier for beginners to edit. other then that its really good spell leakless, MUI...

    so keep it up!
    ~Dark Dragon
     
  15. Coolty44

    Coolty44

    Joined:
    Dec 10, 2008
    Messages:
    576
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Ya, some dude on Youtube has something that lloks simalier, alittle laggy and leaky, but kinda the same thing
    And everything else has been said about this, but it is very good for a first GJ!
     
  16. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,175
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    errr.. no dd.. the polar projection was set by kingz... :p
     
  17. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    hahaha that's correct my friend! :)

    @coolty

    loools I can do this myself if I want to but don't need because now I got sept version instead ;)
     
  18. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    596
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    xD well anyway its still GJ!
    ~DD
     
  19. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,175
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    it the next update i would probably change it to carrion swarm.
     
Thread Status:
Not open for further replies.