wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > - Submit a resource -
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-22-2016, 10:29 AM   #1
AGD
User
 
Join Date: Jun 2016
Posts: 3

AGD has little to show at this moment (0)

Default [System] Illusion Editor (vJass + GUI Support)

Illusion Editor v1.2b

This system provides users with helpful utilities with regards to creation of illusions as well as the manipulation of many of their aspects.
With this system, you can now create illusions of any type as easily as creating units. This even allows you to create permanent illusions.
Read the script header for more details.

Main Script
Collapse JASS:
library IllusionEditor /*


  */requires /*

  */UnitDex /*
        [[url]http://www.hiveworkshop.com/threads/system-unitdex-unit-indexer.248209/][/url]

  */DamageEvent /*
        [[url]http://www.hiveworkshop.com/threads/system-physical-damage-detection.228456/][/url]

  */Table /*
        [[url]http://www.hiveworkshop.com/threads/snippet-new-table.188084/][/url]

  */optional RegisterPlayerUnitEvent /*
        [[url]http://www.hiveworkshop.com/threads/snippet-registerplayerunitevent.203338/][/url]


*///! novjass

     _______________________
    |                       |
    | Illusion Editor v1.2b |
    |    Written by AGD     |
    |_______________________|
/*
    This system gives you freedom and ease in creating illusions. With this, you
    can now create illusions of any type as easily as creating units or make an
    illusion copy from an already existing unit, with the ability to change many
    of their aspects (such as duration, damage dealt, damage recieved, deathSFX,
    and hero level) dynamically.


    Hint:
        - Use zero or any negative value for duration to make a permanent illusion
        - Setting a hero illusion's level might cause a change to its proper name

    To Import:
        - Copy all the neccessary Object Editor data or alternatively use the object merger
        - Copy the Damage Engine Trigger category together with the Unit Indexer
        - Copy this trigger/trigger category
*/
    |=======|
    |  API  |
    |=======|

        function CreateIllusion takes player whichPlayer, integer ID, real dur, real damageDealt, real damageReceived, real x, real y, real angle returns unit/*
        - Creates an illusion of type <ID>

      */function CopyUnit takes player whichPlayer, unit u, real dur, real damageDealt, real damageReceived, real x, real y, real angle returns unit/*
        - Creates an illusion copy of a unit which possesses the same abilities and items as the original unit

      */function SetIllusionLevel takes unit u, integer level, boolean showEyeCandy returns boolean/*
        - Sets the level of the illusion to a desired value and returns boolean value depending on the success of the operation
          (Only works if the illusion is a hero and if it was created using this system)

      */function SetIllusionDuration takes unit u, real time returns boolean/*
        - Sets the duration of the illusion and returns a boolean value depending on the success of the operation
          (This only works for illusions created by this system)

      */function AddIllusionDuration takes unit u, real extraTime returns boolean/*
        - Adds an extra duration to an illusion's timed life and returns a boolean value depending on the success of the operation
          (This only works for illusions created by this system)

      */function SetIllusionDamageFactor takes unit u, real factor returns boolean/*
        - Sets the damagedealt factor of the illusion and returns a boolean value depending on the success of the operation
          (This only works for illusions created by this system)

      */function SetIllusionReceiveFactor takes unit u, real factor returns boolean/*
        - Sets the damagereceivefactor of the illusion and returns a boolean value depending on the success of the operation
          (This only works for illusions created by this system)

      */function ShowIllusionDeathEffect takes unit u, boolean flag returns boolean/*
        - Sets the illusion's death animation ON/OFF and returns a boolean value depending on the success of the operation
          (This only works for illusions created by this system)

      */function SetIllusionDeathEffect takes unit u, string model returns boolean/*
        - Sets the death animation of the illusion and returns a boolean value depending on the success of the operation
          (This only works for illusions created by this system)

      */function GetIllusionRemainingDuration takes unit u returns real/*
        - Returns the remaining duration of the illusion
          (This will return 0 for illusions not created by this system)

      */function GetIllusionTotalDuration takes unit u returns real/*
        - Returns the duration of the illusion
          (This will return 0 for illusions not created by this system)

      */function GetIllusionDamageFactor takes unit u returns real/*
        - Returns the damagedealt factor of the illusion
          (This will return 0 for illusions not created by this system)

      */function GetIllusionReceiveFactor takes unit u returns real/*
        - Returns the damagereceive factor of the illusion
          (This will return 0 for illusions not created by this system)

      */function GetLastIllusion takes nothing returns unit/*
        - Returns the last illusion created using this system

      */function GetIllusionFlag takes unit u returns boolean/*
        - Checks if the illusion is created by this system or not

*///! endnovjass

    globals

        ///////////////////////////
        // Configuration Section //
        ///////////////////////////

        /////////////////////////////////////////////////////
        // Rawcode of the item used for creating illusions //
        /////////////////////////////////////////////////////
        private constant integer ITEM_ID = 'I000'
        /////////////////////////////////////////////////////
        // Rawcode of the dummy caster                     //
        /////////////////////////////////////////////////////
        private constant integer DUMMY_ID = 'i001'
        /////////////////////////////////////////////////////
        // Illusion timed life check interval              //
        /////////////////////////////////////////////////////
        private constant real LOOP_INTERVAL = 0.03125
        /////////////////////////////////////////////////////
        // Synchronize this value with the duration of     //
        // illusions produced by the the item in the       //
        // object editor so that this system will be able  //
        // to make the neccessary adjustments.             //
        // It would be better to set this value to 3600    //
        // which is the maximum duration you can put in    //
        // the object editor. But always be reminded that  //
        // everytime you change this value, change also    //
        // that of the object editor's!                    //
        /////////////////////////////////////////////////////
        private constant real ITEM_DUR_LIMIT = 5.00
        /////////////////////////////////////////////////////
        // The remaining time of the illusion before it    //
        // would be replaced with another one in case the  //
        // desired duration of the illusion is greater     //
        // than what the item could provide                //
        /////////////////////////////////////////////////////
        private constant real REPLACE_TIME_ALLOWANCE = 0.10
        /////////////////////////////////////////////////////
        // The default death animation of the illusions    //
        /////////////////////////////////////////////////////
        private constant string DEFAULT_DEATH_SFX = "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl"
        /////////////////////////////////////////////////////
        // The owning player of the dummy unit             //
        /////////////////////////////////////////////////////
        private constant player DUMMY_OWNER = Player(15)
        /////////////////////////////////////////////////////
        // The prefix of the operation error message when  //
        // debug mode is enabled                           //
        /////////////////////////////////////////////////////
        private constant string PREFIX = "Operation Failed: "

        //////////////////////////
        // End of Configuration //
        //////////////////////////

    endglobals


    //===== Do not change anything below this line if you're not so sure on what you're doing =====//


    globals

        private HashTable hash
        private group tempGroup         = CreateGroup()
        private trigger deathEvent      = CreateTrigger()
        private integer index           = 0
        private integer tempInt         = 0
        private integer usedDeathEvent  = 0
        private unit illusion
        private unit U
        private unit dummyCaster
        private item casterItem

        // These variables are used to store unit specific data for
        // each illusion created using this system
        private integer array maxTargeterCount
        private integer array order
        private integer array orderType
        private boolean array flag
        private boolean array check
        private boolean array showDeath
        private real array targPointX
        private real array targPointY
        private unit array orderTarget
        private timer array lifeTimer
        private real array elapsed
        private real array duration
        private real array damageFactor
        private real array receiveFactor
        private real array X
        private real array Y
        private real array facing
        private player array owner
        private unit array summon
        private string array deathSFX

    endglobals

    static if DEBUG_MODE then
        private function Debug takes string msg returns nothing
            call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 30, "|CFFFFCC00[Illusion Editor]|R  " + msg )
        endfunction
    endif

    private keyword Copy

    ///////////////////////////////////////////////////
    // These three functions caches the order of the //
    // expiring illusion units to be passed to their //
    // replacements. Similarly when the expiring     //
    // illusion is targeted with an order, the order //
    // will be redirected to its replacement as well.//
    ///////////////////////////////////////////////////
    private function ReIssueTargetOrder takes nothing returns boolean
        local unit u = GetOrderedUnit()
        local unit t = GetOrderTargetUnit()
        local integer i = GetUnitId( u )
        local integer tDex = GetUnitId( t )
        local integer key = GetHandleId( t )
        if check[i] then
            set orderType[i] = 1
            set orderTarget[i] = t
        endif
        if check[tDex] then
            set order[i] = GetUnitCurrentOrder( u )
            if not flag[i] then
                loop
                    set maxTargeterCount[tDex] = maxTargeterCount[tDex] + 1
                    if hash[key].unit[maxTargeterCount[tDex]] == null then
                        set hash[key].unit[maxTargeterCount[tDex]] = u
                        set flag[i] = true
                        break
                    endif
                endloop
            endif
        endif
        set u = null
        set t = null
        return false
    endfunction

    private function ReIssuePointOrder takes nothing returns boolean
        local integer i = GetUnitId( GetOrderedUnit() )
        if check[i] then
            set orderType[i] = 2
            set targPointX[i] = GetOrderPointX()
            set targPointY[i] = GetOrderPointY()
        endif
        set flag[i] = false
        return false
    endfunction

    private function ReIssueOrder takes nothing returns boolean
        local integer i = GetUnitId( GetOrderedUnit() )
        if check[i] then
            set orderType[i] = 3
        endif
        set flag[i] = false
        return false
    endfunction


    /////////////////////////////////////////////////
    // This function controls the duration of the  //
    // illusions as well as replacing them in case //
    // their hardcoded lifetime expires before     //
    // meeting the duration desired for them       //
    /////////////////////////////////////////////////
    private function AdjustTimedLife takes nothing returns nothing
        local timer t            = GetExpiredTimer()
        local integer timerKey   = GetHandleId( t )
        local unit u             = hash[timerKey].unit[0]
        local integer key        = GetHandleId( u )
        local integer i          = GetUnitId( u )
        local integer lastOrder
        local unit new
        local real toAdd
        if not IsUnitType( u, UNIT_TYPE_DEAD ) and u != null then
            set elapsed[i] = elapsed[i] + LOOP_INTERVAL
            if duration[i] < ITEM_DUR_LIMIT and duration[i] > 0 and elapsed[i] >= duration[i] then
                call hash.remove( timerKey )
                call RemoveUnit( u )
                call DestroyTimer( t )
            elseif elapsed[i] >= ITEM_DUR_LIMIT - REPLACE_TIME_ALLOWANCE then
                set toAdd = duration[i] - ( ITEM_DUR_LIMIT - REPLACE_TIME_ALLOWANCE )
                if toAdd < 0 then
                    set toAdd = 0
                endif
                set lastOrder = GetUnitCurrentOrder( u )
                set new = Copy.evaluate( owner[i], u, toAdd, damageFactor[i], receiveFactor[i], GetUnitX( u ), GetUnitY( u ), GetUnitFacing( u ) )
                //! textmacro REDIRECTDATA takes KEY, NEWLIFE, NEWMANA
                call ShowUnit( u, false )
                call SetWidgetLife( new, $NEWLIFE$ )
                call SetUnitState( new, UNIT_STATE_MANA, $NEWMANA$ )
                set index = 0
                loop
                    set index = index + 1
                    set U = hash[$KEY$].unit[index]
                    set tempInt = GetUnitId( U )
                    if U != null and flag[tempInt] then
                        set flag[tempInt] = false
                        call IssueTargetOrderById( U, order[tempInt], new )
                    endif
                    exitwhen index > maxTargeterCount[i]
                endloop
                if orderType[i] == 1 then
                    call IssueTargetOrderById( new, lastOrder, orderTarget[i] )
                elseif orderType[i] == 2 then
                    call IssuePointOrderById( new, lastOrder, targPointX[i], targPointY[i] )
                elseif orderType[i] == 3 then
                    call IssueImmediateOrderById( new, lastOrder )
                endif
                if IsUnitSelected( u, GetLocalPlayer() ) then
                    call SelectUnit( new, true )
                endif
                set maxTargeterCount[i] =  0
                set index = GetUnitId( new )
                set deathSFX[index] = deathSFX[i]
                set showDeath[index] = showDeath[i]
                //! endtextmacro
                //! runtextmacro REDIRECTDATA( "key", "GetWidgetLife( u )", "GetUnitState( u, UNIT_STATE_MANA )" )
                call hash.remove( timerKey )
                set showDeath[i] = false
                call RemoveUnit( u )
                call DestroyTimer( t )
                if u == illusion then
                    set illusion = new
                endif
                set new = null
            endif
        else
            call hash.remove( timerKey )
            call RemoveUnit( u )
            call DestroyTimer( t )
        endif
        set t = null
        set u = null
    endfunction


    ////////////////////
    // After Creation //
    ////////////////////
    private function OnSummon takes nothing returns boolean
        local integer i
        local integer uDex
        if GetSummoningUnit() == dummyCaster then
            set i = GetUnitId( dummyCaster )
            set U = GetTriggerUnit()
            set uDex = GetUnitId( U )
            set check[uDex] = true
            set showDeath[uDex] = true
            set duration[uDex] = duration[i]
            set damageFactor[uDex] = damageFactor[i]
            set receiveFactor[uDex] = receiveFactor[i]
            set owner[uDex] = owner[i]
            set lifeTimer[uDex] = CreateTimer()
            set elapsed[uDex] = 0
            set maxTargeterCount[uDex] = 0
            set deathSFX[uDex] = DEFAULT_DEATH_SFX
            set hash[GetHandleId( lifeTimer[uDex] )].unit[0] = U
            call TimerStart( lifeTimer[uDex], LOOP_INTERVAL, true, function AdjustTimedLife )
            call SetUnitOwner( U, owner[i], true )
            call SetUnitFacing( U, facing[i] )
            if IsUnitType( U, UNIT_TYPE_STRUCTURE ) then
                call SetUnitPosition( U, X[i], Y[i] )
            else
                call SetUnitX( U, X[i] )
                call SetUnitY( U, Y[i] )
            endif
            call TriggerRegisterUnitStateEvent( deathEvent, U, UNIT_STATE_LIFE, LESS_THAN, UNIT_MIN_LIFE )
        endif
        return false
    endfunction


    /////////////////////////////////
    //*****************************//
    //* Usable function for users *//
    //*****************************//
    /////////////////////////////////

    //! textmacro REPLICATE takes FUNC, TAKE, X, TARGET
    private function $FUNC$ takes player whichPlayer, $TAKE$, real dur, real damageDealt, real damageReceived, real x, real y, real angle returns unit
        local integer i = GetUnitId( dummyCaster )
        $X$local unit tempUnit = CreateUnit( DUMMY_OWNER, ID, x, y, 0 )
        if dur < 0 then
            set dur = 0
        endif
        if damageDealt < 0 then
            set damageDealt = 0
        endif
        if damageReceived < 0 then
            set damageReceived = 0
        endif
        set X[i] = x
        set Y[i] = y
        set duration[i] = dur
        set damageFactor[i] = damageDealt
        set receiveFactor[i] = damageReceived
        set facing[i] = angle
        set owner[i] = whichPlayer
        call UnitUseItemTarget( dummyCaster, casterItem, $TARGET$ )
        $X$call RemoveUnit( tempUnit )
        $X$set tempUnit = null
        return U
    endfunction
    //! endtextmacro
    //! runtextmacro REPLICATE( "Create", "integer ID", "", "tempUnit" )
    //! runtextmacro REPLICATE( "Copy", "unit u", "//", "u" )

    function CreateIllusion takes player whichPlayer, integer ID, real dur, real damageDealt, real damageReceived, real x, real y, real angle returns unit
        set illusion = Create( whichPlayer, ID, dur, damageDealt, damageReceived, x, y, angle )
        return illusion
    endfunction

    function CopyUnit takes player whichPlayer, unit u, real dur, real damageDealt, real damageReceived, real x, real y, real angle returns unit
        set illusion = Copy( whichPlayer, u, dur, damageDealt, damageReceived, x, y, angle )
        return illusion
    endfunction

    function SetIllusionLevel takes unit u, integer level, boolean showEyeCandy returns boolean
        local integer i = GetUnitId( u )
        local integer lastOrder
        local unit tempUnit
        local unit new
        local real x
        local real y
        local boolean success = false
        if check[i] then
            set x = GetUnitX( u )
            set y = GetUnitY( u )
            set tempUnit = CreateUnit( DUMMY_OWNER, GetUnitTypeId( u ), x, y, GetUnitFacing( u ) )
            if IsUnitType( tempUnit, UNIT_TYPE_HERO ) then
                set lastOrder = GetUnitCurrentOrder( u )
                call SetHeroLevel( tempUnit, level, false )
                set new = Copy( owner[i], tempUnit, duration[i], damageFactor[i], receiveFactor[i], x, y, GetUnitFacing( u ) )
                set index = 0
                loop
                    set index = index + 1
                    call UnitAddItemToSlotById( new, GetItemTypeId( UnitItemInSlot( u, index ) ), index )
                    exitwhen index == 6
                endloop
                //! runtextmacro REDIRECTDATA( "GetHandleId( u )", "GetWidgetLife( u )*GetWidgetLife( new )/GetUnitState( u, UNIT_STATE_MAX_LIFE )", "GetUnitState( u, UNIT_STATE_MANA )*GetUnitState( new, UNIT_STATE_MANA )/GetUnitState( u, UNIT_STATE_MAX_MANA )" )
                call RemoveUnit( u )
                if showEyeCandy then
                    call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Levelup\\LevelupCaster.mdl", new, "origin" ) )
                endif
                set success = true
                set new = null
            debug else
                debug call Debug( PREFIX + "Specified illusion is not a hero" )
            endif
            call RemoveUnit( tempUnit )
            set tempUnit = null
        debug else
            debug call Debug( PREFIX + "Specified unit is not an illusion created by the system" )
        endif
        return success
    endfunction

    //! textmacro DEBUG takes X
    if not check[GetUnitId( u )] then
        debug call Debug( PREFIX + "Specified unit is not an illusion created by the system" )
        $X$return false
    endif
    //! endtextmacro

    function AddIllusionDuration takes unit u, real extraTime returns boolean
        local integer i = GetUnitId( u )
        //! runtextmacro DEBUG( "" )
        set duration[i] = duration[i] + extraTime
        return true
    endfunction

    function SetIllusionDamageFactor takes unit u, real factor returns boolean
        //! runtextmacro DEBUG( "" )
        set damageFactor[GetUnitId( u )] = factor
        return true
    endfunction

    function SetIllusionReceiveFactor takes unit u, real factor returns boolean
        //! runtextmacro DEBUG( "" )
        set receiveFactor[GetUnitId( u )] = factor
        return true
    endfunction

    function ShowIllusionDeathEffect takes unit u, boolean flag returns boolean
        //! runtextmacro DEBUG( "" )
        set showDeath[GetUnitId( u )] = flag
        return true
    endfunction

    function SetIllusionDeathEffect takes unit u, string model returns boolean
        //! runtextmacro DEBUG( "" )
        set deathSFX[GetUnitId( u )] = model
        return true
    endfunction

    function GetIllusionRemainingDuration takes unit u returns real
        local integer i = GetUnitId( u )
        local real remaining = duration[i] - elapsed[i]
        //! runtextmacro DEBUG( "return 0.00//" )
        if remaining < 0.00 then
            return 0.00
        endif
        return remaining
    endfunction

    function SetIllusionDuration takes unit u, real time returns boolean
        return AddIllusionDuration( u, time - GetIllusionRemainingDuration( u ) )
    endfunction

    function GetIllusionTotalDuration takes unit u returns real
        //! runtextmacro DEBUG( "//" )
        return duration[GetUnitId( u )]
    endfunction

    function GetIllusionDamageFactor takes unit u returns real
        //! runtextmacro DEBUG( "//" )
        return damageFactor[GetUnitId( u )]
    endfunction

    function GetIllusionReceiveFactor takes unit u returns real
        //! runtextmacro DEBUG( "//" )
        return receiveFactor[GetUnitId( u )]
    endfunction

    function GetLastIllusion takes nothing returns unit
        return illusion
    endfunction

    function GetIllusionFlag takes unit u returns boolean
        return check[GetUnitId( u )]
    endfunction


    ////////////////////////////////////////////////
    // This function adjusts the damage dealt and //
    // taken by the illusions                     //
    ////////////////////////////////////////////////
    private function DamageAdjustment takes nothing returns boolean
        local integer uDex = GetUnitId( PDDS.source )
        local integer tDex = GetUnitId( PDDS.target )
        if check[uDex] and check[tDex] then
            set PDDS.amount = PDDS.amount*damageFactor[uDex]*receiveFactor[tDex]
        elseif check[uDex] then
            set PDDS.amount = PDDS.amount*damageFactor[uDex]
        elseif check[tDex] then
            set PDDS.amount = PDDS.amount*receiveFactor[tDex]
        endif
        return false
    endfunction


    ////////////////////////////////////////////////
    // Registers an illusion death event          //
    ////////////////////////////////////////////////
    private function RefreshDeathTrigger takes nothing returns nothing
        local unit u
        call GroupEnumUnitsInRect( tempGroup, bj_mapInitialPlayableArea, null )
        loop
            set u = FirstOfGroup( tempGroup )
            exitwhen u == null
            call GroupRemoveUnit( tempGroup, u )
            if check[GetUnitId( u )] then
                call TriggerRegisterUnitStateEvent( deathEvent, u, UNIT_STATE_LIFE, LESS_THAN, UNIT_MIN_LIFE )
            endif
        endloop
    endfunction


    ////////////////////////////////////////////////
    // This function is responsible for hiding or //
    // showing the illusion's death SFX           //
    ////////////////////////////////////////////////
    private function OnDeath takes nothing returns boolean
        local unit u = GetTriggerUnit()
        local integer i = GetUnitId( u )
        call ShowUnit( u, false )
        call hash.remove( GetHandleId( u ) )
        if showDeath[i] then
            call DestroyEffect( AddSpecialEffect( deathSFX[i], GetUnitX( u ), GetUnitY( u ) ) )
        endif
        set usedDeathEvent = usedDeathEvent + 1
        if usedDeathEvent == 20 then
            set usedDeathEvent = 0
            call DestroyTrigger( deathEvent )
            set deathEvent = CreateTrigger()
            call TriggerAddCondition( deathEvent, Filter( function OnDeath ) )
            call RefreshDeathTrigger()
        endif
        set u = null
        return false
    endfunction


    ////////////////////
    // Initialization //
    ////////////////////
    private module M

        static method onInit takes nothing returns nothing
            static if LIBRARY_RegisterPlayerUnitEvent then
                call RegisterPlayerUnitEventForPlayer( EVENT_PLAYER_UNIT_SUMMON, function OnSummon, DUMMY_OWNER )
                call RegisterPlayerUnitEvent( EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, function ReIssueTargetOrder )
                call RegisterPlayerUnitEvent( EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, function ReIssuePointOrder )
                call RegisterPlayerUnitEvent( EVENT_PLAYER_UNIT_ISSUED_ORDER, function ReIssueOrder )
            else
                local trigger t1 = CreateTrigger()
                local trigger t2 = CreateTrigger()
                local trigger t3 = CreateTrigger()
                local trigger t4 = CreateTrigger()
                set index = 16
                loop
                    set index = index - 1
                    call TriggerRegisterPlayerUnitEvent( t2, Player(index), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null )
                    call TriggerRegisterPlayerUnitEvent( t3, Player(index), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null )
                    call TriggerRegisterPlayerUnitEvent( t4, Player(index), EVENT_PLAYER_UNIT_ISSUED_ORDER, null )
                    exitwhen index == 0
                endloop
                call TriggerRegisterPlayerUnitEvent( t1, DUMMY_OWNER, EVENT_PLAYER_UNIT_SUMMON, null )
                call TriggerAddCondition( t1, Filter( function OnSummon ) )
                call TriggerAddCondition( t2, Filter( function ReIssueTargetOrder ) )
                call TriggerAddCondition( t3, Filter( function ReIssuePointOrder ) )
                call TriggerAddCondition( t4, Filter( function ReIssueOrder ) )
            endif
            call TriggerAddCondition( deathEvent, Filter( function OnDeath ) )
            call AddDamageHandler( function DamageAdjustment )
            set hash = HashTable.create()
            set casterItem = CreateItem( ITEM_ID, 0, 10000 )
            set dummyCaster = CreateUnit( DUMMY_OWNER, DUMMY_ID, 0, 0, 0 )
            call UnitAddItem( dummyCaster, casterItem )
        endmethod

    endmodule

    private struct S extends array
        implement M
    endstruct


