Spell Name: Obscuration (my entry for ZephyrContest#9)
Description:
The hero will be invisible but can't attack and use other spells. In this state, he has a sub ability to teleport an enemy ground unit to the caster's position.
The target is invulnerable and can't move when teleported state and stuns nearby enemy units for 5 seconds. After teleporting, 6 firebolts will hit the target, dealing damage and stun.
|cffffcc00Teleport timer:|r 14 seconds or you can use the Obscuration ability to teleport prematurely and disables the Teleport ability.
Instructions:
- Be sure to check the Automatically create unknown variables while passing trigger data, via File>Preferences>General tab.
- In the object editor, copy all the custom Unit and Abilities to your map.
- Copy all that is written from the Obscuration folder to your map.
- Be sure to input the right configutation from the Setup trigger
Triggers:
Setup
Events
Map initialization
Conditions Actions
-------- The invisibility cast -------- Set OB_CastInvisibility = Obscuration -------- The teleport cast to target -------- Set OB_CastTeleport = Teleport -------- The invisibility ability, NEVER TOUCH THIS coz this is not a custom abiity -------- Set OB_InvisibilityAbil = Ghost -------- The invisibility base duration multiplier -------- Set OB_InvisibilityBaseDuration = 5.00 -------- The effect of the teleport -------- Set OB_SfxTeleport = Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl -------- The dummy SFX of the teleport, this is a unit -------- Set OB_TeleporterType = MDX [Teleporter] -------- This will stun ONLY the enemies in the StunUnitsAoE -------- Set OBT_StunAbil = Stun -------- This will stun and damage the target after being teleported -------- Set OBT_StunAndDamAbil = Stun and Damage -------- Disables the attack of the caster once he is invisible -------- Set OB_DisableAttackAbil = Cargo Hold (Orc Burrow) -------- The dummy caster, in the object editor, the CAST BACKSWING and CAST POINT MUST be 0 -------- -------- Only 1 dummy is created per cast -------- Set OBT_DummyCasterType = DUMMY_CASTER -------- The stunning AOE of all enemies around the target, this should be less than the CAST RANGE of the STUN ability -------- Set OBT_StunUnitsAoE = 500.00 -------- Preloadings, NEVER TOUCH THIS -------- Set OB_Loc1 = (Random point in (Playable map area)) Unit - Create 1 OB_TeleporterType for Neutral Passive at OB_Loc1 facing Default building facing degrees Unit - Kill (Last created unit) Unit - Create 1 OBT_DummyCasterType for Neutral Passive at OB_Loc1 facing Default building facing degrees Unit - Add OBT_StunAbil to (Last created unit) Unit - Add OBT_StunAndDamAbil to (Last created unit) Unit - Add OB_CastTeleport to (Last created unit) Unit - Add OB_DisableAttackAbil to (Last created unit) Unit - Add a 2.00 second Generic expiration timer to (Last created unit) Custom script: call RemoveLocation(udg_OB_Loc1) Custom script: call Preload("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl")
Obscuration
Events
Unit - A unit Starts the effect of an ability
Conditions
Or - Any (Conditions) are true
Conditions
(Ability being cast) Equal to OB_CastInvisibility (Ability being cast) Equal to OB_CastTeleport
Actions
Set OB_Caster = (Triggering unit) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ability being cast) Equal to OB_CastInvisibility
Then - Actions
Set OB_Level = (Level of OB_CastInvisibility for OB_Caster) Custom script: call ExecuteFunc("OB_CastInvisibility")
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ability being cast) Equal to OB_CastTeleport
Then - Actions
Set OB_Level = (Level of OB_CastTeleport for OB_Caster) Custom script: call ExecuteFunc("OB_Teleporting")
Else - Actions
Custom script: endfunction -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -------- Custom script: function OB_TeleportingLoop takes nothing returns nothing For each (Integer OBT_IndexLOOP) from 1 to OBT_Index1, do (Actions)
Loop - Actions
Set OBT_Index2 = OBT_IndexARRAY[OBT_IndexLOOP] If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(OBT_Caster[OBT_Index2] is alive) Equal to True (OBT_Target[OBT_Index2] is alive) Equal to True (Level of OB_InvisibilityAbil for OBT_Caster[OBT_Index2]) Greater than 0
Then - Actions
Set OBT_Waiting[OBT_Index2] = (OBT_Waiting[OBT_Index2] + 0.20) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Waiting[OBT_Index2] Equal to 1.00
Then - Actions
Animation - Play OBT_Portal[OBT_Index2]'s stand animation
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Waiting[OBT_Index2] Equal to 4.00
Then - Actions
Set OB_Loc1 = (Position of OBT_Portal[OBT_Index2]) Set OBT_GroupStun = (Units within OBT_StunUnitsAoE of OB_Loc1 matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of OBT_Portal[OBT_Index2])) Equal to True) and (True Equal to True)))) Unit Group - Pick every unit in OBT_GroupStun and do (Actions)
Loop - Actions
Unit - Order OBT_Portal[OBT_Index2] to Neutral - Firebolt (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Waiting[OBT_Index2] Equal to 13.00
Then - Actions
Set OB_Loc1 = (Position of OBT_Portal[OBT_Index2]) Special Effect - Create a special effect at OB_Loc1 using OB_SfxTeleport Special Effect - Destroy (Last created special effect) Custom script: call RemoveLocation(udg_OB_Loc1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Waiting[OBT_Index2] Equal to 14.00
Then - Actions
Unit - Add a 2.00 second Generic expiration timer to OBT_DamagerU[OBT_Index2] Unit - Make OBT_Target[OBT_Index2] Vulnerable Unit - Unpause OBT_Target[OBT_Index2] Unit - Kill OBT_Portal[OBT_Index2] Set OB_Loc1 = (Position of OBT_Caster[OBT_Index2]) Special Effect - Create a special effect at OB_Loc1 using OB_SfxTeleport Special Effect - Destroy (Last created special effect) Unit - Move OBT_Target[OBT_Index2] instantly to OB_Loc1, facing Default building facing degrees Custom script: call RemoveLocation(udg_OB_Loc1) Set OB_Loc1 = (Position of OBT_Target[OBT_Index2]) Set OBT_Angle = 0.00 For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Set OB_Loc2 = (OB_Loc1 offset by 500.00 towards OBT_Angle degrees) Unit - Move OBT_DamagerU[OBT_Index2] instantly to OB_Loc2, facing Default building facing degrees Unit - Order OBT_DamagerU[OBT_Index2] to Neutral - Firebolt OBT_Target[OBT_Index2] Set OBT_Angle = (OBT_Angle + 60.00) Custom script: call RemoveLocation(udg_OB_Loc2)
Custom script: call RemoveLocation(udg_OB_Loc1)
Else - Actions
Else - Actions
Set OBT_Check[OBT_Index2] = True
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
OBT_Waiting[OBT_Index2] Equal to 14.40 OBT_Check[OBT_Index2] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Check[OBT_Index2] Equal to True
Then - Actions
Unit - Add a 2.00 second Generic expiration timer to OBT_DamagerU[OBT_Index2] Unit - Make OBT_Target[OBT_Index2] Vulnerable Unit - Unpause OBT_Target[OBT_Index2] Set OB_Loc1 = (Position of OBT_Portal[OBT_Index2]) Special Effect - Create a special effect at OB_Loc1 using OB_SfxTeleport Special Effect - Destroy (Last created special effect) Custom script: call RemoveLocation(udg_OB_Loc1) Unit - Kill OBT_Portal[OBT_Index2] Set OB_Loc1 = (Position of OBT_Caster[OBT_Index2]) Special Effect - Create a special effect at OB_Loc1 using OB_SfxTeleport Special Effect - Destroy (Last created special effect) Unit - Move OBT_Target[OBT_Index2] instantly to OB_Loc1, facing Default building facing degrees Custom script: call RemoveLocation(udg_OB_Loc1) Set OB_Loc1 = (Position of OBT_Target[OBT_Index2]) Set OBT_Angle = 0.00 For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Set OB_Loc2 = (OB_Loc1 offset by 500.00 towards OBT_Angle degrees) Unit - Move OBT_DamagerU[OBT_Index2] instantly to OB_Loc2, facing Default building facing degrees Unit - Order OBT_DamagerU[OBT_Index2] to Neutral - Firebolt OBT_Target[OBT_Index2] Set OBT_Angle = (OBT_Angle + 60.00) Custom script: call RemoveLocation(udg_OB_Loc2)
Custom script: call RemoveLocation(udg_OB_Loc1)
Else - Actions
-------- Recycle -------- Set OBT_IndexARRAY[OBT_IndexLOOP] = OBT_IndexARRAY[OBT_Index1] Set OBT_IndexARRAY[OBT_Index1] = OBT_Index2 Set OBT_IndexLOOP = (OBT_IndexLOOP - 1) Set OBT_Index1 = (OBT_Index1 - 1) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Index1 Equal to 0
Then - Actions
Custom script: call PauseTimer(udg_OBT_Timer)
Else - Actions
Else - Actions
Custom script: endfunction -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -------- Custom script: function OB_Teleporting takes nothing returns nothing Set OB_Caster = (Triggering unit) Set OB_Loc1 = (Position of (Target unit of ability being cast)) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Index1 Equal to 0
Then - Actions
Custom script: call TimerStart(udg_OBT_Timer, 0.2, true, function OB_TeleportingLoop)
Else - Actions
Set OBT_Index1 = (OBT_Index1 + 1) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OBT_Index1 Greater than OBT_IndexMAX
Then - Actions
Set OBT_IndexARRAY[OBT_Index1] = OBT_Index1 Set OBT_IndexMAX = OBT_Index1
Else - Actions
Set OBT_Index2 = OBT_IndexARRAY[OBT_Index1] -------- setting all -------- Set OBT_Caster[OBT_Index2] = (Triggering unit) Set OBT_Target[OBT_Index2] = (Target unit of ability being cast) Unit - Pause OBT_Target[OBT_Index2] Unit - Make OBT_Target[OBT_Index2] Invulnerable Set OBT_Waiting[OBT_Index2] = 0.00 Set OBT_Check[OBT_Index2] = False -------- adding the teleporter -------- Unit - Create 1 OB_TeleporterType for (Triggering player) at OB_Loc1 facing Default building facing degrees Set OBT_Portal[OBT_Index2] = (Last created unit) Custom script: call UnitRemoveAbility(bj_lastCreatedUnit,'Amov') Animation - Play (Last created unit)'s birth animation Custom script: call UnitAddAbility(udg_OBT_Portal[udg_OBT_Index2], udg_OBT_StunAbil) -------- adding the damager -------- Unit - Create 1 OBT_DummyCasterType for (Triggering player) at OB_Loc1 facing Default building facing degrees Set OBT_DamagerU[OBT_Index2] = (Last created unit) Unit - Set level of OBT_StunAndDamAbil for OBT_DamagerU[OBT_Index2] to OB_Level Custom script: call UnitRemoveAbility(bj_lastCreatedUnit,'Amov') Custom script: call RemoveLocation(udg_OB_Loc1) Custom script: endfunction -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -------- Custom script: function OB_Looper takes nothing returns nothing For each (Integer OB_InstanceLOOP) from 1 to OB_Instance1, do (Actions)
Loop - Actions
Set OB_Instance2 = OB_InstanceARRAY[OB_InstanceLOOP] If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(OB_CasterAR[OB_Instance2] is alive) Equal to True OB_Dur[OB_Instance2] Greater than or equal to 0.00 (Level of OB_InvisibilityAbil for OB_CasterAR[OB_Instance2]) Greater than 0
Then - Actions
Set OB_Dur[OB_Instance2] = (OB_Dur[OB_Instance2] - 0.10)
Else - Actions
Unit - Remove OB_InvisibilityAbil from OB_CasterAR[OB_Instance2] Unit - Remove OB_DisableAttackAbil from OB_CasterAR[OB_Instance2] Unit - Remove OB_CastTeleport from OB_CasterAR[OB_Instance2] Unit Group - Remove OB_CasterAR[OB_Instance2] from OBT_GroupInvisible -------- Recycle -------- Set OB_InstanceARRAY[OB_InstanceLOOP] = OB_InstanceARRAY[OB_Instance1] Set OB_InstanceARRAY[OB_Instance1] = OB_Instance2 Set OB_InstanceLOOP = (OB_InstanceLOOP - 1) Set OB_Instance1 = (OB_Instance1 - 1) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OB_Instance1 Equal to 0
Then - Actions
Custom script: call PauseTimer(udg_OB_Timer)
Else - Actions
Custom script: endfunction -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -------- Custom script: function OB_CastInvisibility takes nothing returns nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(OB_Caster is in OBT_GroupInvisible) Equal to False
Then - Actions
Unit - Add OB_InvisibilityAbil to OB_Caster Unit - Add OB_DisableAttackAbil to OB_Caster Unit - Add OB_CastTeleport to OB_Caster Unit - Set level of OB_CastTeleport for OB_Caster to OB_Level Unit Group - Add OB_Caster to OBT_GroupInvisible If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OB_Instance1 Equal to 0
Then - Actions
Custom script: call TimerStart(udg_OB_Timer, 0.1, true, function OB_Looper)
Else - Actions
Set OB_Instance1 = (OB_Instance1 + 1) If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OB_Instance1 Greater than OB_InstanceMAX
Then - Actions
Set OB_InstanceARRAY[OB_Instance1] = OB_Instance1 Set OB_InstanceMAX = OB_Instance1
Else - Actions
Set OB_Instance2 = OB_InstanceARRAY[OB_Instance1] -------- setting all -------- Set OB_CasterAR[OB_Instance2] = OB_Caster -------- 10/15/20/25/30 -------- Set OB_Dur[OB_Instance2] = (((Real(OB_Level)) x OB_InvisibilityBaseDuration) + 5.00) Set OB_CheckFunc[OB_Instance2] = True
Else - Actions
Unit - Remove OB_InvisibilityAbil from OB_Caster Unit - Remove OB_DisableAttackAbil from OB_Caster Unit - Remove OB_CastTeleport from OB_Caster Unit Group - Remove OB_Caster from OBT_GroupInvisible
ObscutationCantUse
Events
Unit - A unit Starts the effect of an ability
Conditions
Or - Any (Conditions) are true
Conditions
(Ability being cast) Not equal to OB_CastInvisibility (Ability being cast) Not equal to OB_CastTeleport
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is in OBT_GroupInvisible) Equal to True
Then - Actions
Unit - Order (Triggering unit) to Stop
Else - Actions
Changelogs
v1.1
- Added Sfx and Aoe configurations
- Added more information about the configurations
I really don't like this new 'function/endfunction inside GUI triggers' trend o-o
It's only fine when you place a series of comments in between the functions to make it more readable D:
( -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -------- is not very neat :/)
well I wanted something in different arrangement Mags, I'm sure I did not break any rules regarding the arrangements :)...and I'm exercising my rusty GUI skill, so this will complicate things in my head a bit...
Also, I would suggest avoiding those 'x' spams because they aren't exactly very readable ;/
I did that coz I wanted to create a block for the functions :)...
Quote:
It would be nice if you cache repeated function calls too though. (Like (Triggering player), (Target unit of ability being cast), etc...)
OK, I dont think I need to do this coz the triggering player has only 2 instances and Target has 1 instance..., maybe the last created unit, it has 3 instances...
BTW, this is the first and last time Ima make a spell in this format coz it's really complicated :P...
BIG EDIT:
I changed my mind coz I'm gonna transform this in vJass...