Sliding System v3.4

This bundle is marked as approved. It works and satisfies the submission rules.
Sliding System v3.4


Info

Sliders can have a special sliding behaviour on different terrain types.
Each slider also can have it's own movement speed while sliding, seperated and indepentand from the terrain type.

This library provides various possibilities to create an individual behaviour for each terrain type. (Config - Part)

Requires (credits)

- Table (Bribe)

-
TimerUtils (Vexorian)

-
UnitIndexer (Nestharus)

-
WorldBounds(Nestharus)

-
Event(Nestharus)

Code
JASS:
library SlidingSystem/* v3.4    By IcemanBo

 */ requires /*

        */ UnitIndexer    /* The one in test map. (by Nestharus v4.0.2.6)
        */ TimerUtils     /* http://www.wc3c.net/showthread.php?t=101322
        */ Table          /* http://www.hiveworkshop.com/forums/jass-resources-412/snippet-new-table-188084/
        */ WorldBounds    /* https://github.com/nestharus/JASS/blob/master/jass/Systems/WorldBounds/script.j
        */ Event          /* The one in test map.


**                          Info
**                        ¯¯¯¯¯¯¯¯
**
**  Sliders can have a special sliding behaviour on different terrain types.
**  Each slider also can have it's own movement speed while sliding,
**  seperated and indepentand from the terrain type.
**
**  This library provides various possibilities
**  to create an individual behaviour for each terrain type. (Config - Part)
**   
**
**  Struct Terrain:
**
**
**      static method create takes integer terainType, real terrainSpeed returns thistype
**
**          Furthermore you can define and read these public members:
**          (by default all values are "0" or "false".
**
**          pullSpeed      = Unit will be constantly pulled with this speed. (real)
**          pullDirection  = Direction for pulling, in degrees. (real)
**          angle          = Angle that will be added, when steering. (real)
**          lifeAddition   = Life that will be added each second. Negagtive values are also possible. (real)
**          allowSteer     = If unit can steer on the tarrainType or not. (boolean)
**          allowCast      = If unit can cast on the terrainType or not. (boolean)
**          kill           = Kill the unit on the terrainType or not. (boolean)
**          
**
**    You can have a look into folder TestMap -> "Terrain Settings" for a better understanding and examples.
**
**
**  Struct Slider:
**
**
**      static methods:
**     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
**
**          static method create takes unit u returns thistype
**
**          static method getSliderId takes unit u returns thistype
**
**          static method isUnitSlider takes unit u returns boolean
**
**
**
**      methods:
**     ¯¯¯¯¯¯¯¯¯¯
**
**          method destroy takes nothing returns nothing
**
**          method enable takes boolean b returns nothing   (disabled instance can't slide)
**             
**          method isEnabled takes nothing returns boolean
**
**          method getDefaultSpeed takes nothing returns real
**
**          method getTempSpeed takes nothing returns real
**
**          method setDefaultSpeed takes real s returns nothing
** 
**          method addDefaultSpeed takes real s returns nothing
**
**          method addTempSpeed takes real speed, real duration returns nothing
**
**
**
**    Deindexed units will be automatically removed from system.
**    You can have a look into folder TestMap -> "Create Slider" for a better understanding and examples.
**
***************************************************************************
**
**  Credits to guys named in brackets.
**
**  Requires:
**      - Table (Bribe)
**      - TimerUtils (Vexorian)
**      - UnitIndexer (Nestharus)
**          • WorldBounds (Nestharus)
**          • Event (Nestharus)
**
**
**************************************************************************
*
*
************************  Configuration - Start ***************************/

    globals
   
        private constant boolean SLIDER_UNCLICKABLE    = true    // Make Slider unclickable.
        private constant boolean SLIDER_NO_PATHING     = true    // Disable pathing for Slider.
        private constant boolean CHECK_PATHING         = false   // Check for pathability while sliding.
       
       