endlibrary

GUI Support
Collapse JASS:
library IllusionEditorGUISupport uses IllusionEditor


    private function Operate takes nothing returns nothing
        if udg_IE_Operation == 0 then
            set udg_IE_Illusion = GetLastIllusion()
            return
        elseif udg_IE_Operation == udg_IE_CreateIllusion then
            set udg_IE_Illusion = CreateIllusion( udg_IE_Owner, udg_IE_UnitType, udg_IE_Duration, udg_IE_DamageDealtFactor, udg_IE_DamageReceiveFactor, GetLocationX( udg_IE_Position ), GetLocationY( udg_IE_Position ), udg_IE_Facing )
            set udg_IE_Operation = 0
            set udg_IE_Owner = null
            set udg_IE_UnitType = 0
            set udg_IE_Duration = 0.00
            set udg_IE_DamageDealtFactor = 0.00
            set udg_IE_DamageReceiveFactor = 0.00
            set udg_IE_Facing = 0.00
            return
        elseif udg_IE_Operation == udg_IE_CopyUnit then
            set udg_IE_Illusion = CopyUnit( udg_IE_Owner, udg_IE_BaseUnit, udg_IE_Duration, udg_IE_DamageDealtFactor, udg_IE_DamageReceiveFactor, GetLocationX( udg_IE_Position ), GetLocationY( udg_IE_Position ), udg_IE_Facing )
            set udg_IE_Operation = 0
            set udg_IE_Owner = null
            set udg_IE_BaseUnit = null
            set udg_IE_Duration = 0.00
            set udg_IE_DamageDealtFactor = 0.00
            set udg_IE_DamageReceiveFactor = 0.00
            set udg_IE_Facing = 0.00
            return
        elseif udg_IE_Operation == udg_IE_SetLevel then
            set udg_IE_Flag = SetIllusionLevel( udg_IE_Illusion, udg_IE_NewLevel, udg_IE_Flag )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_SetDuration then
            set udg_IE_Flag = SetIllusionDuration( udg_IE_Illusion, udg_IE_Duration )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_AddDuration then
            set udg_IE_Flag = AddIllusionDuration( udg_IE_Illusion, udg_IE_Duration )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_SetDamageFactor then
            set udg_IE_Flag = SetIllusionDamageFactor( udg_IE_Illusion, udg_IE_DamageDealtFactor )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_SetReceiveFactor then
            set udg_IE_Flag = SetIllusionReceiveFactor( udg_IE_Illusion, udg_IE_DamageReceiveFactor )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_ShowDeathEffect then
            set udg_IE_Flag = ShowIllusionDeathEffect( udg_IE_Illusion, udg_IE_Flag )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_SetDeathEffect then
            set udg_IE_Flag = SetIllusionDeathEffect( udg_IE_Illusion, udg_IE_DeathEffect )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_GetRemainingDuration then
            set udg_IE_Duration = GetIllusionRemainingDuration( udg_IE_Illusion )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_GetTotalDuration then
            set udg_IE_Duration = GetIllusionTotalDuration( udg_IE_Illusion )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_GetDamageFactor then
            set udg_IE_DamageDealtFactor = GetIllusionDamageFactor( udg_IE_Illusion )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_GetReceiveFactor then
            set udg_IE_DamageReceiveFactor = GetIllusionReceiveFactor( udg_IE_Illusion )
            set udg_IE_Operation = 0
            return
        elseif udg_IE_Operation == udg_IE_GetFlag then
            set udg_IE_Flag = GetIllusionFlag( udg_IE_Illusion )
            set udg_IE_Operation = 0
            return
        endif
    endfunction

    hook DoNothing Operate


