• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Clone Machine v1.2

This is my latest spell :]

Clone Machine

Summons a clone machine, which will steal the DNA of nearby enemy units. The original units, of which the DNA is stolen from, are dealt X damage. After the destruction of the clone machine, the hero will receive a bonus to their maximum health, up to the maximum health count of the units the machine grabbed. Number of units that can be cloned and Area of Effect increase per level.

Health bonus lasts for 12 seconds.

Features:

• Combination of GUI and Jass (timer issues).
• Setting maximum health to the value you want.

  • Clone Machine 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Clone Machine
    • Actions
      • Custom script: local group g = CreateGroup()
      • -------- --------------------------------------------- --------
      • -------- Maximum units to clone (semi-defines the machine's duration). --------
      • -------- --------------------------------------------- --------
      • Set CM_MaximumUnits = ((Level of (Ability being cast) for (Triggering unit)) + 2)
      • Set CM_AoE = (((Real((Level of (Ability being cast) for (Triggering unit)))) x 100.00) + 250.00)
      • Set CM_Damage = ((Real((Level of (Ability being cast) for (Triggering unit)))) x 50.00)
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • Set CM_Points[0] = (Target point of ability being cast)
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • -------- Dummy Creation and the relative attached data --------
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • Unit - Create 1 Clone Machine (Clone Machine) for (Owner of (Triggering unit)) at CM_Points[0] facing Default building facing degrees
      • Set CM_MachineInit = (Last created unit)
      • Special Effect - Create a special effect at CM_Points[0] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set CM_CM = (Last created unit)
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • Hashtable - Save CM_MaximumUnits as (Key maxcount) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save CM_MaximumUnits as (Key rotationcount) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save CM_Interval as (Key interval) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save CM_Damage as (Key damage) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save 0 as (Key count) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save CM_AoE as (Key aoe) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save 0.00 as (Key sumup) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save Handle Of(Triggering unit) as (Key caster) of (Key (Last created unit)) in CM_Hash
      • Hashtable - Save 0.00 as (Key rotation) of (Key (Last created unit)) in CM_Hash
      • Custom script: call SaveGroupHandle (udg_CM_Hash, GetHandleId (udg_CM_MachineInit), StringHash("group"), g)
      • Unit Group - Add CM_MachineInit to CM_CMGroup
      • -------- --------------------------------------------- --------
      • -------- Maximum time the clone machine will last. --------
      • -------- --------------------------------------------- --------
      • Unit - Add a CM_Duration second Generic expiration timer to (Last created unit)
      • -------- --------------------------------------------- --------
      • -------- Since we are going to use a timer, to adjust the ability's bonus hp duration, we will add this line, to fire --------
      • -------- Clone Machine 3 trigger, once the clone machine dies. --------
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • Trigger - Add to Clone Machine 3 <gen> the event (Unit - (Last created unit) Dies)
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • For each (Integer CM_Integer[1]) from 1 to CM_MaximumUnits, do (Actions)
        • Loop - Actions
          • Set CM_Points[6] = (CM_Points[0] offset by 300.00 towards ((360.00 / (Real(CM_MaximumUnits))) x (Real(CM_Integer[1]))) degrees)
          • Unit - Create 1 Dummy (Clone Machine) for (Owner of (Triggering unit)) at CM_Points[6] facing 90.00 degrees
          • Hashtable - Save Handle Of(Last created unit) as (Key (orb + (String(CM_Integer[1])))) of (Key CM_CM) in CM_Hash
          • Custom script: call GroupAddUnit (g, GetLastCreatedUnit())
          • Custom script: call RemoveLocation (udg_CM_Points[6])
      • Custom script: call RemoveLocation (udg_CM_Points[0])
      • -------- --------------------------------------------- --------
      • -------- --------------------------------------------- --------
      • Trigger - Turn on Clone Machine 2 <gen>
  • Clone Machine 2
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (CM_CMGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in CM_CMGroup and do (Actions)
            • Loop - Actions
              • Set CM_LeftUnitsLoad = (Load (Key maxcount) of (Key (Picked unit)) from CM_Hash)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CM_LeftUnitsLoad Not equal to 0
                • Then - Actions
                  • -------- --------------------------------------------- --------
                  • -------- This is the rotation angle --------
                  • -------- --------------------------------------------- --------
                  • Set CM_MCoord = (Load (Key rotation) of (Key (Picked unit)) from CM_Hash)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CM_MCoord Equal to 358.00
                    • Then - Actions
                      • Hashtable - Save 0.00 as (Key rotation) of (Key (Picked unit)) in CM_Hash
                    • Else - Actions
                      • Hashtable - Save (CM_MCoord + 7.00) as (Key rotation) of (Key (Picked unit)) in CM_Hash
                  • -------- --------------------------------------------- --------
                  • -------- This is the interval loading value. We will substract 0.03 (equal to our periodic event's value) from it, --------
                  • -------- so as to get the "every 3 seconds" effect. --------
                  • -------- --------------------------------------------- --------
                  • Set CM_LeftSecondsLoad = (Load (Key interval) of (Key (Picked unit)) from CM_Hash)
                  • -------- --------------------------------------------- --------
                  • -------- --------------------------------------------- --------
                  • Set CM_Points[1] = (Position of (Picked unit))
                  • -------- --------------------------------------------- --------
                  • -------- Rotating the orbs around the clone machine --------
                  • -------- --------------------------------------------- --------
                  • For each (Integer CM_Integer[4]) from 1 to (Load (Key rotationcount) of (Key (Picked unit)) from CM_Hash), do (Actions)
                    • Loop - Actions
                      • Set CM_Points[7] = (CM_Points[1] offset by 300.00 towards (((360.00 / (Real((Load (Key rotationcount) of (Key (Picked unit)) from CM_Hash)))) x (Real(CM_Integer[4]))) + CM_MCoord) degrees)
                      • Unit - Move (Load (Key (orb + (String(CM_Integer[4])))) of (Key (Picked unit)) in CM_Hash) instantly to CM_Points[7]
                      • Custom script: call RemoveLocation (udg_CM_Points[7])
                  • -------- --------------------------------------------- --------
                  • -------- --------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CM_LeftSecondsLoad Less than or equal to 0.00
                    • Then - Actions
                      • -------- --------------------------------------------- --------
                      • -------- Re-save the interval value, to count another 3 seconds. --------
                      • -------- --------------------------------------------- --------
                      • Hashtable - Save CM_Interval as (Key interval) of (Key (Picked unit)) in CM_Hash
                      • -------- --------------------------------------------- --------
                      • -------- --------------------------------------------- --------
                      • -------- The group pick up; this is where the clones will be taken from. --------
                      • -------- --------------------------------------------- --------
                      • Set CM_ClonedGroup = (Units within (Load (Key aoe) of (Key (Picked unit)) from CM_Hash) of CM_Points[1] matching (((((Matching unit) is A structure) Equal to False) and (((Unit-type of (Matching unit)) Not equal to (Unit-type of (Picked unit))) and ((((Matching unit) is an illusi
                      • -------- --------------------------------------------- --------
                      • -------- We will check if there is at least 1 unit around, so that we don't perform unnecessary actions. --------
                      • -------- --------------------------------------------- --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in CM_ClonedGroup) Not equal to 0
                        • Then - Actions
                          • -------- --------------------------------------------- --------
                          • -------- As you can see, a random unit will be taken from the nearby ones. --------
                          • -------- --------------------------------------------- --------
                          • Set CM_Clone = (Random unit from CM_ClonedGroup)
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Set CM_Points[5] = (Position of CM_Clone)
                          • -------- --------------------------------------------- --------
                          • -------- The CM_SumUp variable counts the total maximum health of the units the clone machine collected. --------
                          • -------- --------------------------------------------- --------
                          • Set CM_SumUp = (Load (Key sumup) of (Key (Picked unit)) from CM_Hash)
                          • Hashtable - Save (CM_SumUp + (Max life of CM_Clone)) as (Key sumup) of (Key (Picked unit)) in CM_Hash
                          • -------- --------------------------------------------- --------
                          • -------- The X and Y values are counted for the lightning's movement. They are set into variables, so that they don't take up much of space in the custom script. --------
                          • -------- --------------------------------------------- --------
                          • Set CM_X = (X of CM_Points[1])
                          • Set CM_Y = (Y of CM_Points[1])
                          • -------- --------------------------------------------- --------
                          • Special Effect - Create a special effect at CM_Points[1] using Abilities\Spells\Other\BlackArrow\BlackArrowMissile.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: set udg_CM_Lightning = AddLightningEx ("FORK", true, udg_CM_X, udg_CM_Y, GetLocationZ(udg_CM_Points[1])+100, udg_CM_X,udg_CM_Y,GetLocationZ(udg_CM_Points[1])+50)
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Hashtable - Save Handle OfCM_Clone as (Key clone) of (Key (Picked unit)) in CM_Hash
                          • Hashtable - Save Handle OfCM_Lightning as (Key lightning) of (Key (Picked unit)) in CM_Hash
                          • Lightning - Change color of CM_Lightning to (0.70 0.00 0.50) with 1.00 alpha
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • -------- We save the 'grab' boolean as true, so that we get the 'grabbing' mode. --------
                          • -------- There is the grab mode, which will reach the target unit (that's going to be cloned) --------
                          • -------- and the 'receive' mode, which, transfers the created clone towards the clone machine. --------
                          • -------- The grab boolean will help us distinguish between the modes. --------
                          • Hashtable - Save True as (Key grab) of (Key (Picked unit)) in CM_Hash
                          • -------- 'offset' handle will help us collect the points for the lightning to move on, until it reaches the target unit to be cloned. --------
                          • Hashtable - Save 0.00 as (Key offset) of (Key (Picked unit)) in CM_Hash
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Custom script: set udg_CM_Lightning = null
                          • -------- --------------------------------------------- --------
                          • -------- The following lines will pick every unit that was saved in the group of the clone machine --------
                          • -------- and will pick a random unit that hasn't been blacked out yet (how? a) by the "loop" and b) by --------
                          • -------- attaching an integer value to it) --------
                          • -------- --------------------------------------------- --------
                          • Custom script: set udg_CM_EnergyGroup = LoadGroupHandle (udg_CM_Hash, GetHandleId(GetEnumUnit()), StringHash("group"))
                          • Custom script: loop
                          • Set CM_EnergyPick = (Random unit from CM_EnergyGroup)
                          • Custom script: exitwhen HaveSavedInteger (udg_CM_Hash, GetHandleId (udg_CM_EnergyPick), StringHash("off")) == false
                          • Custom script: endloop
                          • Animation - Change CM_EnergyPick's vertex coloring to (0.00%, 0.00%, 0.00%) with 0.00% transparency
                          • Custom script: call SaveInteger (udg_CM_Hash, GetHandleId (udg_CM_EnergyPick), StringHash("off"), 0)
                          • Custom script: call RemoveLocation (udg_CM_Points[5])
                        • Else - Actions
                      • Custom script: call DestroyGroup (udg_CM_ClonedGroup)
                    • Else - Actions
                      • -------- --------------------------------------------- --------
                      • -------- Substraction of the duration; when this value reaches 0, the effect of grabbing will take place. --------
                      • -------- --------------------------------------------- --------
                      • Hashtable - Save (CM_LeftSecondsLoad - 0.03) as (Key interval) of (Key (Picked unit)) in CM_Hash
                      • -------- --------------------------------------------- --------
                      • -------- --------------------------------------------- --------
                      • Set CM_CloneLoad = (Load (Key clone) of (Key (Picked unit)) in CM_Hash)
                      • Set CM_LightLoad = (Load (Key lightning) of (Key (Picked unit)) in CM_Hash)
                      • -------- --------------------------------------------- --------
                      • -------- --------------------------------------------- --------
                      • Set CM_Points[2] = (Position of CM_CloneLoad)
                      • -------- --------------------------------------------- --------
                      • -------- This is the point where we check for the mode that's currently on. --------
                      • -------- --------------------------------------------- --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Load (Key grab) of (Key (Picked unit)) from CM_Hash) Equal to True
                        • Then - Actions
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Set CM_Offset = (Load (Key offset) of (Key (Picked unit)) from CM_Hash)
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Set CM_Points[3] = (CM_Points[1] offset by CM_Offset towards (Angle from CM_Points[1] to CM_Points[2]) degrees)
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Distance between CM_Points[2] and CM_Points[3]) Less than or equal to 20.00
                            • Then - Actions
                              • -------- --------------------------------------------- --------
                              • -------- Since the lightning has almost reached the target, the 'receive' mode will begin, by setting the 'grab' boolean to false. --------
                              • -------- --------------------------------------------- --------
                              • Hashtable - Save False as (Key grab) of (Key (Picked unit)) in CM_Hash
                              • -------- --------------------------------------------- --------
                              • -------- The part of the clone's creation. --------
                              • -------- --------------------------------------------- --------
                              • Unit - Create 1 (Unit-type of CM_CloneLoad) for (Owner of (Picked unit)) at CM_Points[2] facing (Facing of CM_CloneLoad) degrees
                              • Custom script: call UnitAddAbility (GetLastCreatedUnit(), 'Aloc')
                              • -------- --------------------------------------------- --------
                              • -------- Removes the ability of attacking, from the clone, so that it doesn't attack. --------
                              • -------- --------------------------------------------- --------
                              • Custom script: call UnitRemoveAbility (GetLastCreatedUnit(), 'Aatk')
                              • -------- --------------------------------------------- --------
                              • Unit - Make (Last created unit) Invulnerable
                              • Animation - Change (Last created unit)'s vertex coloring to (70.00%, 0.00%, 80.00%) with 0.00% transparency
                              • Unit - Change color of (Last created unit) to Purple
                              • -------- --------------------------------------------- --------
                              • -------- This is the part where the clone machine damages the unit from which the DNA is stolen (and from which the clone will be created from). --------
                              • -------- --------------------------------------------- --------
                              • Unit - Cause (Picked unit) to damage CM_CloneLoad, dealing (Load (Key damage) of (Key (Picked unit)) from CM_Hash) damage of attack type Hero and damage type Normal
                              • -------- --------------------------------------------- --------
                              • -------- The 'isaclone' boolean is set, so that the pick from the group above doesn't count the clones from an enemy's clone machine. --------
                              • -------- --------------------------------------------- --------
                              • Hashtable - Save True as (Key isaclone) of (Key (Last created unit)) in CM_Hash
                              • -------- --------------------------------------------- --------
                              • -------- --------------------------------------------- --------
                              • Special Effect - Create a special effect attached to the chest of CM_CloneLoad using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • -------- --------------------------------------------- --------
                              • -------- This will replace the previous unit, stored in the clone machine. The previous unit was the random unit, that we picked with the --------
                              • -------- Unit Group - Pick every unit method. Now, it overwrites that unit, by storing the newly created clone -saving space issues-. --------
                              • -------- --------------------------------------------- --------
                              • Hashtable - Save Handle Of(Last created unit) as (Key clone) of (Key (Picked unit)) in CM_Hash
                            • Else - Actions
                              • -------- --------------------------------------------- --------
                              • -------- The following will move the lightning towards the offset points we create. --------
                              • -------- --------------------------------------------- --------
                              • Hashtable - Save (CM_Offset + 20.00) as (Key offset) of (Key (Picked unit)) in CM_Hash
                              • -------- --------------------------------------------- --------
                              • -------- --------------------------------------------- --------
                              • Custom script: call MoveLightningEx (udg_CM_LightLoad,false, GetLocationX(udg_CM_Points[1]),GetLocationY(udg_CM_Points[1]),GetLocationZ(udg_CM_Points[1])+100,GetLocationX(udg_CM_Points[3]),GetLocationY(udg_CM_Points[3]),GetLocationZ(udg_CM_Points[3])+50)
                              • -------- --------------------------------------------- --------
                              • -------- --------------------------------------------- --------
                          • Custom script: call RemoveLocation (udg_CM_Points[3])
                        • Else - Actions
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Set CM_Points[4] = (CM_Points[2] offset by 20.00 towards (Angle from CM_Points[2] to CM_Points[1]) degrees)
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • CM_CloneLoad Not equal to No unit
                            • Then - Actions
                              • Custom script: call MoveLightningEx (udg_CM_LightLoad,false,GetLocationX(udg_CM_Points[1]),GetLocationY(udg_CM_Points[1]),GetLocationZ(udg_CM_Points[1])+100,GetLocationX(udg_CM_Points[2]),GetLocationY(udg_CM_Points[2]),GetLocationZ(udg_CM_Points[2])+50)
                            • Else - Actions
                          • -------- --------------------------------------------- --------
                          • -------- Moving the clone towards the clone machine. --------
                          • -------- --------------------------------------------- --------
                          • Unit - Move CM_CloneLoad instantly to CM_Points[4]
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Distance between CM_Points[1] and CM_Points[2]) Less than or equal to 24.00
                            • Then - Actions
                              • Lightning - Destroy CM_LightLoad
                              • -------- --------------------------------------------- --------
                              • -------- Kill the clone, when it gets too close to the machine, as if it gets absorbed by it. --------
                              • -------- --------------------------------------------- --------
                              • Hashtable - Clear all child hashtables of child (Key (Load (Key clone) of (Key (Picked unit)) in CM_Hash)) in CM_Hash
                              • Unit - Remove CM_CloneLoad from the game
                              • -------- --------------------------------------------- --------
                              • -------- Countdown for the units already grabbed, until we reach 0 units = destruction of the machine. --------
                              • -------- --------------------------------------------- --------
                              • Hashtable - Save (CM_LeftUnitsLoad - 1) as (Key maxcount) of (Key (Picked unit)) in CM_Hash
                            • Else - Actions
                          • -------- --------------------------------------------- --------
                          • -------- --------------------------------------------- --------
                          • Custom script: call RemoveLocation (udg_CM_Points[4])
                      • Custom script: call RemoveLocation (udg_CM_Points[2])
                  • Custom script: call RemoveLocation (udg_CM_Points[1])
                • Else - Actions
                  • Lightning - Destroy (Load (Key lightning) of (Key (Picked unit)) in CM_Hash)
                  • Unit Group - Pick every unit in (Load (Key group) of (Key (Picked unit)) in CM_Hash) and do (Actions)
                    • Loop - Actions
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in CM_Hash
                      • Unit - Kill (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load (Key isaclone) of (Key (Load (Key clone) of (Key (Picked unit)) in CM_Hash)) from CM_Hash) Equal to True
                    • Then - Actions
                      • Unit - Kill (Load (Key clone) of (Key (Picked unit)) in CM_Hash)
                    • Else - Actions
                  • Unit - Kill (Picked unit)
                  • Custom script: call DestroyGroup (LoadGroupHandle (udg_CM_Hash, GetHandleId(GetEnumUnit()), StringHash("group")))
JASS:
function HowMuch takes nothing returns integer
    return 3 //This value will be used to be devided by the sumup value: sumup/count, where count = HowMuch() = this very function.
endfunction

function WhichAbility takes nothing returns integer
    return 'A001' //The rawcode of the life bonus ability.
endfunction

function TimedBonusRemoval takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId (t)
    local unit u = LoadUnitHandle (udg_CM_Hash, id, StringHash("caster"))
    local integer bonus = LoadInteger (udg_CM_Hash, id, StringHash("bonus"))
    local integer i = WhichAbility()

    set bonus = -bonus

    loop
        exitwhen bonus == 0
        call UnitAddAbility(u, i)
        if bonus >= 100 then
            set bonus = bonus + 100
            call SetUnitAbilityLevel(u, i, 7)
        elseif bonus >= 10 then
            set bonus = bonus + 10
            call SetUnitAbilityLevel(u, i, 6)
        else
            set bonus = bonus + 1
            call SetUnitAbilityLevel(u, i, 5)
        endif
        call UnitRemoveAbility(u, i)
    endloop

    call SetUnitTimeScalePercent (u, 100)
    call UnitRemoveAbility (u, 'B000')
    call FlushChildHashtable (udg_CM_Hash, id)
    call DestroyTimer (t)

    set t = null
    set u = null
endfunction

function PickUp takes nothing returns nothing
    local unit u = GetEnumUnit()
    call FlushChildHashtable (udg_CM_Hash, GetHandleId (u))
    call KillUnit (u)
    set u = null
endfunction

function Trig_Clone_Machine_3_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local timer t = CreateTimer()
    local integer id = GetHandleId (u)
    local integer id2 = GetHandleId (t)
    local unit caster = LoadUnitHandle (udg_CM_Hash, id, StringHash("caster"))
    local integer count = HowMuch()
    local real sumup = LoadReal (udg_CM_Hash, id, StringHash("sumup")) / count
    local integer realamount = R2I(sumup)
    local integer i = WhichAbility()
    local unit a
    local group g = LoadGroupHandle (udg_CM_Hash, id, StringHash("group"))

    call DestroyEffect (AddSpecialEffect ("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(u), GetUnitY(u)))
    call RemoveUnit (u)
    call GroupRemoveUnit (udg_CM_CMGroup, u)
    call ForGroup (g, function PickUp)

    if realamount > 0 then

    set a = CreateUnit (GetOwningPlayer(u), 'hfoo', GetUnitX (u), GetUnitY (u), 0)
    call UnitApplyTimedLife (a, 'BTLF', 2)
    call ShowUnit (a, false)
    call UnitAddAbility (a, 'A004')
    call IssueTargetOrder (a, "innerfire", caster)
    call SaveInteger (udg_CM_Hash, id2, StringHash("bonus"), R2I(sumup))
    call SaveUnitHandle (udg_CM_Hash, id2, StringHash("caster"), caster)

    loop
        exitwhen realamount == 0
        call UnitAddAbility(caster, i)
        if realamount >= 100 then
            set realamount = realamount - 100
            call SetUnitAbilityLevel(caster, i, 4)
        elseif realamount >= 10 then
            set realamount = realamount - 10
            call SetUnitAbilityLevel(caster, i, 3)
        else
            set realamount = realamount - 1
            call SetUnitAbilityLevel(caster, i, 2)
        endif
        call UnitRemoveAbility (caster, i)
    endloop

    call SetUnitTimeScalePercent (caster, 300)
    call TimerStart (t, udg_CM_Duration, false, function TimedBonusRemoval)
    call FlushChildHashtable (udg_CM_Hash, id)
   
    endif

    call DestroyGroup (g)
    set u = null
    set t = null
    set caster = null
    set a = null
    set g = null
endfunction

//===========================================================================
function InitTrig_Clone_Machine_3 takes nothing returns nothing
    set gg_trg_Clone_Machine_3 = CreateTrigger(  )
    call TriggerAddAction (gg_trg_Clone_Machine_3, function Trig_Clone_Machine_3_Actions )
endfunction

Credits:

• killst4r for his Temple Teleport System model
• RightField for his ForceGem model
• amarchianbedlam for his Plasma Mortar model

Changelog:

• Replaced the effect, applied as a buff on the hero.
• Removed the scale modification.
• Made a couple of trigger changes.
• Fixed a lightning crash. Credits to D4RK_G4ND4LF for taking the time to analyse the reason; thanx a lot D4RK_G4ND4LF :)

Have fun ;]

Keywords:
clone, illusion, machine, device, goblin, science, scientist, lightning, energy
Contents

Clone Machine (by Pharaoh_) (Map)

Reviews
23:59, 18th Aug 2010 TriggerHappy: Neat effect. You could not use SetUnitTimeScalePercent, the native equivalent is easy.

Moderator

M

Moderator

23:59, 18th Aug 2010
TriggerHappy:

Neat effect.
You could not use SetUnitTimeScalePercent, the native equivalent is easy.
 
Level 5
Joined
Oct 9, 2008
Messages
112
Heyo,

thats realy great! :>
And its not the normal shit like great explosions and stuff like that! :>
I think you can make some special effects better (the buff for the caster, its just overhead something like a aura would be cooler i think).
But like i said its great 4/5! :>
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
I set cooldown to 0 and casted it 3 times and got this
guess the reason for this is the lightning but finding the reason for why the lightning is still accessed athough it got destroyed already will be harder


edit: fixed

Offtopic:
what's the difference between HaveSavedInteger and LoadInteger and why are you allowed to compare it to false?
 

Attachments

  • fatal_error.png
    fatal_error.png
    69 KB · Views: 186
Last edited:
I set cooldown to 0 and casted it 3 times and got this
guess the reason for this is the lightning but finding the reason for why the lightning is still accessed athough it got destroyed already will be harder

Offtopic:
what's the difference between HaveSavedInteger and LoadInteger and why are you allowed to compare it to false?

Well, I'm afraid I will have to go through the code then!
HaveSavedInteger will return boolean, while LoadInteger will return Integer. In the first place you can check if the unit has this value already saved, while the other one will return 0, even if the saved value is 0, so you can't always tell. It's the same thing with testing as "null".

@tjordell, no problem, I can't make a spell perfect to everyone's eyes :]
@Prince.Zero, they are allowed, as soon as you credit the creators; so, if I have a visualized a spell, but the default War3 effects aren't too good, I can't pick custom ones?

Hm, now I really have to define the problem, although I am not sure if I'm able to get it, since I've checked the code thrice, before uploading it.

Thanks everyone for your comments! :]
 
Level 2
Joined
Jul 7, 2009
Messages
9
as i read the topic i thought it would be a spawn which clones units which going through it... That would be funny stuff...So you could make an army of illusions for a short period of time to confuse your enemies :D

Well... It looks kinda strange... the clone mashine and the spheres which flowing arround are looking very nice...but the rest is bit boring...i thought it creates clones from the enemy units which damages them until the unit or the clone mashine dies... and not that there is a little "paff" and the unit getting damaged... not so sure if i saw it right ... but that's what i think ...i would give ya 3/5 because of the quiete nice effects.
 
Aesthetically,spell is awesome,but concept isn't that much. I mean,it just damages enemies around and raises max HP,not much of a concept,still,the effects were really well done and i guess i'll rate it 4/5.

It is mostly a lesson-spell. It impels GUI-eternal lovers to slowly move on to Jass. I also introduce a way of increasing maximum hp with vanilla Jass. All that, combined with some sfx. That's all :]
 
Top