/************************ Configuration - End *****************************/

       
        private constant real INTERVAL     = .03              // Sliding looks smoother smoother with .03 instead of 0.312500.
        private constant real TPS          = 1/INTERVAL       // Operation threads per second
        private trigger steerTrigger       = CreateTrigger()
        private trigger moveTrigger        = CreateTrigger()  // Sliding looks smoother with trigger instead of a timer.
        private constant integer SMART     = 851971
        private constant integer STOP      = 851972
        private constant integer PATROL    = 851990
        private constant integer MOVE      = 851986
                                       
    endglobals
   
    /*
    *   Terrain struct, to define sliding behaviour.
    */
   
    struct Terrain
        private static key k
        private static Table table = k
       
        private integer terrainType
       
        real speed
        real pullSpeed = 0
        real pullDirection = 0
        real angle = 0
        real lifeAddition = 0
        boolean allowSteer = false
        boolean allowCast = false
        boolean kill = false
       
        static method create takes integer whichTerrain, real whichSpeed returns thistype
            local thistype this = thistype.allocate()
            set thistype.table[whichTerrain] = this
            set this.terrainType = whichTerrain
            set this.speed = whichSpeed/TPS
            return this
        endmethod
        static method operator [] takes integer i returns thistype
            return thistype.table[i]
        endmethod
    endstruct

    /*
    *   Acceleration struct, to manipulate Slider's temporary speed
    */
   
    private struct Acceleration
        public timer tim
        public real speedChange
        public Slider instance
       
        static method create takes Slider slider, real speed returns thistype
            local thistype this = thistype.allocate()
            set this.instance = slider
            set this.speedChange = speed
            return this
        endmethod
       
        method destroy takes nothing returns nothing
            call this.deallocate()
            call ReleaseTimer(tim)
        endmethod
    endstruct
   
    /*
    *   Slider struct (main code)
    */

    struct Slider
       
       
        private static thistype array list
        private static boolean  array is    // Is unit a slider
       
        private unit slider
        public real defaultSpeed  //  Permanent speed
        public real bonusSpeed    //  Temporary speed
       
        private real propWindow
        private real turnSpeed
       
        private boolean enabled   // If slider is currently enabled.
       
        private thistype prev
        private thistype next
        static thistype first = 0
       
        static method create takes unit u returns thistype
            local thistype this
            local integer index = GetUnitUserData(u)
           
            if (isUnitSlider(u)) then
                debug call BJDebugMsg("Error -  Sliding System - create: " + GetUnitName(u) + ", Index[" + I2S(index) + "] is already a Slider." )
                return 0
            endif
           
            set this = thistype.allocate()
           
            set this.slider = u
            set thistype.list[index] = this
            set this.is[index] = true
            set this.enabled = true
           
            set this.propWindow = GetUnitDefaultPropWindow(slider)*bj_RADTODEG
            set this.turnSpeed  = GetUnitDefaultTurnSpeed(slider)
   
            static if (SLIDER_UNCLICKABLE) then
                call UnitAddAbility(u,'Aloc')
                call ShowUnit(u,false)
                call ShowUnit(u,true)
                call UnitRemoveAbility(u,'Aloc')
            endif
           
            static if (SLIDE_NO_PATHING) then
                call SetUnitPathing( u, false )
            endif
           
            if (thistype.first == 0) then
                call EnableTrigger(moveTrigger)
            endif
           
            set this.next = thistype.first
            set thistype.first.prev = this
            set thistype.first = this
            set this.prev = 0
           
            return this
        endmethod
       
        method destroy takes nothing returns nothing
            local integer index = GetUnitUserData(slider)
            call this.deallocate()           
            set thistype.list[index] = 0
            set this.is[index] = false
            set this.slider = null
           
            if (this == thistype.first) then
                set thistype.first = this.next
            endif
            set this.next.prev = this.prev
            set this.prev.next = this.next
            if (thistype.first == 0) then
                call DisableTrigger(moveTrigger)
            endif
        endmethod
       
        /*
        *   Sliding - Movement  (periodic call)
        */
       
        private static method onMove takes nothing returns nothing
            local real angle
            local real offset
            local real x
            local real y
            local integer terrainType
            local thistype this = thistype.first
           
            loop
               
                exitwhen this == 0
               
                if enabled then
                   
                    set x = GetUnitX(slider)
                    set y = GetUnitY(slider)
                   
                    set terrainType = GetTerrainType(x, y)
                   
                    // Check if slider is on a registered terrain type.
                    if (Terrain[terrainType] != 0) then
                       
                        if (Terrain[terrainType].kill) then
                            call KillUnit(slider)
                        else
                            set angle = (GetUnitFacing(slider)*bj_DEGTORAD)
                            set offset = defaultSpeed + bonusSpeed + Terrain[terrainType].speed
                           
                            //  Heal/damage the slider.
                            call SetWidgetLife(slider,GetWidgetLife(slider) + Terrain[terrainType].lifeAddition/TPS)
                           
                            set x = x + offset * Cos(angle)
                            set y = y + offset * Sin(angle)
                           
                            //  Sliding
                            static if (CHECK_PATHING) then
                                call SetUnitPosition(slider, x, y)
                            else
                                call SetUnitX(slider, x)
                                call SetUnitY(slider, y)
                            endif
                           
                            //  Check if terrain type is pulling.
                            if (Terrain[terrainType].pullSpeed != 0) then
                                static if (CHECK_PATHING) then
                                    call SetUnitPosition(slider, x + (Terrain[terrainType].pullSpeed/TPS) * Cos(Terrain[terrainType].pullDirection*bj_DEGTORAD), y + (Terrain[terrainType].pullSpeed/TPS) * Sin(Terrain[terrainType].pullDirection*bj_DEGTORAD))
                                else
                                    call SetUnitX(slider, x + (Terrain[terrainType].pullSpeed/TPS) * Cos(Terrain[terrainType].pullDirection*bj_DEGTORAD))
                                    call SetUnitY(slider, y + (Terrain[terrainType].pullSpeed/TPS) * Sin(Terrain[terrainType].pullDirection*bj_DEGTORAD))
                                endif
                            endif
                           
                            // Make slider unmoveable while sliding.
                            call SetUnitPropWindow(slider, 0)
                            call SetUnitTurnSpeed(slider, 0.00)
                           
                        endif
                    else
                        // Make slider moveable.
                        call SetUnitPropWindow(slider,  propWindow )
                        call SetUnitTurnSpeed(slider, turnSpeed)
                    endif
                endif
               
                set this = next
            endloop
        endmethod
       
        /*
        *   Sliding - Steering
        */
       
        private static method onTurn takes nothing returns boolean
            local unit u = GetTriggerUnit()
            local real x
            local real y
            local integer terrainType
            local integer order = GetIssuedOrderId()
            local boolean b = true

            if (isUnitSlider(u) and list[GetUnitUserData(u)].enabled) then
                set x = GetUnitX(u)
                set y = GetUnitY(u)
               
                set terrainType = GetTerrainType(x, y)
               
                // Check if slider is on a registered terrain type.
                if (Terrain[terrainType] != 0) then
                   
                    if( (order == SMART) and (Terrain[terrainType].allowSteer)) then
                        // Let the slider turn.
                        call SetUnitFacing( u, (Atan2(GetOrderPointY() - y , GetOrderPointX() - x) * bj_RADTODEG) + Terrain[terrainType].angle)
                       
                    elseif ((order != SMART) and (order != MOVE) and (order != PATROL) and (Terrain[terrainType].allowCast)) then
                        // The slider is casting an ability. Let him face wanted position, if allowed.
                        call SetUnitFacing( u, Atan2(GetOrderPointY() - y , GetOrderPointX() - x) * bj_RADTODEG)
                        set b = false
                    endif
                   
                    if ((order == SMART) or (order == MOVE) or (order == PATROL) or (b)) then
                        call DisableTrigger( steerTrigger )
                        call PauseUnit (u,true)
                        call IssueImmediateOrderById(u, STOP)   // That will abbort unit's order if unit is not casting.
                        call PauseUnit (u,false)
                        call EnableTrigger( steerTrigger )
                    endif
                endif
            endif
           
            set u = null
            return false
        endmethod
       
       // API - Start
       
        static method getSliderId takes unit u returns thistype
            return list[GetUnitUserData(u)]
        endmethod
       
        static method isUnitSlider takes unit u returns boolean
            return is[GetUnitUserData(u)]
        endmethod
       
        method enable takes boolean b returns nothing
            set enabled = b
        endmethod
       
        method isEnabled takes nothing returns boolean
            return enabled
        endmethod
       
        method getDefaultSpeed takes nothing returns real
            return defaultSpeed*TPS
        endmethod
       
        method getTempSpeed takes nothing returns real
            return bonusSpeed*TPS
        endmethod
       
        /*   Permanent Boost   */
       
        method setDefaultSpeed takes real s returns nothing
            set defaultSpeed = s/TPS
        endmethod
       
        method addDefaultSpeed takes real s returns nothing
            set defaultSpeed = defaultSpeed + s/TPS
        endmethod
       
        /*  Temporary Boost  */
       
        private static method callback takes nothing returns nothing
            local Acceleration this = GetTimerData(GetExpiredTimer())
            set this.instance.bonusSpeed = this.instance.bonusSpeed - this.speedChange
            call this.destroy()
        endmethod
       
        method addTempSpeed takes real speed, real duration returns nothing
            local integer handleId
            local Acceleration newData
           
            if duration > 0 then
                set speed = speed/TPS
                set bonusSpeed = bonusSpeed + speed
                set newData = Acceleration.create(this, speed)
                set newData.tim = NewTimerEx(newData)
                call TimerStart(newData.tim, duration, false, function thistype.callback)
            else
                debug call BJDebugMsg("Error -  Sliding System - AddTempSpeed:  Duration must be greater 0.")
            endif
           
        endmethod
       
        // API - End
       
        private static method onDeindex takes nothing returns boolean
            if (thistype.isUnitSlider(GetIndexedUnit())) then
                call thistype.getSliderId(GetIndexedUnit()).destroy()
            endif
            return false
        endmethod

        private static method onInit takes nothing returns nothing
            call TriggerRegisterAnyUnitEventBJ( steerTrigger, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
            call TriggerAddCondition(steerTrigger, Condition(function thistype.onTurn))
            call TriggerRegisterTimerEvent(moveTrigger, INTERVAL, true)
            call TriggerAddAction(moveTrigger, function thistype.onMove)
            call DisableTrigger(moveTrigger)
            call RegisterUnitIndexEvent(Condition(function thistype.onDeindex), UnitIndexer.DEINDEX)
        endmethod
    endstruct
endlibrary

Have a look into TestMap folder. It contains examples how to use the system.

JASS:
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= Terrain Type Constants by Darthfett =-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-= Thanks to Romek for the Raw Codes  -=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

scope LORDAERONSUMMER
// Lordaeron Summer
globals
    public constant integer DIRT = 'Ldrt'
    public constant integer ROUGH_DIRT = 'Ldro'
    public constant integer GRASSY_DIRT = 'Ldrg'
    public constant integer ROCK = 'Lrok'
    public constant integer GRASS = 'Lgrs'
    public constant integer DARK_GRASS = 'Lgrd'
    public constant integer DIRT_CLIFF = 'cLc2'
    public constant integer GRASS_CLIFF = 'cLc1'
endglobals

endscope

scope LORDAERONFALL
// Lordaeron Fall
globals
    public constant integer DIRT = 'Fdrt'
    public constant integer ROUGH_DIRT = 'Fdro'
    public constant integer GRASSY_DIRT = 'Fdrg'
    public constant integer ROCK = 'Frok'
    public constant integer GRASS = 'Fgrs'
    public constant integer DARK_GRASS = 'Fgrd'
    public constant integer DIRT_CLIFF = 'cFc2'
    public constant integer GRASS_CLIFF = 'cFc1'
endglobals

endscope

scope LORDAERONWINTER
// Lordaeron Winter
globals
    public constant integer DIRT = 'Wdrt'
    public constant integer ROUGH_DIRT = 'Wdro'
    public constant integer GRASSY_SNOW = 'Wsng'
    public constant integer ROCK = 'Wrok'
    public constant integer GRASS = 'Wgrs'
    public constant integer SNOW = 'Wsnw'
    public constant integer GRASS_CLIFF = 'cWc2'
    public constant integer SNOW_CLIFF = 'cWc1'
endglobals

endscope

scope BARRENS
// Barrens
globals
    public constant integer DIRT = 'Bdrt'
    public constant integer ROUGH_DIRT = 'Bdrh'
    public constant integer PEBBLES = 'Bdrr'
    public constant integer GRASSY_DIRT = 'Bdrg'
    public constant integer DESERT = 'Bdsr'
    public constant integer DARK_DESERT = 'Bdsd'
    public constant integer ROCK = 'Bflr'
    public constant integer GRASS = 'Bgrr'
    public constant integer DESERT_CLIFF = 'cBc2'
    public constant integer GRASS_CLIFF = 'cBc1'
endglobals

endscope

scope ASHENVALE
// Ashenvale
globals
    public constant integer DIRT = 'Adrt'
    public constant integer ROUGH_DIRT = 'Adrd'
    public constant integer GRASS = 'Agrs'
    public constant integer ROCK = 'Arck'
    public constant integer LUMPY_GRASS = 'Agrd'
    public constant integer VINES = 'Avin'
    public constant integer GRASSY_DIRT = 'Adrg'
    public constant integer LEAVES = 'Alvd'
    public constant integer DIRT_CLIFF = 'cAc2'
    public constant integer GRASS_CLIFF = 'cAc1'
endglobals

endscope

scope FELWOOD
// Felwood
globals
    public constant integer DIRT = 'Cdrt'
    public constant integer ROUGH_DIRT = 'Cdrd'
    public constant integer POISON = 'Cpos'
    public constant integer ROCK = 'Crck'
    public constant integer VINES = 'Cvin'
    public constant integer GRASS = 'Cgrs'
    public constant integer LEAVES = 'Clvg'
    public constant integer DIRT_CLIFF = 'cCc2'
    public constant integer GRASS_CLIFF = 'cCc1'
endglobals

endscope

scope NORTHREND
// Northrend
globals
    public constant integer DIRT = 'Ndrt'
    public constant integer DARK_DIRT = 'Ndrd'
    public constant integer ROCK = 'Nrck'
    public constant integer GRASS = 'Ngrs'
    public constant integer ICE = 'Nice'
    public constant integer SNOW = 'Nsnw'
    public constant integer ROCKY_SNOW = 'Nsnr'
    public constant integer DIRT_CLIFF = 'cNc2'
    public constant integer SNOW_CLIFF = 'cNc1'
endglobals

endscope

scope CITYSCAPE
// Cityscape
globals
    public constant integer DIRT = 'Ydrt'
    public constant integer ROUGH_DIRT = 'Ydtr'
    public constant integer BLACK_MARBLE = 'Yblm'
    public constant integer BRICK = 'Ybtl'
    public constant integer SQUARE_TILES = 'Ysqd'
    public constant integer ROUND_TILES = 'Yrtl'
    public constant integer GRASS = 'Ygsb'
    public constant integer GRASS_TRIM = 'Yhdg'
    public constant integer WHITE_MARBLE = 'Ywmb'
    public constant integer DIRT_CLIFF = 'cYc2'
    public constant integer SQUARE_TILES_CLIFF = 'cYc1'
endglobals

endscope

scope VILLAGE
// Village
globals
    public constant integer DIRT = 'Vdrt'
    public constant integer ROUGH_DIRT = 'Vdrr'
    public constant integer CROPS = 'Vcrp'
    public constant integer COBBLE_PATH = 'Vcbp'
    public constant integer STONE_PATH = 'Vstp'
    public constant integer SHORT_GRASS = 'Vgrs'
    public constant integer ROCKS = 'Vrck'
    public constant integer THICK_GRASS = 'Vgrt'
    public constant integer DIRT_CLIFF = 'cVc2'
    public constant integer GRASS_THICK_CLIFF = 'cVc1'
endglobals

endscope

scope VILLAGEFALL
// Village Fall
globals
    public constant integer DIRT = 'Qdrt'
    public constant integer ROUGH_DIRT = 'Qdrr'
    public constant integer CROPS = 'Qcrp'
    public constant integer COBBLE_PATH = 'Qcbp'
    public constant integer STONE_PATH = 'Qstp'
    public constant integer SHORT_GRASS = 'Qgrs'
    public constant integer ROCKS = 'Qrck'
    public constant integer THICK_GRASS = 'Qgrt'
    public constant integer DIRT_CLIFF = 'cQc2'
    public constant integer GRASS_THICK_CLIFF = 'cQc1'
endglobals

endscope

scope DALARAN
// Dalaran
globals
    public constant integer DIRT = 'Xdrt'
    public constant integer ROUGH_DIRT = 'Xdtr'
    public constant integer BLACK_MARBLE = 'Xblm'
    public constant integer BRICK_TILES = 'Xbtl'
    public constant integer SQUARE_TILES = 'Xsqd'
    public constant integer ROUND_TILES = 'Xrtl'
    public constant integer GRASS = 'Xgsb'
    public constant integer TRIM_GRASS = 'Xhdg'
    public constant integer WHITE_MARBLE = 'Xwmb'
    public constant integer DIRT_CLIFF = 'cXc2'
    public constant integer SQUARE_TILES_CLIFF = 'cXc1'
endglobals

endscope

scope DUNGEON
// Dungeon
globals
    public constant integer DIRT = 'Ddrt'
    public constant integer BRICK = 'Dbrk'
    public constant integer RED_STONES = 'Drds'
    public constant integer LAVA_CRACKS = 'Dlvc'
    public constant integer LAVA = 'Dlav'
    public constant integer DARK_ROCKS = 'Ddkr'
    public constant integer GREY_STONES = 'Dgrs'
    public constant integer SQUARE_TILES = 'Dsqd'
    public constant integer DIRT_CLIFF = 'cDc2'
    public constant integer SQUARE_TILES_CLIFF = 'cDc1'
endglobals

endscope

scope UNDERGROUND
// Underground
globals
    public constant integer DIRT = 'Gdrt'
    public constant integer BRICK = 'Gbrk'
    public constant integer RED_STONES = 'Grds'
    public constant integer LAVA_CRACKS = 'Glvc'
    public constant integer LAVA = 'Glav'
    public constant integer DARK_ROCKS = 'Gdkr'
    public constant integer GREY_STONES = 'Ggrs'
    public constant integer SQUARE_TILES = 'Gsqd'
    public constant integer DIRT_CLIFF = 'cGc2'
    public constant integer SQUARE_TILES_CLIFF = 'cGc1'
endglobals

endscope

scope SUNKENRUINS
// Sunken Ruins
globals
    public constant integer DIRT = 'Zdrt'
    public constant integer ROUGH_DIRT = 'Zdtr'
    public constant integer GRASSY_DIRT = 'Zdrg'
    public constant integer SMALL_BRICKS = 'Zbks'
    public constant integer SAND = 'Zsan'
    public constant integer LARGE_BRICKS = 'Zbkl'
    public constant integer ROUND_TILES = 'Ztil'
    public constant integer GRASS = 'Zgrs'
    public constant integer DARK_GRASS = 'Zvin'
    public constant integer DIRT_CLIFF = 'cZc2'
    public constant integer LARGE_BRICKS_CLIFF = 'cZc1'
endglobals

endscope

scope ICECROWNGLACIER
// Icecrown Glacier
globals
    public constant integer DIRT = 'Idrt'
    public constant integer ROUGH_DIRT = 'Idtr'
    public constant integer DARK_ICE = 'Idki'
    public constant integer BLACK_BRICKS = 'Ibkb'
    public constant integer RUNE_BRICKS = 'Irbk'
    public constant integer TILED_BRICKS = 'Itbk'
    public constant integer ICE = 'Iice'
    public constant integer BLACK_SQUARES = 'Ibsq'
    public constant integer SNOW = 'Isnw'
    public constant integer RUNE_BRICKS_CLIFF = 'cIc2'
    public constant integer SNOW_CLIFF = 'cIc1'
endglobals

endscope

scope OUTLAND
// Outland
globals
    public constant integer DIRT = 'Odrt'
    public constant integer LIGHT_DIRT = 'Odtr'
    public constant integer ROUGH_DIRT = 'Osmb'
    public constant integer CRACKED_DIRT = 'Ofst'
    public constant integer FLAT_STONES = 'Olgb'
    public constant integer ROCK = 'Orok'
    public constant integer LIGHT_FLAT_STONES = 'Ofsl'
    public constant integer ABYSS = 'Oaby'
    public constant integer ABYSS_CLIFF = 'cOc1'
    public constant integer ROUGH_DIRT_CLIFF = 'cOc2'
endglobals

endscope

scope BLACKCITADEL
// Black Citadel
globals
    public constant integer DIRT = 'Kdrt'
    public constant integer LIGHT_DIRT = 'Kfsl'
    public constant integer ROUGH_DIRT = 'Kdtr'
    public constant integer FLAT_STONES = 'Kfst'
    public constant integer SMALL_BRICKS = 'Ksmb'
    public constant integer LARGE_BRICKS = 'Klgb'
    public constant integer SQUARE_TILES = 'Ksqt'
    public constant integer DARK_TILES = 'Kdkt'
    public constant integer DIRT_CLIFF = 'cKc1'
    public constant integer DARK_TILES_CLIFF = 'cKc2'
endglobals

endscope

scope DALARANRUINS
// Dalaran Ruins
globals
    public constant integer DIRT = 'Jdrt'
    public constant integer ROUGH_DIRT = 'Jdtr'
    public constant integer BLACK_MARBLE =  'Jblm'
    public constant integer BRICK_TILES = 'Jbtl'
    public constant integer SQUARE_TILES = 'Jsqd'
    public constant integer ROUND_TILES = 'Jrtl'
    public constant integer GRASS = 'Jgsb'
    public constant integer TRIM_GRASS = 'Jhdg'
    public constant integer WHITE_MARBLE = 'Jwmb'
    public constant integer DIRT_CLIFF = 'cJc2'
    public constant integer SQUARE_TILES_CLIFF = 'cJc1'
endglobals

endscope

Changelog


v3.3
- Just some cleaning.
v3.2
- Enable/disable a slider is now possible.
v3.1
- API methods changed into public functions for easier usage.
v3.0
- Everything is rewritten, using vJass. (structs)
- "Pull" feature added for terrain configuration.
- Many API changes.
v2.5
- API added
- new function AddSpeed added (whichunit, speed, duration)
v2.4a
- unimportant cosmetic changes
v2.4
- now the code is in JASS, but still GUI configuration
v2.3
- trigger optimization
- Changed description
- few variable name changes
v2.2
- new feature: sliding can heal/damage the slider (depending on terrain type)
v2.1c
- restrctured GSS Addtive
- simplified example add/remove slider
v2.1b
- added AddSupport trigger
v2.1a(Approved)
- removed a location leak in Slide Steer
- "issued order" in Slide Steer stored into variable
v2.1(Needs fix)
- possibility to check pathing while sliding
- removed one not needed location in Slide Steer
v2.0a
- unit's angle is reset now with RADTODEG
- New additive trigger added, how to read out values
v2.0
- combined both sliding systems into one
- new system is MUI, and easy manipulation of specific speed is possible
- demo map improved
v1.3
- removed useless line in slide steer
- description changed a bit
v1.2b
- usuage of hashtable to find matching terrain type, instead of looping (thx to chobibo, suggested by Maker)
- few code improvements
- documentation improvements
v1.2a
- fixed bug with CasterGroup (sorry I forgot to initializise them)
- new feature: AllowCasting (for each terraintype configurable)
v1.2
- new debug methode in Slide-Steer trigger via locals
- new configuration available: CasterGroup & Tile-CastTurning
v1.1c
- Slide code simplified via locals (GSS1)
v1.1b
- fixed bug at deindex in GSS1
- little slide bug fixed
v1.1a
- In GSS1 changed to dynamic looping
- Loop ends after have found matching tile
- Sliding: Order 'stop' replaced by changing Unit's PropWindow/TurnSpeed
- Index of kill-terrain is no constant anymore
- Tiny other changes that aren't worth to be noted
v1.1(Approved)
- replaced 'move unit instantly' by Set unit X/Y
- terrain types are now more flexible with specific speed & turning angle
- moved all unnecessary stuff out of the system
- system 1 now also supports non-heroes
- system 1 now supports 12 players
- terrain types are no longer set with 'Centre of Region' - but with preset
- code improvement
v1.0 - release


Keywords:
Sliding, System, Ice, Skating, Escape, IcemanBo, clan null, null, nullSkill, MUI Movement, snow, area
Contents

Sliding System (Map)

Reviews
BPower: Re-approved after code update. Ralle: set back to pending by request. Bribe: Re-approved. Bribe: Custom script: call SetUnitFacingTimed( u, ( AngleBetweenPoints(Location(GetUnitX(u), GetUnitY(u)), udg_Point2) +...

Moderator

M

Moderator

BPower: Re-approved after code update.

Ralle: set back to pending by request.

Bribe:

Re-approved.

Bribe:

Custom script: call SetUnitFacingTimed( u, ( AngleBetweenPoints(Location(GetUnitX(u), GetUnitY(u)), udg_Point2) + udg_GSS_Terrain_Angle[udg_GSS_TempInteger_2] ), 0 )

^ this line leaks the Location created by the unit X and y. I will need you to correct this for it to be approved again.

Reviewed by Maker, Sliding System v1.1, 26th Nov 2013

  • With a hashtable you could avoid looping through all tiles
  • SetUnitPropWindow might prove to be better than spamming stop order
  • You need to set point2 only if you change the facing
  • Use skip remaining actions when the correct tile has been foun
    No need to loop the ohters after that
 
Level 19
Joined
Jul 31, 2012
Messages
2,217

First Take

Review

Suggestions

Rating

Judgement

Note

This thing actually Works! and without any bugs! it is really Great!
I'll only note something, but not minor..
You should separate testing's actions from the main system, and make the system a lot more clear to understand
Dunno, none till now
225233-albums6523-picture74071.jpg
225233-albums6523-picture74105.jpg
If You want me to review an Update of This Spell, Please Notify me this by VM or PM
 
Level 22
Joined
Sep 24, 2005
Messages
4,820
It doesn't play the unit's animation, you'll have to explicitly play the animation yourself. It just doesn't interrupt the unit's orders, and provides no pathing check so it might be troublesome. I agree though, to use coordinates, since they are reals.
 
Level 19
Joined
Jul 31, 2012
Messages
2,217
If you actually can 'slide' on ICE, there is no friction from the ground, and so you move without the need of movin your feet, so a moving object entering an ice area will not need to 'move' so not enabling the move animation gives the system a great realistic effect
 
Review of [GUI] Sliding System v1.0
I don't usually review spells and I can't comment of trigger efficiency (i.e. SetUnit x/y or not), but this system is very fun and could support a wide variety of game types. I think its a great resource to share. It works well and feels very real. I have to say I like they way it looks when a unit hits the ice and stops walking animation. It feels very real. However, as a compromise (and downloading users can add this easy enough) maybe the unit should play 1 second of walk animation every time the player clicks, that way like a ice skater, the unit will slide in one direction then take one step to turn or change directions. Just a thought. I love how the feel of motion is so different from wcIII and I hope to see more unique movement systems here in the future. Great work Icemanbo + rep! 5/5
 
Level 12
Joined
Mar 24, 2013
Messages
1,105
Coordinates would make a pretty big difference for this things efficiency so I think it should be changed. If people are dead set on the stand animation. Then just queue animation. Who knows maybe in a sliding map you want to add a blink, you wont be able to blink if you're moving a unit to a point because if by chance the blink does go off, it wont be on cooldown.

This could be quite useful to some people! +rep IceBo
 
@Jad,
thx for review... additional trigger are easy to remove, but yes maybe I should seperate them from main system by default. Could you please tell me what exactly you mean with "hard to understand" that I can improve my description :wink:
_____________________________________________________

use SetUnitX/Y instead of moving unit into point. it's lagless, better, and shows unit move animation..
Yes I know about reals, and that I could use them instead locations... but really not because of lags. I dont really think you had lags while testing it, and you wont ever have some, if you clean them up properly.
But anyway, I will think about it to change it in next version, thx ;)
Animation: I agree with chobibo and Jad... I don't want unit's move animation while sliding, sorry

why don't you use presets for terrain type variables?
  • Set GSS_Terrain[1] = Icecrown Glacier - Ice
I think people can better change to their own terrain types, if I use regions.
For example if you don't want to use my default terrain types, you would have to search for your ones in that list first, instead of just moving a region.
_____________________________________________________

@LegalEase's review,
very big thx, it also was an intent to make it very simple, that also beginners maybe can use it properly.
I don't see much sense to make very complexe GUI-triggers that only advanced users are able to use, if it could be a simple one.
I think I got your idea of short movement animation, I will think about it, thx. :wink:
_____________________________________________________


@pOke,
reals, I know... will maybe change it in next :D
yes moving instantly does interrupt unit's order immediatly, Set x/y would not
thx for rep :thumbs_up:
 
Regions are limited by shape. I would have to create multiple regions for a zigzag line. Preset terrain types makes setting up ice types easier for the user. The user would not need to create several regions for the same terrain type.

Then again, default terrain types cannot change easily and suddenly in game for ice type manipulation.

Anyway, you did code the system, so whatever floats your boat.

Oh yeah, I forgot to ask this: Why cannot you combine the benefits of both systems into one?
 
Last edited:
Regions are limited by shape. I would have to create multiple regions for a zigzag line. Preset terrain types makes setting up ice types easier for the user. The user would not need to create several regions for the same terrain type.

Then again, default terrain types cannot change easily and suddenly in game for ice type manipulation.

Anyway, you did code the system, so whatever floats your boat.

Oh yeah, I forgot to ask this: Why cannot you combine the benefits of both systems into one?
I dont understand anything, but that you want me to merge these 2 systems.

1st system is very map specific and players should only use it if sliders are treaten like player-specific heroes, and they wont change much in game.

2nd system maybe fits to more maps, because you can just add/remove any units you want to your group

And to rest, could you please explain more what you exactly mean with zigzag lines and that I need severeal regions for one terrain type?
 
Level 17
Joined
Aug 13, 2013
Messages
1,680
Review

Review


[GUI] Sliding System v1.0
This spell/system had been reviewed by jakeZinc
http://www.hiveworkshop.com/forums/members/jakezinc/#visitor_messaging

Trigger Code
  • -------- |ZZZZZZZZZZZZZZZZZZZZZZZZZ| --------
  • -------- Following actions only set the different terrain tpyes. --------
  • Set Point = (Center of Normal Ice <gen>)
  • Floating Text - Create floating text that reads Normal Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[1] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of NoTurn Ice <gen>)
  • Floating Text - Create floating text that reads No-Turning Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[2] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Reverse Ice <gen>)
  • Floating Text - Create floating text that reads Reverse Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[3] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Speed Ice <gen>)
  • Floating Text - Create floating text that reads Speed Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[4] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Slow Reverse Ice <gen>)
  • Set GSS_Terrain[5] = (Terrain type at Point)
  • Floating Text - Create floating text that reads Slow Reverse at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Killer Terrain <gen>)
  • Floating Text - Create floating text that reads Killer Terrain at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[6] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • -------- |ZZZZZZZZZZZZZZZZZZZZZZZZZ| --------