endlibrary


function InitTrig_GUI_Support takes nothing returns nothing
    /* We use an InitTrig function instead of a scope/library
    initializer to initialize the values of our variables to
    make sure that InitGlobals() runs first so that the values
    of our variables would not be reset.                    */
    call Trig_GUI_IllusionEditor_Documentation_Actions.execute()
endfunction

GUI Support Documentation
Trigger:
GUI IllusionEditor Documentation
Events
Conditions
Collapse Actions
-------- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
-------- ||||||||||||||||||||||||||||||||||||||||||||||||| GUI ILLUSION EDITOR GUIDE |||||||||||||||||||||||||||||||||||||||||||||||| --------
-------- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
-------- First you need to choose what operation you want to do using the system. Like this: --------
Set IE_Operation = IE_CreateIllusion
-------- It can be any from the list below: --------
-------- --------
-------- 1. CreateIllusion - creates an illusion of a certain unit-type. --------
-------- 2. CopyUnit - creates a mirror image of a unit which possesses the same items and abilities --------
-------- as the original unit. --------
-------- 3. SetLevel - sets the level of a hero type illusion to a desired value. --------
-------- 4. SetDuration - sets the total duration of an illusion to a desired value, if the given amount --------
-------- is less than the elapsed time of the illusion, it will be destroyed. --------
-------- 5. AddDuration - adds an extra time to an illusion's duration. --------
-------- 6. SetDamageFactor - sets the damage dealt factor of an illusion. --------
-------- 7. SetReceiveFactor - sets the damage receive factor of an illusion --------
-------- 8. ShowDeathEffect - shows/hides the death effect of an illusion. --------
-------- 9. SetDeathEffect - sets a new special effect to replace the default death effect of an --------
-------- illusion. --------
-------- 10. GetRemainingDuration - gets the remaining duration of an illusion. --------
-------- 11. GetTotalDuration - gets the total duration of an illusion. --------
-------- 12. GetDamageFactor - gets the damage dealt factor of an illusion. --------
-------- 13. GetReceiveFactor - gets the damage receive factor of an illusion. --------
-------- 14. GetFlag - checks if the illusion was created using this system or not. --------
-------- --------
-------- Next, you have to setup all the data necessary for the operation you chose. Below are the --------
-------- list of data needed for each operation (Note that all these have an IE_ prefix): --------
-------- --------
-------- 1. - Owner --------
-------- - UnitType --------
-------- - Duration --------
-------- - DamageDealtFactor --------
-------- - DamageReceiveFactor --------
-------- - Position --------
-------- - Facing --------
-------- --------
-------- 2. - Owner --------
-------- - BaseUnit --------
-------- - Duration --------
-------- - DamageDealtFactor --------
-------- - DamageReceiveFactor --------
-------- - Position --------
-------- - Facing --------
-------- --------
-------- 3. - Illusion --------
-------- - NewLevel --------
-------- - Flag --------
-------- --------
-------- 4, 5. - Illusion --------
-------- - Duration --------
-------- --------
-------- 6. - Illusion --------
-------- - DamageDealtFactor --------
-------- --------
-------- 7. - Illusion --------
-------- - DamageReceiveFactor --------
-------- --------
-------- 8. - Illusion --------
-------- - Flag --------
-------- --------
-------- 9. - Illusion --------
-------- - DeathEffect --------
-------- --------
-------- 10, 11, 12, 13, 14. - Illusion --------
-------- --------
-------- The example we chose is CreateIllusion operation. So as you can see in number 1, we --------
-------- need to setup those variables so now we do: --------
Set IE_Owner = Player 1 (Red)
Set IE_UnitType = Mortar Team
Set IE_Duration = 5.00
Set IE_DamageDealtFactor = 0.35
Set IE_DamageReceiveFactor = 4.00
Set IE_Position = (Center of (Playable map area))
Set IE_Facing = Default building facing
-------- --------
-------- And finally, what we have to do is execute the operation which in this case is very simple. --------
-------- To execute the opertation we have to use this: --------
Do nothing
-------- Easy right? Plus we are also able to add a new functionality to the previously useless --------
-------- <Do nothing> function. ^-^ --------
-------- --------
-------- --------
-------- ======================================================================= --------
-------- --------
-------- --------
-------- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
-------- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||| CONSTANTS SETTING ||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
-------- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
Set IE_CreateIllusion = 1
Set IE_CopyUnit = 2
Set IE_SetLevel = 3
Set IE_SetDuration = 4
Set IE_AddDuration = 5
Set IE_SetDamageFactor = 6
Set IE_SetReceiveFactor = 7
Set IE_ShowDeathEffect = 8
Set IE_SetDeathEffect = 9
Set IE_GetRemainingDuration = 10
Set IE_GetTotalDuration = 11
Set IE_GetDamageFactor = 12
Set IE_GetReceiveFactor = 13
Set IE_GetFlag = 14
-------- --------
-------- --------
-------- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
-------- Do not enable the following line. However, they are variable creators so do not delete them. --------
-------- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| --------
Set IE_Operation = 0
Set IE_NewLevel = 0
Set IE_DamageDealtFactor = 0.00
Set IE_DamageReceiveFactor = 0.00
Set IE_Duration = 0.00
Set IE_Facing = 0.00
Set IE_Illusion = No unit
Set IE_Owner = Player 1 (Red)
Set IE_UnitType = No unit-type
Set IE_BaseUnit = No unit
Set IE_Position = IE_Position
Set IE_Flag = False
Set IE_DeathEffect =
-------- ======================================================================= --------
Attached Images
File Type: jpg Illusion Editor.jpg (134.3 KB, 66 views)
Attached Files
File Type: w3x Illusion Editor v1.2b.w3x (89.1 KB, 14 views)
AGD is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 07:44 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services