1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  3. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  4. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  5. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  6. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  7. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  8. 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.

Sliding System v3.4

Submitted by IcemanBo
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
Code (vJASS):

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.

Terrain Types
Code (vJASS):

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-= 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
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) +...
  1. 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
     
  2. T. D. W.

    T. D. W.

    Joined:
    Jul 31, 2012
    Messages:
    1,476
    Resources:
    5
    Spells:
    5
    Resources:
    5
    • 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
    • [​IMG]
    • [​IMG]
    • If You want me to review an Update of This Spell, Please Notify me this by VM or PM
     
  3. Kazeon

    Kazeon

    Joined:
    Oct 12, 2011
    Messages:
    3,296
    Resources:
    38
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    3
    JASS:
    4
    Resources:
    38
    use SetUnitX/Y instead of moving unit into point. it's lagless, better, and shows unit move animation..
     
  4. T. D. W.

    T. D. W.

    Joined:
    Jul 31, 2012
    Messages:
    1,476
    Resources:
    5
    Spells:
    5
    Resources:
    5
    I actually not agree much on the showing unit's movement animation, it looks a lot better if the unit was "sliding" without the move animation, OR the move animation speed should increase when sliding
     
  5. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    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.
     
  6. Kazeon

    Kazeon

    Joined:
    Oct 12, 2011
    Messages:
    3,296
    Resources:
    38
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    3
    JASS:
    4
    Resources:
    38
    do you know about ice skater, they still need to move their feet to move on the ice
     
  7. T. D. W.

    T. D. W.

    Joined:
    Jul 31, 2012
    Messages:
    1,476
    Resources:
    5
    Spells:
    5
    Resources:
    5
    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
     
  8. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    This is for slide maps dude, so no ice skaters here.
     
  9. Kazeon

    Kazeon

    Joined:
    Oct 12, 2011
    Messages:
    3,296
    Resources:
    38
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    3
    JASS:
    4
    Resources:
    38
    okay, but still, using setunitx/y is better :p maybe you can give the unit an order to stop after setting its x/y. Or just play unit stand animation, or set unit animation speed to 0%, it's up to you

    why don't you use presets for terrain type variables?
    • Set GSS_Terrain[1] = Icecrown Glacier - Ice
     
  10. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,453
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    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
     
  11. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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
     
  12. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,532
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    @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:
    _____________________________________________________

    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

    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:
     
  13. GhostHunter123

    GhostHunter123

    Joined:
    Oct 17, 2012
    Messages:
    479
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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: Nov 15, 2013
  14. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,532
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    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?
     
  15. Kazeon

    Kazeon

    Joined:
    Oct 12, 2011
    Messages:
    3,296
    Resources:
    38
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    3
    JASS:
    4
    Resources:
    38
    he meant, you should use my suggestion, use presets as terrain types :p so that users don't need to make some dummy regions in their game :)
     
  16. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Currently this is not approvable.

    System 1 is limited to heroes, loops from 1 to 11, supports only 5 terrain types. Separate all the non system related actions from the system.
     
  17. JAKEZINC

    JAKEZINC

    Joined:
    Aug 13, 2013
    Messages:
    1,615
    Resources:
    9
    Spells:
    9
    Resources:
    9
    Review

    Review


    [GUI] Sliding System v1.0
    This spell/system had been reviewed by jakeZinc


    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
    Code (vJASS):
    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: Nov 17, 2013
  18. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,293
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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).
     
  19. Kazeon

    Kazeon

    Joined:
    Oct 12, 2011
    Messages:
    3,296
    Resources:
    38
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    3
    JASS:
    4
    Resources:
    38
    why? it's not hard to use x/y coordinates -__-
    it's not about showing unit animation, it's about efficiency. you can set the animation speed to 0% or queue unit stand animation if you dont want to show the animation.