• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Construction On Site (Clone a Building) 2.11

  • Like
Reactions: deepstrasz
======================================================================================
Construction On Sight
eubz
======================================================================================
What does this spell do?
This custom spell creates any structure within AoE of the caster.
The built structure depends on the structure type within AoE of the caster.
The structure being copied is destroyed and creates the same structure for the owner
of the caster.
HOW TO USE:
1. Just copy all the vcariables, triggers and the custom ability into your map.

NOTE:
Do not forget to give credits to me if you use this in your map

Thank you,
eubz
--------------------------------------------------------------------------------------

  • CCH init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ================================================ --------
      • -------- do some editing here --------
      • -------- do not go beyond 150 to 300... --------
      • Set CCH_AoE = 300.00
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- construction time in seconds --------
      • Set CCH_ConstTime = 10
      • Set CCH_ConstantDeductTime = 2
      • -------- time is 8, 6, 4 sec if used for heroes --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- SFX --------
      • Set CCH_SFX = Abilities\Spells\Orc\Voodoo\VoodooAura.mdl
      • Set CCH_CasterSFXPT = origin
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- gold cost --------
      • Set CCH_cost_gold = 760
      • Set CCH_ConstantDeductGold = 10
      • -------- gold cost is 750, 740, 730 --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- lumber cost --------
      • Set CCH_cost_lumber = 315
      • Set CCH_ConstantDeductLumber = 5
      • -------- lumber cost is 310, 305, 300 --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- the sound used if the construction is complete --------
      • Set CCH_Sound = AcolyteBuildingComplete1 <gen>
      • -------- ================================================ --------
      • Set CCH_CasterAnim = Stand Work Gold
      • -------- ================================================ --------
  • ConstructionOnSight Hero
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Construction On Sight [|cff00ff00Q|r] (Hero)
    • Actions
      • -------- ================================================ --------
      • -------- /////////////////endixing the spell//////////////////// --------
      • -------- /////////////this is to make the spell MUI/////////////////////// --------
      • Set CCH_size = (CCH_size + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CCH_size Greater than CCH_max_size
        • Then - Actions
          • Set CCH_index[CCH_size] = CCH_size
          • Set CCH_max_size = CCH_size
        • Else - Actions
      • Set CCH_integer = CCH_index[CCH_size]
      • -------- /////////////////end of indexing////////////////// --------
      • -------- ================================================ --------
      • -------- /////////////////variable sets/////////////////// --------
      • Set CCH_caster[CCH_integer] = (Triggering unit)
      • Set CCH_CasterOwner = (Owner of CCH_caster[CCH_integer])
      • Set CCH_level = (Level of Construction On Sight [|cff00ff00Q|r] (Hero) for CCH_caster[CCH_integer])
      • Set CCH_costGold[CCH_integer] = (CCH_cost_gold - (CCH_ConstantDeductGold x CCH_level))
      • Set CCH_costLumber[CCH_integer] = (CCH_cost_lumber - (CCH_ConstantDeductLumber x CCH_level))
      • Set CCH_Area[CCH_integer] = CCH_AoE
      • Set CCH_CurrentLumber = (CCH_CasterOwner Current lumber)
      • Set CCH_CurrentGold = (CCH_CasterOwner Current gold)
      • Set CCH_SoundPlayed[CCH_integer] = CCH_Sound
      • Set CCH_CasterPos = (Position of CCH_caster[CCH_integer])
      • Set CCH_buildings = (Units within CCH_Area[CCH_integer] of CCH_CasterPos matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) belongs to an enemy of CCH_CasterOwner) Equal to True)))
      • Set CCH_AlliedBuildings = (Units within CCH_Area[CCH_integer] of CCH_CasterPos matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) belongs to an ally of CCH_CasterOwner) Equal to True)))
      • Set CCH_BuildingCreationTime[CCH_integer] = (CCH_ConstTime - (CCH_ConstantDeductTime x CCH_level))
      • Set CCH_Life[CCH_integer] = 10.00
      • -------- end of main variables setting --------
      • -------- ==================================================== --------
      • -------- start of spell actions --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CCH_CurrentLumber Greater than or equal to CCH_costLumber[CCH_integer]
          • CCH_CurrentGold Greater than or equal to CCH_costGold[CCH_integer]
          • (Number of units in CCH_buildings) Equal to 1
          • (CCH_buildings is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in CCH_buildings and do (Actions)
            • Loop - Actions
              • Set CCH_KilledUnit[CCH_integer] = (Picked unit)
              • Unit - Kill CCH_KilledUnit[CCH_integer]
          • Set CCH_ConstLoc = (Position of CCH_KilledUnit[CCH_integer])
          • Player - Set CCH_CasterOwner Current gold to (CCH_CurrentGold - CCH_costGold[CCH_integer])
          • Player - Set CCH_CasterOwner Current lumber to (CCH_CurrentLumber - CCH_costLumber[CCH_integer])
          • Unit - Create 1 (Unit-type of CCH_KilledUnit[CCH_integer]) for (Owner of CCH_caster[CCH_integer]) at CCH_ConstLoc facing Default building facing degrees
          • Set CCH_NewBuildingUnit[CCH_integer] = (Last created unit)
          • Special Effect - Create a special effect attached to the CCH_CasterSFXPT of CCH_caster[CCH_integer] using CCH_SFX
          • Set CCH_HeroEffect[CCH_integer] = (Last created special effect)
          • Selection - Select CCH_NewBuildingUnit[CCH_integer] for (Owner of CCH_caster[CCH_integer])
          • Unit - Set life of CCH_NewBuildingUnit[CCH_integer] to CCH_Life[CCH_integer]%
          • -------- To prevent the caster to attack any other unit while doing the spell --------
          • Unit - Pause CCH_caster[CCH_integer]
          • Custom script: call RemoveLocation(udg_CCH_ConstLoc)
          • -------- //////////////////looop turned on/////////////////////////////////// --------
          • Trigger - Turn on CCH loop <gen>
          • -------- ============================================================= --------
        • Else - Actions
          • -------- ============================================================= --------
          • -------- //////////////////////Filtered onCast///////////////////////////// --------
          • -------- ============================================================= --------
          • -------- Cannot be casted when there are more than 1 building beside the caster --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in CCH_buildings) Greater than 1
            • Then - Actions
              • Floating Text - Create floating text that reads There are more than... above CCH_caster[CCH_integer] with Z offset 0.00, using font size 10.00, color (10.00%, 100.00%, 10.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
            • Else - Actions
          • -------- cannot be casted if there are no buildings beside the caster --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in CCH_buildings) Equal to 0
              • (Number of units in CCH_AlliedBuildings) Equal to 0
            • Then - Actions
              • Floating Text - Create floating text that reads There are no buildi... above CCH_caster[CCH_integer] with Z offset 0.00, using font size 10.00, color (10.00%, 100.00%, 10.00%), and 0.00% transparency
              • Set CCH_FloatingText = (Last created floating text)
              • Floating Text - Change CCH_FloatingText: Disable permanence
              • Floating Text - Change the fading age of CCH_FloatingText to 1.00 seconds
              • Floating Text - Change the lifespan of CCH_FloatingText to 2.00 seconds
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in CCH_AlliedBuildings) Greater than 0
            • Then - Actions
              • Floating Text - Create floating text that reads The building beside... above CCH_caster[CCH_integer] with Z offset 100.00, using font size 10.00, color (10.00%, 100.00%, 10.00%), and 0.00% transparency
              • Set CCH_FloatingText = (Last created floating text)
              • Floating Text - Change CCH_FloatingText: Disable permanence
              • Floating Text - Change the fading age of CCH_FloatingText to 1.00 seconds
              • Floating Text - Change the lifespan of CCH_FloatingText to 2.00 seconds
            • Else - Actions
          • -------- cannot be casted if the current lumber don't warrant the lumber cost of the spell (not the lumber cost of the building being copied) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CCH_CurrentLumber Less than CCH_costLumber[CCH_integer]
            • Then - Actions
              • Floating Text - Create floating text that reads We need more lumber... above CCH_caster[CCH_integer] with Z offset 0.00, using font size 10.00, color (10.00%, 100.00%, 10.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
            • Else - Actions
          • -------- cannot be casted if the current gold don't warrant the gold cost of the spell (not the gold cost of the building being copied) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CCH_CurrentGold Less than CCH_costGold[CCH_integer]
            • Then - Actions
              • Floating Text - Create floating text that reads We need more gold!!! above CCH_caster[CCH_integer] with Z offset 0.00, using font size 10.00, color (10.00%, 100.00%, 10.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
            • Else - Actions
          • -------- Recycle if the spell is un-used --------
          • Set CCH_index[CCH_loop] = CCH_index[CCH_size]
          • Set CCH_index[CCH_size] = CCH_integer
          • Set CCH_size = (CCH_size - 1)
          • Set CCH_loop = (CCH_loop - 1)
          • -------- ============================================================= --------
      • Custom script: call RemoveLocation(udg_CCH_CasterPos)
      • Custom script: call DestroyGroup(udg_CCH_buildings)
      • Custom script: call DestroyGroup(udg_CCH_AlliedBuildings)
  • CCH loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer CCH_loop) from 1 to CCH_size, do (Actions)
        • Loop - Actions
          • Set CCH_integer = CCH_index[CCH_loop]
          • Set CCH_Life[CCH_integer] = (CCH_Life[CCH_integer] + 15.00)
          • Set CCH_BuildingCreationTime[CCH_integer] = (CCH_BuildingCreationTime[CCH_integer] - 1)
          • Unit - Set life of CCH_NewBuildingUnit[CCH_integer] to CCH_Life[CCH_integer]%
          • Unit - Make CCH_caster[CCH_integer] face CCH_NewBuildingUnit[CCH_integer] over 0.00 seconds
          • Animation - Play CCH_NewBuildingUnit[CCH_integer]'s birth animation
          • Animation - Play CCH_caster[CCH_integer]'s CCH_CasterAnim animation
          • -------- ================================================ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CCH_BuildingCreationTime[CCH_integer] Less than or equal to 0
            • Then - Actions
              • Unit - Set life of CCH_NewBuildingUnit[CCH_integer] to 100.00%
              • Animation - Reset CCH_NewBuildingUnit[CCH_integer]'s animation
              • Animation - Reset CCH_caster[CCH_integer]'s animation
              • Special Effect - Destroy CCH_HeroEffect[CCH_integer]
              • Sound - Play CCH_SoundPlayed[CCH_integer]
              • Unit - Remove CCH_KilledUnit[CCH_integer] from the game
              • Unit - Unpause CCH_caster[CCH_integer]
              • Floating Text - Create floating text that reads Cloning Finished. above CCH_caster[CCH_integer] with Z offset 0.00, using font size 20.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • -------- ===================================================== --------
              • -------- Recycle and turn off this trigger --------
              • Set CCH_index[CCH_loop] = CCH_index[CCH_size]
              • Set CCH_index[CCH_size] = CCH_integer
              • Set CCH_size = (CCH_size - 1)
              • Set CCH_loop = (CCH_loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CCH_size Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • -------- ===================================================== --------
            • Else - Actions
Keywords:
construction, site construction, spell, clone, building clone
Contents

Construct (Map)

Reviews
05:27, 26th Aug 2012 Magtheridon96: Well, it would've been better if you had just not indexed the spell in the cast trigger so that you can check whether it is going to be registered or not without having to recycle the instance, but I guess that's...

Moderator

M

Moderator

05:27, 26th Aug 2012
Magtheridon96: Well, it would've been better if you had just not indexed the spell in the cast trigger so that you can check whether it is going to be registered or not without having to recycle the instance, but I guess that's not a major problem.
It would still be an improvement.
Approved.
 
Top