1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Clone Machine v1.2

Submitted by Pharaoh_
This bundle is marked as approved. It works and satisfies the submission rules.
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.

Triggers and Code
  • 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")))

Code (vJASS):
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
Moderator
23:59, 18th Aug 2010 TriggerHappy: Neat effect. You could not use SetUnitTimeScalePercent, the native equivalent is easy.
  1. 23:59, 18th Aug 2010
    TriggerHappy:

    Neat effect.
    You could not use SetUnitTimeScalePercent, the native equivalent is easy.
     
  2. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,604
    Resources:
    1
    Spells:
    1
    Resources:
    1
    This looks interesting, I will test it and post when I can.
     
  3. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    I'm really sorry to say this, but I didn't even like it. Sure I did like the SFX but not the idea...
     
  4. Atami

    Atami

    Joined:
    Oct 9, 2008
    Messages:
    109
    Resources:
    0
    Resources:
    0
    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! :>
     
  5. Prince.Zero

    Prince.Zero

    Joined:
    Jun 6, 2010
    Messages:
    217
    Resources:
    3
    Spells:
    3
    Resources:
    3
    aren't imports not allowed?
     
  6. Lambdadelta

    Lambdadelta

    Joined:
    Jul 6, 2009
    Messages:
    721
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Rules doesn't say that, unless I have missed it.
     
  7. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    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?
     

    Attached Files:

    Last edited: Aug 20, 2010
  8. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    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! :]
     
  9. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    they are allowed as long as they are really needed...

    nice spell, at first I thought it was for making illusions of units since its named clone but no it raises you max hp and deals damage

    Max HP up + Damage to enemy = GREAT
     
  10. eennffoo

    eennffoo

    Joined:
    Jul 7, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    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.
     
  11. Nikola97

    Nikola97

    Joined:
    Nov 30, 2008
    Messages:
    12
    Resources:
    0
    Resources:
    0
    Great spell and it works xD
     
  12. Prince.Zero

    Prince.Zero

    Joined:
    Jun 6, 2010
    Messages:
    217
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Yeah... Imports make things look cool because blizzard's sfx are plain crap. Well most of them.

    But i could swear that i've recalled replies on spells that disallowed imports. Thats why i've asked. But let me rate this :)

    4/5
    +rep
     
  13. Vengeancekael

    Vengeancekael

    Joined:
    Aug 11, 2009
    Messages:
    5,740
    Resources:
    16
    Tools:
    1
    Maps:
    13
    Spells:
    1
    StarCraft II Resources:
    1
    Resources:
    16
    Nice nice, how about you add some sounds when the clone machine is created.
    Also change the testing hero's HP to 9999 or make him invulnerable.
    Also add a command to refresh the spell.
    I've looked through the triggers and I guess everything's fine, good job.
    Again a nice spell made by Pharaoh_ ;)
    4/5
     
  14. Prince.Zero

    Prince.Zero

    Joined:
    Jun 6, 2010
    Messages:
    217
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Meh, this need approval
    +vote
     
  15. x3GlikE

    x3GlikE

    Joined:
    Jul 7, 2010
    Messages:
    658
    Resources:
    0
    Resources:
    0
    Nice dude...
    Could be useful in some maps...

    Gw 4/5
     
  16. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    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.
     
  17. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    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 :]
     
  18. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Why don't you use native effects?
     
  19. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    SetUnitTimeScalePercent


    You can just simply use
    SetUnitTimeScale(myUnit, percentage/ 100)

    Because its a BJ :D