^ Inefficient, slow and long action code. You can use Looping instead of these stuffs and it is faster, easier and neat code.
  • Unit - Move GSS1_Slider[GSS_TmpInteger] instantly to Point2
^ Use call SetUnitX/Y Functions than this because it will not generate lags, avoids pathing and ignores collision size. SetUnitPropWindow.
  • Set Point = (Position of (Triggering unit))
^Use cached unit variable in this or make a variable in the triggering unit because you used it twice.
  • Unit - A unit Dies
    • Conditions
    • ((Triggering unit) is A Hero) Equal to True
    • Actions
    • -------- Just automaticlly revives hero. // for test --------
    • Wait 1.00 seconds
    • Set GSS_TmpPlayer = (Owner of (Triggering unit))
    • Hero - Instantly revive (Triggering unit) at GSS_Spawn, Hide revival graphics
    • Selection - Select (Triggering unit) for GSS_TmpPlayer
    • Camera - Pan camera for GSS_TmpPlayer to GSS_Spawn over 1.50 seconds
    • -------- After death the collosion gets reset. So we have to set it to 0 again. --------
    • Unit - Turn collision for (Triggering unit) Off
^ Not MUI nor MPI and it gives inefficient triggering. Don't use waits and again: Cached triggering unit pls.
  • Set GSS_TmpPlayer = (Owner of (Triggering unit))
