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.

Icon/Model/Spell Team Contest - Hive Member[+100 Rep]

Discussion in 'Contest Archive' started by IcemanBo, Nov 5, 2017.

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

    DD_legionTN

    Joined:
    Dec 19, 2012
    Messages:
    410
    Resources:
    0
    Resources:
    0
    1st code WIP from team : Sentinel (Best tem 10/10)
    For some reason CnP the wurst code from VS will have no indent...
    Code (WurstScript):

    package MooseCharge

    /*==================================================================================================*
    *
    * Spell Description :
    *
    * Not yet ready...
    *
    *===================================================================================================*
    *
    * Import ClosureTimers for :
    * 1. uses class CallbackPeriodic */

    import ClosureTimers

    /*
    * Import LinkedListModule for :
    * 1. Turn class into LinkedList */

    import LinkedListModule

    /*
    *==================================================================================================*
    *
    * Import Instructions :
    *
    * Not yet ready...
    *
    *==================================================================================================*
    *
    * Configuration :
    *
    * Configuration should be done in MooseCharge_config.wurst
    *
    /*================================================================================================*/






    /*============================================Globals=============================================*/
    /** Spell id*/
    @configurable constant SPELL_ID = 'A000'

    /** Spell required charging time*/
    @configurable constant CHARGE_TIME = 2.0

    /** Determine if spell is interruptable while caster is channelling*/
    @configurable constant INTERRUPTABLE_CHANNEL = true

    /** Determine if spell is interruptable while caster is charging*/
    @configurable constant INTERRUPTABLE_CHARGING = true

    /** Spell duration after completed charging time*/
    @configurable constant SPELL_DURATION = 3.0

    /** Unit's charging animation index*/
    @configurable constant CHARGE_ANIMATION_INDEX = 1

    /** Unit's charging animation speed*/
    @configurable constant CHARGE_ANIMATION_SPEED = 1.

    /** Starting charging speed*/
    @configurable constant START_SPEED = 100.

    /** Maximum charging speed*/
    @configurable constant MAX_SPEED = 500.

    /** Speed increase per second*/
    @configurable constant ACCELERATION = 25.

    /** Speed decrease per second after reached SPELL_DURATION*/
    @configurable constant DEACCELERATION = 50.

    /** Determine if deacceleration will still apply after hitting a unit*/
    @configurable constant DEACCELERATE_AFTER_HIT = false

    /** Periodic run time*/
    @configurable constant PERIODIC_TIME = 0.03125

    /** Acceleration speed increases per PERIODIC_TIME*/
    constant ACCELERATION_PER_TICK = ACCELERATION*PERIODIC_TIME

    /** Cargo hold ability id*/
    constant CARGO_HOLD = 'Abun'

    /** Function define the circumstances where if occur, channelling will be interrupted*/
    @configurable function chanellingInterrupt(unit caster) returns bool
    return false

    /** Function define the circumstances where if occur, charging will be interrupted*/
    @configurable function chargingInterrupt(unit caster) returns bool
    return false
    /*================================================================================================*/





    /*=============================================Enums==============================================*/
    enum SpellPhase
    Channel
    Charging
    Deaccelerate
    /*================================================================================================*/





    /*================================================================================================*/
    class Charge
    use LinkedListModule

    //----------------------Ordinary Globals----------------------
    private unit caster

    private real curSpeed = START_SPEED
    private real timeLeft = CHARGE_TIME
    //------------------------------------------------------------


    //-----------------------Tuple Globals------------------------
    private vec2 curPoint
    private angle ang
    //------------------------------------------------------------


    //------------------------Enum Globals------------------------
    private SpellPhase sp = Channel
    //------------------------------------------------------------



    //===================Creation/Destroy Functions===================
    construct(unit caster)
    this.caster = caster
    ..setAnimation(CHARGE_ANIMATION_INDEX)
    ..setTimeScale(CHARGE_ANIMATION_SPEED)
    ..setPropWindow(0.)
    ..addAbility(CARGO_HOLD)

    this.curPoint = caster.getPos()

    if Charge.size == 1
    cbp.start(PERIODIC_TIME)

    ondestroy
    //remove all applied effects
    this.caster
    ..removeAbility(CARGO_HOLD)
    ..setPropWindow(GetUnitDefaultPropWindow(this.caster))
    ..issueImmediateOrder("stop")

    this.caster = null
    Charge.size--

    if Charge.size == 0
    destroy cbp
    //================================================================



    //=========================Core Functions=========================
    private static CallbackPeriodic cbp = (CallbackPeriodic cb) ->
    begin
    for instance in Charge
    if instance.sp == SpellPhase.Channel
    //-----------Phase 1 : Channel-----------
    //if charging time is done
    if instance.timeLeft <= 0
    instance.sp = SpellPhase.Charging
    instance.timeLeft = SPELL_DURATION
    instance.ang = instance.caster.getFacingAngle()
    //if interruptable and defined interrupt condition is true
    else if INTERRUPTABLE_CHANNEL and chanellingInterrupt(instance.caster)
    destroy instance
    //------------End of Phase 1-------------
    else if instance.sp == SpellPhase.Charging
    //----------Phase 2 : Charging-----------
    //------------End of Phase 2-------------
    else if instance.sp == SpellPhase.Deaccelerate
    //--------Phase 3 : Deaccelerate---------
    //------------End of Phase 3-------------

    instance.timeLeft -= PERIODIC_TIME
    end
    //================================================================

    /*================================================================================================*/

    function onChannel() returns bool
    if GetSpellAbilityId() == SPELL_ID
    new Charge(GetTriggerUnit())

    return false

    init
    CreateTrigger()
    ..registerAnyUnitEvent(EVENT_PLAYER_UNIT_SPELL_CHANNEL)
    ..addCondition(Condition(function onChannel))
     
    @IcemanBo
     
  2. Kyrbi0

    Kyrbi0

    Joined:
    Jul 29, 2008
    Messages:
    7,913
    Resources:
    1
    Models:
    1
    Resources:
    1
    2nd Code WIP from Team Zul'Aman Was An Inside Job (or ZAWAIJ for short, since my system can't handle long filenames):

    upload_2017-12-6_11-53-22.png
    Basically done, actually (barring testing). Lol

    @IcemanBo , I think you missed our first Code WIP in your chart.
     
  3. Abovegame

    Abovegame

    Joined:
    Jan 2, 2016
    Messages:
    464
    Resources:
    1
    Maps:
    1
    Resources:
    1
    That logo though :D
     
  4. Darkfang

    Darkfang

    Joined:
    Jun 25, 2008
    Messages:
    1,717
    Resources:
    203
    Models:
    1
    Icons:
    186
    Skins:
    11
    Maps:
    3
    Tutorials:
    2
    Resources:
    203
    Darkfang concept art:
    I will improve the quality of the photo later:
    [​IMG]

    Darkfang Concept history (I know it doesn't apply, but I think it is cool to give a background to a character appearance and abilities)

    Darkfang was once a giant tarantula from the corrupted lands of Felwood, it used to consume deers, wolves, or any hapless creature that it could catch. The spider couldn't find any prey, and so it's hunger grew and grew even bigger, turning the spider insane in a feeding rage, consuming even it's own offspring in the despair. A special rage fillled the heart of the insect, that quiet feeding rage that fills crocodiles, serpents and spiders, creatures that await for their prey to come, in ambush.

    Months passed, and with them a warlock came, a Human one, a powerful one, he and his felhunter walked through her territory, Darkfang sensed it, he and his pink flesh excited her stomach, but the Felhunter troubled her.

    - Were is that dumb f** of an insect?, the Gnome told me he would pay me well for her legs.
    The Felhunter noded, like if he was smelling something, the Warlock didn't notice, he just kept talking.
    - There are just dried up corpses and dried webs all over the place, for all we know the damn spider should be dead already. -

    The spider could understand it's words, the corruption didn't only make it giant, it made it more intelligent, clever. As the human walked the land she watched with her eight eyes, awaiting, tasting the moment, anticipating.

    - There is so much dead sh** in this pla...-
    The Felstalker thought that the only sh*t on the place was coming from his master's mouth, he was really interested in the spider, but then the words stopped, and it turned back, his Master was lying in a hole in the ground, immobilized between spider silk, the spider dind't only wait, it had laid traps all over the place, the Felhunter felt admiration over the beast, and looked at it's master with an evil smile, finally it could be free from the warlock's domination, from him and from the Legion, to roam and feast upon the weak mortals that fill the land, just as the spider does. He was about to step back and let his master die, but from the trees Darkfang attacked, lashing against the Felhunter, a bite of venom falling upon it's flesh, the demon managed to get the spider out from his back, and then they both locked stares, the Felhunter wanted to leave before, but the spider thought he would defend his master, the spider only wanted to eat as quick as possible, it couldn't let the prey scape, it couldn't let the felhunter help it. They both awaited for the first move of the other, but the demon grew impatient, the proud hound won't be beaten by a simple insect, he would strike and kill it as he had done against countless other creatures. He tackled, inserting his stings in the spider, attempting to drain it's power, but just as he did the spider lashed against him in madness, now a mortal insanity at the brink of death, fighting to survive, inserting her big fangs in the demonic creature's body, and unleashing all of the flesh disolving toxins in it, they both started to drain and feed upon each other, only one could win. The Felhunter hungered for magic and its magical tentacles were made for destroying magical energies, but the spider had hungered for months, it was starving, insane, and its venom was pure melting acid and it would drain all of the corrupted flesh, heart and brain of the Felhunter until there was nothing left, the Felhunter slowly knew it was his end, but, was it? The Felhunters are normally bound to the twisting nether, they are inmortal creatures, meant to serve the legion for eternity. But this end, in which they drained one another to death fused their souls, something never experienced, he would be bound in flesh and soul to the spider, fused, a sheer happiness filled the Felhunter soul, as his flesh united with the Spider and it started to mutate. No, he would no longer serve the Legion, nor would he serve his damn master once again, no, a vision filled it as his magic senses fused with the spider's senses, something more than a weak warlock or the Legion to serve, someone. As they fused the spider seemed to burn in black pitch shadow flames of red and purple, the vision, she had seen it as well, something to come, more than Felwood, something more than fragile weak preys.

    The human warlock in the hole listened the fight outside, as he tried to burn the web slowly with felfire, he thought his demonic minion would save him, but then when he was about to finally break free he saw it, no longer a spider, no longer a felhunter, but something else. Black like the night with straws of crimson red, irradiating in shadows, with its fang oozing dark purple fel flames and with four felstings ready to devour and shred. The creature looked at it, and it looked through it's eight eyes, and through them the felstalker could look too, looking at it's former master once again in a smile. A thought blazed through it, he was always envious of the mortal creatures, as they ate and digested and tasted the flesh of their preys, they delighted in them, but he could only delight in the magical energies, the taste of flesh, for which it was really incapable to really know was unfamiliar, even it's tongue could only taste magic, now a gift was granted for both of them, the spider and the demon, to know the taste of flesh and the taste of magic alike, and share it with each other. The warlock screamed in repeated agony and horror as the monstrous creature stabbed him and bit him, splattering blood all over the place, ah, the human felt terror, but Darkfang felt joy, while it attacked and devoured gleefully, knowing that no flesh, no magic, no bones and no damn soul could scape her hunger.

    They both the spider and the demon laughed inside and greeted each other souls, knowing they would get along really well.
     
    Last edited: Dec 6, 2017
  5. Kyrbi0

    Kyrbi0

    Joined:
    Jul 29, 2008
    Messages:
    7,913
    Resources:
    1
    Models:
    1
    Resources:
    1
    o_O

    Um, that is some schweet concept art.
    Is it Darkfang as in you?
     
  6. Darkfang

    Darkfang

    Joined:
    Jun 25, 2008
    Messages:
    1,717
    Resources:
    203
    Models:
    1
    Icons:
    186
    Skins:
    11
    Maps:
    3
    Tutorials:
    2
    Resources:
    203
    Yeap, It was suposed to be based on my avatar, my last avatar -that wasn't a Dark Ranger or my face- was an spider, and I wanted to give it some flavor. What do you think about the short story?
     
  7. Misha

    Misha

    Joined:
    Jun 9, 2008
    Messages:
    7,207
    Resources:
    71
    Models:
    62
    Icons:
    1
    Packs:
    2
    Skins:
    4
    StarCraft II Resources:
    2
    Resources:
    71
  8. Darkfang

    Darkfang

    Joined:
    Jun 25, 2008
    Messages:
    1,717
    Resources:
    203
    Models:
    1
    Icons:
    186
    Skins:
    11
    Maps:
    3
    Tutorials:
    2
    Resources:
    203
    That's the idea :3
     
  9. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,190
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Good, updated table.
     
  10. ~Nightmare

    ~Nightmare

    Joined:
    Jan 25, 2011
    Messages:
    2,106
    Resources:
    144
    Models:
    2
    Icons:
    111
    Packs:
    5
    Skins:
    26
    Resources:
    144
    Workflow.. still not final :p
     

    Attached Files:

  11. Kyrbi0

    Kyrbi0

    Joined:
    Jul 29, 2008
    Messages:
    7,913
    Resources:
    1
    Models:
    1
    Resources:
    1
    @IcemanBo
    I know the Rule "Submissions must not be started before the beginning of the Contest" technically does not allow for this, but I'm asking for a special exemption (that I may someday campaign for general inclusion in Contests going forward...): Can we be allowed to reuse simple, non-entry specific stuff from previous maps/Contests/etc (see below)?

    Basically, I'm hoping to copy/paste in basic tester functions (spawning the hero, refreshing cooldowns, spawning dummy allies & enemies for testing), as well as my little setup for Credits in the Quest Log, and the dozen triggers I have for spawning the hero, all from some old maps I've got (old Contest entries & stuff). It's not impossible to recreate, it's just sooo time consuming & I've had to rebuild from scratch sooo many times before. That kind of stuff.

    I promise I've made everything else from scratch, after Nov 10th. : )
     
  12. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,190
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Demo map is part of the entry, and so technically maybe also of the submission, but lol yes, sure, you may use any pre-made triggers to set up your demo map for the good. The demo code per se won't be judged anyways. Same would go for showcase dummies, quests, etc. So no worries!: ) The limitation is really only meant for your personal resource submission that you will upload in section.
     
  13. Kyrbi0

    Kyrbi0

    Joined:
    Jul 29, 2008
    Messages:
    7,913
    Resources:
    1
    Models:
    1
    Resources:
    1
    Well yeah. That's exactly how I started my post:
    ; )

    Vunderbar! Yeah, I knew/figured that was the case; it's been a Rule since as long as I can remember, one I've made sure was written explicitly in the Contests I've run/Hosted. : )

    Thinking ahead for future Contests, one thought is to simply state explicitly that contestants can do what I'm doing now.
    -However, that's tricky (requires honor code) & a challenge to consider all the things that should be covered.

    Even better would be to simply provide each Contestant exactly what they need: this could be as easy as preparing the chosen "base template" map (e.g. Turtle Rock) with testing functions, credit tabs, etc (we should already be giving them a base map anyway). It has the added benefit of standardization (highly prized in the more serious, skill-based Contests)
    -However, I'm not a big fan of giving the Host more work, and this is definitely non-trivial.

    Hmm.
     
  14. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,954
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    Well, here's WIP 1. Yes, my coding proccess is very disorganised :p

    Code (vJASS):

    library FactoryMode

        globals
     
            private constant real TIMEOUT = .03125
         
            unit FACTORY = null
            ExitPort FACTORY_EXIT = 0
            constant integer FACTORY_ON_CHARGE_UP        = 1
            constant integer FACTORY_ON_CHARGE_LIMIT     = 2
            constant integer FACTORY_ON_CHARGE_INTERVAL  = 3
         
            private trigger array EventTrig
            private hashtable PortsStorage = null
            private integer Factories = 0
            private FactoryMode array Factory
            private timer tmr = null
         
        endglobals
     
     
     
        private function FireTrigger takes integer ev, unit u, ExitPort port returns nothing
            set FACTORY = u
            set FACTORY_EXIT = port
            call TriggerEvaluate(EventTrig[ev])
            set FACTORY = null
            set FACTORY_EXIT = 0
        endfunction
     
        function RegisterFactoryEvent takes integer ev, code c returns nothing
            call TriggerAddCondition(EventTrig[ev], Condition(c))
        endfunction
     
     
     
        struct FactoryMode
     
            integer charges
            integer triggerThreshold
            integer limit
            real timeout
            real timeoutReset
            unit factory
         
            integer portsCount
         
            static method collectBiomass takes unit u returns nothing
         
            endmethod
         
            static method createTank takes integer tankType returns nothing
         
            endmethod
         
            static method getCharges takes FactoryMode this returns integer
                returns this.charges
            endmethod
         
            static method setCharges takes FactoryMode this, integer chargeCount returns nothing
                local integer i
                set this.charge = chargeCount
                set i = this.charge
                //Modify floating text
                if i >= this.triggerThreshold then
                    loop
                        set i = i - this.triggerThreshold
                        exitwhen i < this.triggerThreshold then
                        call FireTrigger(FACTORY_ON_CHARGE_UP, this.factory, port)
                    endloop
                endif
            endmethod
         
            private static method factoryInterval takes nothing returns nothing
                local integer i = 0
                local thistype this
                if Factories > 0 then
                    loop
                        set i = i + 1
                        exitwhen i > Factories
                        set this = Factory[i]
                        set this.timeout = this.timeout - TIMEOUT
                        if this.timeout <= 0. then
                            set this.timeout = this.timeoutReset
                            call FireTrigger(FACTORY_ON_CHARGE_INTERVAL, this.factory, port)
                        endif
                    endloop
                else
                    call DestroyTimer(tmr)
                endif
            endmethod
         
            static method create takes real interval, unit u, integer chargeTrigger, integer chargeLimit returns thistype
                local thistype this = allocate()
                set this.charges = 0
                set this.triggerThreshold = chargeTrigger
                set this.limit = chargeLimit
                set this.timeout = interval
                set this.timeoutReset = interval
                set this.factory = u
                set this.portsCount = 0
                set Factories = Factories + 1
                set Factory[Factories] = this
                if tmr == null then
                    set tmr = CreateTimer()
                    call TimerStart(tmr, TIMEOUT, true, function thistype.factoryInterval)
                endif
                return this
            endmethod
         
        endstruct
     
     
     
        struct ExitPort
         
            static method getNext takes FactoryMode f returns thistype
                return LoadInteger(PortsStorage, f, i)
            endmethod
         
            static method getSpecific takes FactoryMode f, integer i returns thistype
                return LoadInteger(PortsStorage, f, i)
            endmethod
         
            static method getRandom takes FactoryMode f returns thistype
                return LoadInteger(PortsStorage, f, GetRandomInt(1, f.portCount))
            endmethod
         
            static method create takes FactoryMode f, real x, real y, real z returns thistype
                local thistype port = allocate()
                set f.portsCount = f.portsCount + 1
                call SaveInteger(PortsStorage, f, f.portsCount, port)
                return port
            endmethod
         
        endstruct
     
     
     
    endlibrary
     
  15. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,190
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Ah ok nice!

    There are many WIPS still missing, by the way.
     
  16. ~Nightmare

    ~Nightmare

    Joined:
    Jan 25, 2011
    Messages:
    2,106
    Resources:
    144
    Models:
    2
    Icons:
    111
    Packs:
    5
    Skins:
    26
    Resources:
    144
  17. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,190
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Ok, thanks! Added.
     
  18. Just_Spectating

    Just_Spectating

    Joined:
    May 16, 2007
    Messages:
    7,023
    Resources:
    46
    Models:
    11
    Icons:
    9
    Skins:
    26
    Resources:
    46
    some of the base colors
     

    Attached Files:

  19. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,954
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    Been working on that all day. Still far from done, but here's my second WIP:
    Code (vJASS):

    library FactoryMode

        globals
       
            private constant real TIMEOUT = .03125
           
            unit FACTORY = null
            FactoryMode FACTORY_ID = 0
            constant integer FACTORY_ON_CHARGE_UP        = 1
            constant integer FACTORY_ON_CHARGE_LIMIT     = 2
            constant integer FACTORY_ON_CHARGE_INTERVAL  = 3
           
            private trigger array EventTrig
            private FactoryMode array Factory
           
            private hashtable PortsStorage = null
            private integer Factories = 0
            private timer tmr = null
           
        endglobals
       
       
       
        private function FireTrigger takes integer ev, unit u, FactoryMode f returns nothing
            set FACTORY = u
            set FACTORY_ID = f
            call TriggerEvaluate(EventTrig[ev])
            set FACTORY = null
            set FACTORY_ID = 0
        endfunction
       
        function RegisterFactoryEvent takes integer ev, code c returns nothing
            call TriggerAddCondition(EventTrig[ev], Condition(c))
        endfunction
       
       
       
        struct FactoryMode
       
            integer charges
            integer triggerThreshold
            integer limit
            integer slot
            real timeout
            real timeoutReset
            unit factory
           
            integer portsCount
           
            static method collectBiomass takes unit u returns nothing
           
            endmethod
           
            static method getCharges takes FactoryMode this returns integer
                return this.charges
            endmethod
           
            static method setCharges takes FactoryMode this, integer chargeCount returns nothing
                local integer i
                set this.charges = chargeCount
                set i = this.charges
                //Modify floating text
                if i >= this.triggerThreshold then
                    loop
                        set i = i - this.triggerThreshold
                        exitwhen i < this.triggerThreshold
                        call FireTrigger(FACTORY_ON_CHARGE_UP, this.factory, this)
                    endloop
                endif
            endmethod
           
            private static method factoryInterval takes nothing returns nothing
                local integer i = 0
                local thistype this
                if Factories > 0 then
                    loop
                        set i = i + 1
                        exitwhen i > Factories
                        set this = Factory[i]
                        set this.timeout = this.timeout - TIMEOUT
                        if this.timeout <= 0. then
                            set this.timeout = this.timeoutReset
                            call FireTrigger(FACTORY_ON_CHARGE_INTERVAL, this.factory, this)
                        endif
                    endloop
                else
                    call DestroyTimer(tmr)
                    set tmr = null
                endif
            endmethod
           
            private method destroy takes nothing returns nothing
                local integer i = 0
                local ExitPort port
                loop
                    set i = i + 1
                    exitwhen i > this.portsCount
                    set port = LoadInteger(PortsStorage, this, i)
                    call port.destroy()
                endloop
                call FlushChildHashtable(PortsStorage, this)
                set this.charges = 0
                set this.triggerThreshold = 0
                set this.limit = 0
                set this.slot = 0
                set this.timeout = 0.
                set this.timeoutReset = 0.
                set this.factory = null
                set this.portsCount = 0
                call this.deallocate()
            endmethod
           
            static method remove takes FactoryMode this returns nothing
                local integer i = this.slot
                local FactoryMode = nextF
                loop
                    set nextF = Factory[i + 1]
                    set Factory[i] = nextF
                    set nextF.slot = i
                    set i = i + 1
                    exitwhen i > Factories
                endloop
                set Factories = Factories - 1
                call this.destroy()
            endmethod
           
            static method create takes real interval, unit u, integer chargeTrigger, integer chargeLimit returns thistype
                local thistype this = allocate()
                set this.charges = 0
                set this.triggerThreshold = chargeTrigger
                set this.limit = chargeLimit
                set this.timeout = interval
                set this.timeoutReset = interval
                set this.factory = u
                set this.portsCount = 0
                set Factories = Factories + 1
                set Factory[Factories] = this
                set this.slot = Factories
                if tmr == null then
                    set tmr = CreateTimer()
                    call TimerStart(tmr, TIMEOUT, true, function thistype.factoryInterval)
                endif
                return this
            endmethod
           
            private static method onInit takes nothing returns nothing
                set EventTrig[FACTORY_ON_CHARGE_UP]         = CreateTrigger()
                set EventTrig[FACTORY_ON_CHARGE_INTERVAL]   = CreateTrigger()
            endmethod
           
        endstruct
       
       
       
        struct ExitPort
           
            real x
            real y
            real z
            real facing
            FactoryMode fId
           
            method destroy takes nothing returns nothing
                set this.x = 0.
                set this.y = 0.
                set this.z = 0.
                set this.facing = 0.
                set this.fId = 0
                call this.deallocate()
            endmethod
           
            static method remove takes FactoryMode f, integer portNumber returns nothing
                local integer i = portNumber
                local thistype port = LoadInteger(PortsStorage, f, i + 1)
                call port.destroy()
                loop
                    call RemoveSavedInteger(PortsStorage, f, i)
                    call SaveInteger(PortsStorage, f, i, LoadInteger(PortsStorage, f, i + 1))
                    set i = i + 1
                    exitwhen i > f.portsCount
                endloop
                set f.portsCount = f.portsCount - 1
            endmethod
           
            static method getPortX takes thistype port returns real
                return port.x
            endmethod
           
            static method getPortY takes thistype port returns real
                return port.y
            endmethod
           
            static method getPortZ takes thistype port returns real
                return port.z
            endmethod
           
            static method getPortFacing takes thistype port returns real
                return port.facing
            endmethod
           
            static method getPortFactory takes thistype port returns FactoryMode
                return port.fId
            endmethod
           
            static method getSpecific takes FactoryMode f, integer i returns thistype
                local thistype port = LoadInteger(PortsStorage, f, i)
                if port == 0 then
                    return LoadInteger(PortsStorage, f, f.portsCount)
                else
                    return LoadInteger(PortsStorage, f, i)
                endif
            endmethod
           
            static method getRandom takes FactoryMode f returns thistype
                return LoadInteger(PortsStorage, f, GetRandomInt(1, f.portsCount))
            endmethod
           
            static method createUnit takes thistype port, integer unitid returns nothing
                local unit u = CreateUnit(GetOwningPlayer(port.fId.factory), unitid, port.x, port.y, port.facing)
                local unit rallyU = GetUnitRallyUnit(port.fId.factory)
                local destructable rallyD = GetUnitRallyDestructable(port.fId.factory)
                local location loc
                call SetUnitFlyHeight(u, port.z, 0.)
                if rallyU != null then
                    if rallyU != port.fId.factory then
                        call IssueTargetOrderById(u, 851971, rallyU) //order smart
                    endif
                elseif rallyD != null then
                    call IssueTargetOrderById(u, 851971, rallyD) //order smart
                else
                    set loc = GetUnitRallyPoint(port.fId.factory)
                    call IssuePointOrderById(u, 851983, GetLocationX(loc), GetLocationY(loc)) //order attack
                    call RemoveLocation(loc)
                endif
                set u = null
                set rallyU = null
                set rallyD = null
            endmethod
           
            static method create takes FactoryMode f, real X, real Y, real Z, real angle returns thistype
                local thistype port = allocate()
                set port.x = X
                set port.y = Y
                set port.z = Z
                set port.facing = angle
                set port.fId = f
                set f.portsCount = f.portsCount + 1
                call SaveInteger(PortsStorage, f, f.portsCount, port)
                return port
            endmethod
           
        endstruct
       
       
       
    endlibrary
     
  20. Misha

    Misha

    Joined:
    Jun 9, 2008
    Messages:
    7,207
    Resources:
    71
    Models:
    62
    Icons:
    1
    Packs:
    2
    Skins:
    4
    StarCraft II Resources:
    2
    Resources:
    71
    so much code these days :wgrin:
     
Thread Status:
Not open for further replies.