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!
======================================================================================
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
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))
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 --------
-------- 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
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
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...
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.