You can just use Triggering Player() than this.
Same in this:
  • Set GSS_TmpInteger = (Player number of (Owner of (Triggering unit)))
  • Set GSS_TmpInteger = (Player number of (Owner of (Triggering unit)))
  • Set GSS1_Speed[GSS_TmpInteger] = (GSS1_Speed[GSS_TmpInteger] + GSS_Speed_Boost)
  • Wait 1.00 seconds
  • Set GSS_TmpInteger = (Player number of (Owner of (Triggering unit)))
^ I don't understand this part.. and you used wait again :/ . You already cached the Player number of triggering unit so the other one is not needed.
( Reduced Score Points: -8 )
Documentation
Good supporting documentations!
Configuration

  • Set GSS_SlidingSpeed_Default = 12.00
The configuration is lacking. Add a terrain type configuration.
Pros
Good and Useful System
Cons
System 1 does not support units. Inefficient.
Importing Instruction
JASS:
1. Activate "Create unknown variables" in your editor default settings.

2. Copy & paste your favorite folder into your map.

3. In Init-trigger you will have to reset 'Spawn' and those 6 Terrain types to what ever you want.

4. If you want import the Boost ability you would have also to cpy & paste the ability from Object Editor   // for GGS1 ONLY


That's it.

^ The instruction is lacking and it does not show Preferences, general and other stuffs. Other than that none and nice importing instruction.
Special Effects
There's no special effect in hero reviving, in entering the killing terrain and in sliding motion. The movement in sliding is smooth and executed well.
Usefulness
Could be useful in sliding maps such as Icegliders and actually escapes snow maps :D.
Suggestions
Make the system supports unit too. Make those problems to be fix. I'd love sliding maps :D because it is fun.
Description Tooltip
The boost spell is lacking at tooltip.

