1. 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
  2. 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
  3. 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
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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.

Zephyr Contest #11 - My aura, Your aura

Discussion in 'Contest Archive' started by Pharaoh_, Jul 1, 2014.

Thread Status:
Not open for further replies.
  1. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    Make your spell, add debug messages, take a screenshot of the spell in action with the screen full of debug text.
     
  2. GunSlinger

    GunSlinger

    Joined:
    Oct 17, 2009
    Messages:
    1,441
    Resources:
    0
    Resources:
    0
    So here's my WIP.
    WIP.png
     
  3. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,701
    Resources:
    0
    Resources:
    0
    He just needs to submit it twice then lol.
     
  4. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6
    Semi-Final Submission

    This is my semi-final submission! It works as advertised. I will polish this code later on to make it simpler and more efficient. I have a few bits to clean up and more to document I think. I have a scoring question; this is based on the aura itself, and not the supporting systems around it right?

     

    Attached Files:

  5. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    you are obssesed with the idea that someone would use wurst. No he is not using wurst, and even if he would,
    your name is not there, so it shouldnt be your problem
     
  6. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6
    Final Submission for Aspect of Lightning

    This is my final submission post for this contest (barring any discovered bugs of course). Below is a list of configurables for Aspect of Lightning (the configurables for the support systems are not listed). Below this list is the code specific to Aspect of Lightning.

    Screenshots

    Normal aura look.

    [​IMG]

    Empowered aura look.

    [​IMG]
    • Aspect of Lightning (Z)

      Active: Purges all nearby enemy units, removing all buffs from them and immobilizing them for 3 seconds. Their movement speed is reduced for 15 seconds. Deals 400 damage to summoned units.
      Passive: Periodically hurls bolts of lightning at nearby enemy units dealing 25 damage.

      Right-click to empower the aura.
    • Aspect of Lightning (Z)

      Active: Purges all nearby enemy units, removing all buffs from them and immobilizing them for 3 seconds. Their movement speed is reduced for 15 seconds. Deals 400 damage to summoned units.
      Passive: Periodically hurls bolts of lightning at nearby enemy units dealing 25 damage.

      Empowered: The bolts of lightning bounces to two additional targets. Drains 25 mana each second.
      Right-click to unempower the aura.
    Configurables
    Code (vJASS):
    constant integer    AoL_AbilityId       ='A000' // This is the spell's object id for the aura.
    constant integer    AoL_PurgeId         ='A001' // This is the object id for the purge aspect of the aura.
    constant integer    AoL_LightningId     ='A002' // This is the object id for the unempowered chain lightning aspect of the aura.
    constant integer    AoL_EmpoweredId     ='A003' // This is the object id for the empowered chain lightning aspect of the aura.
    constant integer    AoL_Index           =StringHash("Aspect of Lightning") // This is where I index auras to units.
    constant integer    AoL_PurgeOrderId    =852111 // This is the order id for "purge".
    constant integer    AoL_LightningOrderId=852119 // This is the order id for "chainlightning".
    constant integer    AoL_UnempowerOrderId=852544 // This is the order id for when a unit turns off autocasting for the aura.
    constant integer    AoL_EmpowerOrderId  =852543 // This is the order id for when a unit turns on the autocasting for the aura.
    constant real       AoL_ManaUseage      =25 // This is how much mana is drained each second to have the aura empowered.
    constant string     AoL_LightningType   ="CLSB" // The type of lightning the aura creates.
    constant string     AoL_EmpoweredType   ="AFOD" // The type of lightning the aura creates while empowered.
    Aspect of Lightning
    Code (vJASS):
    //***************************************************************************
    //*
    //*  Aspect of Lightning.
    //*
    //***************************************************************************
    //===========================================================================
    // AoL_Tick
    //   takes   nothing
    //   returns nothing
    //
    //   Handles the periodic effect of Aspect of Lightning (defaulted at 1 second).
    //      This is called internally by the aura system with Aura_Index set to the aura's id number.
    //===========================================================================
    function AoL_Tick takes nothing returns nothing
        // ***** Local variables *****
        local unit    Caster =Aura_Caster[Aura_Index]                         // The owner of the aura.
        local unit    Target =GroupPickRandomUnit(Aura_TargetsAdd[Aura_Index])// The potential target for the aura to zap.
        local real    X      =GetUnitX(Caster)                                // The x coordinate of the owner of the aura.
        local real    Y      =GetUnitY(Caster)                                // The y coordinate of the owner of the aura.
        local unit    Dummy                                                   // The potential dummy caster to zap the potential target.
        local integer SpellId=AoL_LightningId                                 // The zap spell's object id.
        local real    Mana   =GetUnitState(Caster,UNIT_STATE_MANA)            // How much mana the owner of the aura has.
        local integer Number =25                                              // How many lightning bolts to create.
        local real    Angle                                                   // The start point of the lightning bolt.
        local real    Angle2                                                  // The end point of the lightning bolt.
        local real    Radius =Aura_Radius[Aura_Index]                         // The radius of the aura.
        // ***** Zap random target *****
        if(Target!=null)then // If a target exists, zap it.
            // ***** Check empowered *****
            if(AoL_Empowered[Aura_Index])then
                // Check the mana of the caster to see if we can be empowered.
                if(Mana>=AoL_ManaUseage)then
                    set SpellId=AoL_EmpoweredId
                    call SetUnitState(Caster,UNIT_STATE_MANA,Mana-AoL_ManaUseage)
                    // ***** Create lightning pulse effect denoting the AoE of the aura *****
                    loop
                        exitwhen Number==0
                        set Angle=GetRandomReal(0,TWO_PI)
                        set Angle2=Angle+GetRandomReal(.5,1.5)
                        call Bolt(AoL_EmpoweredType,X+Radius*Cos(Angle),Y+Radius*Sin(Angle),X+Radius*Cos(Angle2),Y+Radius*Sin(Angle2),GetRandomReal(0.5,1))
                        set Number=Number-1
                    endloop
                else // Not enough mana, unempower the aura.
                    call IssueImmediateOrderById(Caster,AoL_UnempowerOrderId)
                endif
            endif
            set Dummy=CreateUnit(GetOwningPlayer(Caster),Cast_DummyId,X,Y,Atan2(GetUnitY(Target)-Y,GetUnitX(Target)-X))
            call UnitAddAbility(Dummy,SpellId)
            call SetUnitAbilityLevel(Dummy,SpellId,GetUnitAbilityLevel(Caster,AoL_AbilityId))
            call IssueTargetOrderById(Dummy,AoL_LightningOrderId,Target)
            call UnitApplyTimedLife(Dummy,'BTLF',1)
            set Dummy=null
            set Target=null
        endif
        // ***** Clean-up *****
        set Caster=null
    endfunction
    //===========================================================================
    // AoL_Update
    //   takes   nothing
    //   returns nothing
    //
    //   Updates the aura every Aura_TIMEOUT seconds. Called internally by the
    //      aura system with Aura_Index set to the aura's id number.
    //===========================================================================
    function AoL_Update takes nothing returns nothing
        local unit Caster=Aura_Caster[Aura_Index]
        local string LightningType=AoL_LightningType
        local real Angle=GetRandomReal(0,TWO_PI)
        local real Angle2=Angle+GetRandomReal(.5,1.5)
        local real X=GetUnitX(Caster)
        local real Y=GetUnitY(Caster)
        local real Radius=Aura_Radius[Aura_Index]
        if(AoL_Empowered[Aura_Index])then
            set LightningType=AoL_EmpoweredType
        endif
        call Bolt(LightningType,X+Radius*Cos(Angle),Y+Radius*Sin(Angle),X+Radius*Cos(Angle2),Y+Radius*Sin(Angle2),GetRandomReal(0.5,1))
        set Caster=null
    endfunction
    //===========================================================================
    // AoL_Enter
    //   takes   nothing
    //   returns boolean - true means add the unit to the aura's targets, false means don't add the unit to the aura's targets.
    //
    //   This is called in response to a unit entering the area of effect of the aura.
    //      The trigger has the aura's id number stored in it. This aura filters based
    //      on if the unit is allied. Only enemies are added.
    //===========================================================================
    function AoL_Enter takes nothing returns boolean
        return not IsUnitAlly(GetTriggerUnit(),GetOwningPlayer(Aura_Caster[LoadInteger(Hash,GetHandleId(GetTriggeringTrigger()),0)]))
    endfunction
    //===========================================================================
    // AoL_Create
    //   takes   unit Unit   - The unit to attach the aura to.
    //           real Radius - How big the aura is.
    //   returns integer     - The aura id of the newly created aura.
    //
    //   Creates a new instance of the Aspect of Lightning aura.
    //      Attaches the aura to the unit via hashtable.
    //===========================================================================
    function AoL_Create takes unit Unit,real Radius returns integer
        local integer AuraId=AS_Create(Unit,Radius,1,AoL_EnterFilter,AoL_TickFilter,AoL_UpdateFilter)
        set AoL_Empowered[AuraId]=false
        call SaveInteger(Hash,GetHandleId(Unit),AoL_Index,AuraId)
        return AuraId
    endfunction
    //===========================================================================
    // AoL_SwitchState
    //   takes   nothing
    //   returns nothing
    //
    //   This switches the aura's empowered state from on to off and off to on
    //      based on handling issued unit orders. This catches right-clicking
    //      the aura's icon (autocast toggling).
    //===========================================================================
    function AoL_SwitchState takes nothing returns nothing
        set AoL_Empowered[LoadInteger(Hash,GetHandleId(GetTriggerUnit()),AoL_Index)]=GetIssuedOrderId()==AoL_EmpowerOrderId
    endfunction
    //===========================================================================
    // AoL_Cast
    //   takes   nothing
    //   returns nothing
    //
    //   Triggers when the owner of the aura activates the aura by left-clicking it (casting).
    //      The triggering unit has the aura id number attached to it.
    //===========================================================================
    function AoL_Cast takes nothing returns nothing
        // ***** Local variables *****
        local unit    Caster      =GetTriggerUnit()                               // The owner of the aura that just activated it.
        local player  Owner       =GetTriggerPlayer()                             // The player that owns the aura's owner.
        local integer AuraId      =LoadInteger(Hash,GetHandleId(Caster),AoL_Index)// The aura id the aura's owner is attached to.
        local integer Level       =GetUnitAbilityLevel(Caster,AoL_AbilityId)      // The level of the aura.
        local group   GroupIterate=Aura_TargetsAdd[AuraId]                        // The group of targets to iterate over.
        local group   GroupAdd    =Aura_TargetsPtr[AuraId]                        // The new group of targets to add iterated targets to.
        local unit    Unit                                                        // The current target.
        local unit    Dummy                                                       // Dummy casters to cast 'Purge' on the iterated targets.
        // ***** Iterate over targets *****
        loop
            // ***** Set-up loop *****
            set Unit=FirstOfGroup(GroupIterate)
            exitwhen Unit==null // Exit once iterated group is empty.
            // ***** Swap the unit *****
            call GroupRemoveUnit(GroupIterate,Unit)
            call GroupAddUnit(GroupAdd,Unit)
            // ***** Cast 'Purge' on the unit *****
            set Dummy=CreateUnit(Owner,Cast_DummyId,GetUnitX(Unit),GetUnitY(Unit),0)
            call UnitAddAbility(Dummy,AoL_PurgeId)
            call SetUnitAbilityLevel(Dummy,AoL_PurgeId,Level)
            call IssueTargetOrderById(Dummy,AoL_PurgeOrderId,Unit)
            call UnitApplyTimedLife(Dummy,'BTLF',1)
            // ***** Clean-up loop *****
            set Dummy=null
            set Unit=null
        endloop
        // ***** Swap unit groups *****
        set Aura_TargetsAdd[AuraId]=GroupAdd
        set Aura_TargetsPtr[AuraId]=GroupIterate
        // ***** Clean-up *****
        set GroupAdd=null
        set GroupIterate=null
        set Caster=null
        set Owner=null
    endfunction
    WIPs By Order Posted
    Updates
    1. Fixed documentation, and added a minor optimization.

    2. Inlined a function to gain a bit more performance and reduce the function count. Made the aura only consume mana when it actually has a target to cast an empowered chain lightning on.

    3. Added a list of all work in progress posts and concept idea posts relating to this final entry.

    4. Added screenshots and re-added the aura instances for the creeps and spawned units.

    5. Something must've changed, just in case last minute update; also, now more scary with only 666 lines of code.

     

    Attached Files:

    Last edited: Aug 1, 2014
  7. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,757
    Resources:
    106
    Models:
    90
    Icons:
    5
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    106
    Though many may deem it insane and out of the question, is a GUI configuration for a JASS entry frowned upon?
     
  8. I bet not. When I was a GUI user, I was afraid of configuring vJass spells via JASS interface. So I bet GUI interface of configuration might be even better :D
     
  9. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,757
    Resources:
    106
    Models:
    90
    Icons:
    5
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    106
    Lol, me too, and GUI mains might not know of things such ass the strings' "//".
     
  10. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6

    Who else is a part of this contest?

     
  11. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,757
    Resources:
    106
    Models:
    90
    Icons:
    5
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    106
    Muh list, though I might have missed a few updates. But not contestants.
     
  12. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    Isn't Kingz out too? The list seems to be outdated :O
     
  13. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6

    I updated my final entry correcting some documentation and adding one very minor optimization here.

    Edit:

    Do I have to document and optimize my supporting systems? If so, please let me know. If not, then I can't be marked off for not having it.

     
    Last edited: Jul 28, 2014
  14. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,757
    Resources:
    106
    Models:
    90
    Icons:
    5
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    106
    Lol, he said he would be busy, but not like going out. However I will update it.
     
  15. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6

    Added another update. Enjoy!

     
  16. Oh you guys, submitting your final submissions in time, watch and learn as I fail to submit my over 1k code in time >_>
     
  17. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6

    Why is your code so lengthy? I wonder what systems you have got going there! Probably a unit indexer among other things.

     
  18. TimerUtils StillDummy Table PUI, then solely for the spell only I created Tileset modifier library.
     
  19. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6

    That's cool. I created all the support code for mine. Also, another update, it should be my final update.

     
  20. Kingz

    Kingz

    Joined:
    Jun 5, 2008
    Messages:
    2,470
    Resources:
    6
    Spells:
    5
    Tutorials:
    1
    Resources:
    6
    Ye i had no time to work on my idea, only made the passive effect.
    And i was really swamped with actual work so had to bail on the contest.

    So yeah, im out.
     
Thread Status:
Not open for further replies.