jakeZinc Score Board
Rejected: 1-10
Unacceptable : 11-30
Lacking : 31-49
Useful : 50-69
Recommended : 70-90
Highly Recommended : 91-100
Director Cut : 101-105
Scores
1) Triggering - 12/20
2) Documentation - 8/10
3) Importing Instruction - 5/10
4) Special Effects - 9/15
5) Usefulness - 19/20
6) Tooltip - 4/10
7) Configuration - 4/10
Ratings
Total Score - 61/105
jakeZinc Rating - 3.9/5
Status - Useful and Needs Fix
 
Last edited:
Level 15
Joined
Nov 18, 2012
Messages
1,412
You guys should stop being dogmatics, it is NOT supposed to have the X/Y function, because it's supposed not to see the units' movement animation and spell animation. The "move unit instantly to" doesn't cause any lag if it is leakless and well used. This is used in specific maps so it isn't very configurable, but still useful and well made.
Now I suggest you icemanbo that you make something in the terrain check trigger not to make it loop forever, else it would reach the op limit(very rare to happen here).
 
@Maker, I'll change the loop to 12, and I'll also change it to support non-heroes and seperate additional stuff
______________________________________________

@jakeZink, thx for review
where I forgot this?
  • Custom script: call RemoveLocation (udg_Point2)

Why my revive-trigger is not MUI? And I know waits are usually not recommneded, but I guess for here it's acceptable.


  • Set GSS_SlidingSpeed_Default = 12.00
The configuration is lacking. Add a terrain type configuration.
Sliding speed is usually always the same, only on 2 special terrain-types.
1. Fast Ice
2. Slow Reverse
You can change the values in Init. Atm they depend of the Default_Speed, but you also can set them to a constant.
______________________________________________

Yes, I will put unit always into variable when I use more often
I also will make 1. system to support all units, thx ;)

Edit:
Wrda, thx I agree with you... it does not cause lags^^
 
use this for MUI wait :)
Read carefully.. it works, only problem could be this (quote from your link)
You either store all state and every last bit of event-response data that you want to use after the wait code, or you store absolutely nothing and depend on the current execution context of the trigger.
(This means that using something like (Triggering Unit) after the wait action will give you incorrect results if you used a buffer to store data for the instances. You either use the buffers to store absolutely everything, or you use no buffers at all.) (Thank you again, IcemanBo for helping me make this realization)
And that doesn't matter in this system so I use it.
 
Level 22
Joined
Sep 24, 2005
Messages
4,820
You guys should stop being dogmatics, it is NOT supposed to have the X/Y function
The speed freaks strike again, I used to be one of them though.

I've read the thing on the link and it seems to me that the said technique is useful if the succeeding waits are good only if the duration is always greater than all the previous instances. Nothing wrong with that though.

Good luck IcemanBo.
 
Level 15
Joined
Nov 18, 2012
Messages
1,412
why? it's not hard to use x/y coordinates -__-
it's not about showing unit animation, it's about efficiency.
"move instantly to" is as efficient as x/y, the only difference is that it takes a location (point).
Also using waits doesn't mean that the map will be some kind of stupidness, if they are used well then it will be MUI, so stop saying some coconut junk ideas just to make unnecessary code.
 
Level 17
Joined
Aug 13, 2013
Messages
1,680
You guys should stop being dogmatics, it is NOT supposed to have the X/Y function, because it's supposed not to see the units' movement animation and spell animation. The "move unit instantly to" doesn't cause any lag if it is leakless and well used.
Well it depends from the user if he don't want setunitX/Y func then dont because I'm not forcing him to do that, also that I don't point in the animation of the units because he can use SetUnitTimeScale or SetUnitTurnSpeed to make the unit stop acting the moving animation and use Unit's Propwindow to 0 so it will not make the unit to move while sliding. "moves unit instantly to" BREAKS the order of the unit so what if the unit wants to channel, teleport, casting time??????????? that's why setunitX/Y is better because it does not cancel or breaks the order of the unit. Download and test the map with "unit - moves instantly position" func and order the unit to blink while sliding and see.
 
Level 19
Joined
Jul 31, 2012
Messages
2,217
Well it depends from the user if he don't want setunitX/Y func then dont because I'm not forcing him to do that, also that I don't point in the animation of the units because he can use SetUnitTimeScale or SetUnitTurnSpeed @Nope, that won't wo[email protected] to make the unit stop acting the moving animation and use Unit's Propwindow to 0 so it will not make the unit to move while sliding. "moves unit instantly to" BREAKS the order of the unit so what if the unit wants to channel, teleport, casting time??????????? that's why setunitX/Y is better because it does not cancel or breaks the order of the unit. Download and test the map with "unit - moves instantly position" func and order the unit to blink while sliding and see.

I tested it, and even though i was able to blink while sliding : /
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
[GUI] Sliding System v1.0
This spell/system had been reviewed by jakeZinc
http://www.hiveworkshop.com/forums/members/jakezinc/#visitor_messaging

  • -------- |ZZZZZZZZZZZZZZZZZZZZZZZZZ| --------
  • -------- Following actions only set the different terrain tpyes. --------
  • Set Point = (Center of Normal Ice <gen>)
  • Floating Text - Create floating text that reads Normal Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[1] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of NoTurn Ice <gen>)
  • Floating Text - Create floating text that reads No-Turning Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[2] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Reverse Ice <gen>)
  • Floating Text - Create floating text that reads Reverse Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[3] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Speed Ice <gen>)
  • Floating Text - Create floating text that reads Speed Ice at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[4] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Slow Reverse Ice <gen>)
  • Set GSS_Terrain[5] = (Terrain type at Point)
  • Floating Text - Create floating text that reads Slow Reverse at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Custom script: call RemoveLocation (udg_Point)
  • Set Point = (Center of Killer Terrain <gen>)
  • Floating Text - Create floating text that reads Killer Terrain at Point with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Set GSS_Terrain[6] = (Terrain type at Point)
  • Custom script: call RemoveLocation (udg_Point)
  • -------- |ZZZZZZZZZZZZZZZZZZZZZZZZZ| --------
^ Inefficient, slow and long action code. You can use Looping instead of these stuffs and it is faster, easier and neat code.
  • Unit - Move GSS1_Slider[GSS_TmpInteger] instantly to Point2
^ Use call SetUnitX/Y Functions than this because it will not generate lags, avoids pathing and ignores collision size. SetUnitPropWindow.
  • Set Point = (Position of (Triggering unit))
^Use cached unit variable in this or make a variable in the triggering unit because you used it twice.
  • Unit - A unit Dies
    • Conditions
    • ((Triggering unit) is A Hero) Equal to True
    • Actions
    • -------- Just automaticlly revives hero. // for test --------
    • Wait 1.00 seconds
    • Set GSS_TmpPlayer = (Owner of (Triggering unit))
    • Hero - Instantly revive (Triggering unit) at GSS_Spawn, Hide revival graphics
    • Selection - Select (Triggering unit) for GSS_TmpPlayer
    • Camera - Pan camera for GSS_TmpPlayer to GSS_Spawn over 1.50 seconds
    • -------- After death the collosion gets reset. So we have to set it to 0 again. --------
    • Unit - Turn collision for (Triggering unit) Off
^ Not MUI nor MPI and it gives inefficient triggering. Don't use waits and again: Cached triggering unit pls.

The first one would be even less efficient if using loops, even tho it will be shorter code

The second is totally MUI, because TriggeringUnit is already MUI because it is bound to calling instance(if you run it second time while first waits, it will return different unit as Triggering Unit

"move instantly to" is as efficient as x/y, the only difference is that it takes a location (point).
Also using waits doesn't mean that the map will be some kind of stupidness, if they are used well then it will be MUI, so stop saying some coconut junk ideas just to make unnecessary code.

this is also not true, because SetUnitPosition checks pathing and stuff, so it is less efficient than raw SetUnitXY. Also it has to stop the orders

"moves unit instantly to" BREAKS the order of the unit so what if the unit wants to channel, teleport, casting time???????????

hmm....but teleporting away from sliding terrain somehow kills the purpose of sliding terrain doesnt it? also you cant cast spells while moving, and theoretically you are moving while sliding
 
Level 15
Joined
Nov 18, 2012
Messages
1,412
this is also not true, because SetUnitPosition checks pathing and stuff, so it is less efficient than raw SetUnitXY. Also it has to stop the orders
We were talking about the quality of "efficience" of the lag, not the differences between "move instantly to" and X/Y, anyone knows them.
 
Level 22
Joined
Sep 24, 2005
Messages
4,820
Stop arguing about efficiency in this thread guys, go vm each other.

The complexity required by safely using coordinates would make IcemanBo overhaul the system. I don't think that is needed, as he'll need to issue a stop order, check pathing, and a helluva lot more. It would make things more complicated.

If this was written in jass then I'd agree with that, but it ain't.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Stop arguing about efficiency in this thread guys, go vm each other.

The complexity required by safely using coordinates would make IcemanBo overhaul the system. I don't think that is needed, as he'll need to issue a stop order, check pathing, and a helluva lot more. It would make things more complicated.

If this was written in jass then I'd agree with that, but it ain't.

I never said to do that :D Just said SetUnitPosition is less efficient, but is nearly required for this system, because of what you said
 
Level 22
Joined
Sep 24, 2005
Messages
4,820
Hey, I never mentioned anything about you saying something.
SetUnitPosition is less efficient
I don't agree with that, they don't do the same thing. SetUnitPosition does more than what SetUnitXY does, so I don't think we should compare it like that.
 
Updated to v1.1


- replaced 'move unit instantly' by Set unit X/Y
- terrain types are now more flexible with specific speed & turning angle
- moved all unnecessary stuff out of the system
- system 1 now also supports non-heroes
- system 1 now supports 12 players
- terrain types are no longer set with 'Centre of Region' - but with preset
- code improvement
 
Last edited:
Level 17
Joined
Aug 13, 2013
Messages
1,680
Review ( New Changelogs )

Review


[GUI] Sliding System v1.1
This spell/system had been reviewed by jakeZinc
http://www.hiveworkshop.com/forums/members/jakezinc/#visitor_messaging


Keywords

( Optional ) = means it is a optional for you to change, edit, fix it so it does not reduce your score points in this status.

( Requires ) = means that it is need to fix it and it does reduce your score points depends in the error, mistake or wrong status.

[SIZE="+2"]•[/SIZE] = Means that it is pointers from the section, topic.
Examples:
• Requires ( A Keyword ^^ )
( Topic is leaks )
Needs to fix a blablabla..... damn leaks!
Damn this location is leaking D:!

• Requires ( A Keyword ^^ )
( Topic is about efficiency )
It is much faster bro ^^!


Trigger Code

[SIZE="+2"]•[/SIZE] ( Requires )
  • Custom script: call SetUnitX(udg_GSS1_Slider[udg_GSS_TmpInteger], ( GetLocationX(udg_Point) + ( (udg_GSS_TerrainSpeed[udg_GSS_TempInteger_2] + udg_GSS_Speed_Bonus[udg_GSS_TmpInteger]) * CosBJ(GetUnitFacing(udg_GSS1_Slider[udg_GSS_TmpInteger])) ) ))
  • Custom script: call SetUnitY(udg_GSS1_Slider[udg_GSS_TmpInteger], ( GetLocationY(udg_Point) + ( (udg_GSS_TerrainSpeed[udg_GSS_TempInteger_2] + udg_GSS_Speed_Bonus[udg_GSS_TmpInteger]) * SinBJ(GetUnitFacing(udg_GSS1_Slider[udg_GSS_TmpInteger])) ) ))
^ These lines can be shorten by using a local or global variables, Use Sin and Cos than BJ's ( natives are faster and it does not calling another funcs ( depends ).

( Optional )
Store the GetLocationX/Y Point and GetUnitFacing to the local variable.

[SIZE="+2"]•[/SIZE] ( Optional )
  • GSS_TempUnit Equal to GSS1_Slider[(Player number of (Owner of (Triggering unit)))]
^ You can use triggering player instead of Owner of triggering unit because it is much faster.

Note that this review is only inside in the folder system not in additions.
Documentation

Good supporting documentations!

[SIZE="+2"]•[/SIZE] ( Optional )
Add a documentation to the configuration trigger ( about terrains and etc. )
The documentation in the importing instruction can be improved
Configuration

[SIZE="+2"]•[/SIZE] ( Optional )
The configuration can have a documentation
Pros
Good and Useful System
Cons
None.
Importing Instruction
JASS:
1. Activate "Create unknown variables" in your editor default settings.

2. Copy & paste your favorite folder into your map.

3. In Init-trigger you will have to reset 'Spawn' and those 6 Terrain types to what ever you want.

4. If you want import the Boost ability you would have also to cpy & paste the ability from Object Editor   // for GGS1 ONLY


That's it.

^ The instruction is lacking and it does not show Preferences, general and other stuffs. Other than that none and nice importing instruction.
Special Effects
There's no special effect in entering the killing terrain and in sliding motion. The movement in sliding is smoothly fantastic and executed well.
Usefulness
Could be useful in sliding maps such as Icegliders and actually escapes snow maps :D.
Suggestions

Can be MUI.
Description Tooltip

[SIZE="+2"]•[/SIZE] ( Optional )
Boost spell can give a description or tooltip improvements.

jakeZinc Score Board
Rejected: 1-10
Unacceptable : 11-30
Lacking : 31-49
Useful : 50-69
Recommended : 70-90
Highly Recommended : 91-100
Director Cut : 101-105
Scores
1) Triggering - 17/20
2) Documentation - 8/10
3) Importing Instruction - 5/10
4) Special Effects - 10/15
5) Usefulness - 19/20
6) Tooltip - 4/10
7) Configuration - 7/10
Ratings
Total Score - 70/105
jakeZinc Rating - 4/5
Status - Recommended and Nice System.

Note that it is a quick review so it there's anything wrong then VM or PM me ^^.
 
@JakeZinc
I know the SetUnit X/Y lines are long, but thats only because of the superlong variable names.. Yes I could use locals before and then replace my globals by them, but would not change anything else than a bit cosmetics.

Could you please tell what exactly to add in importing description? I don't know it. :s
Suggestions
Can be MUI.
What you mean by that?
___________

Thx for revewing this system 2nd time now, I'm thankful for that :thumbs_up:
 
Hello Maker,
-Don't spam stop order, set unit propulsion window to 0 with a custom script instead
-Don't loop from 1 to 12, loop from 1 to as many units needed
-You could use a hashtable to avoid looping through every tile type
-Make the system support more than one unit per player

I would have to check each period if unit is sliding or not and set propulsion = 0 .. or reset it's propulsion. Or I misunderstood you?

Loop from 1-12. Yes you are right I could optimize it with doing so. I will do it in next update, whereas for me it's not rlly important.

I won't use hashtables, sorry. I like this methode I use now pretty much. You're right with hashtables

If someone wants MUI and not only MPI Sliding System, I just recommend to use Sliding System 2.
 
Last edited:
I doubt thats a better methode.. code will be longer, more actions, and 'stop' does exactly what I want.

What is the point of SS1 then?
You can easily use the slider units, without any groups, because you easily can refer the 'slide-hero' to each player. Furthermore the sliding-speed manipulation is very simple. You just can set Speed[Number] = NewSpeed and no extra index methode is needed.

Edit:
SS1.. for me it's the usual system for sliding maps, because in most slide-maps you anyway use only 1 unit per player.

Comment if you have something more to say to this system, thx. :wsmile:
 
Last edited:
Level 19
Joined
Feb 15, 2008
Messages
2,208
now i understand little more. You will need some triggers from the additive folder.

Slider CREATE
Slider ADD

But dont understand realy where do i set my unit. If i have 10 units in my map thats already out. How do i add them in this trigger?

1. File --> Preferences --> General --> Automatically create unknown variables while pasting trigger data

2. Copy & paste Gui Sliding Sytsem folder into your map.

3. In Init-trigger you can change those 6 Terrain types and it's specific values to what ever you want.

i did everything that been said in this. And its not working. Im sry but im not so good at triggers like you are.
 
Top