Moderator
M
Moderator
22:28, 8th Aug 2013
PurgeandFire: Approved. Cool spell.
Review:
http://www.hiveworkshop.com/forums/2396237-post7.html
PurgeandFire: Approved. Cool spell.
http://www.hiveworkshop.com/forums/2396237-post7.html
//**********************************************************************************************************************
//**********************Spell Create By:
// -Elphis
//*********************Requires:
// - SimpleJumpSystem
// - Linked Lightning
// - DummyRemoved
// - DamageDestructable
// - SpellEffectEvent - http://www.hiveworkshop.com/forums/jass-resources-412/snippet-spelleffectevent-187193/
// - TimerUtils - http://www.wc3c.net/showthread.php?t=101322
// - GroupUtils - http://www.wc3c.net/showthread.php?t=104464
// - DelDX - http://www.hiveworkshop.com/forums/spells-569/delfx-delayed-effects-1-4-2-a-116064/?prev=search%3DDel%2520Effect%26d%3Dlist%26r%3D20%26c%3D112
//*********************Optional:
// - xebasic - http://www.wc3c.net/showthread.php?t=101150
//************Spell Information:
// - Blocking all enemies and allies within certain, making them unable to pass through
// - Level 1: Block in 4 seconds
// - Level 2: Block in 5 seconds
// - Level 3: Block in 6 seconds
// - Level 4: Block in 7 seconds
//*****************Installation:
// - Import/copy the required libraries and Lightning Walls code to your map
// - Import/copy the custom ability and unit to your map and change the SPELL_ID if needed
// - You may view the raw ID of the objects by pressing CTRL+D in the object editor
// - You may play with the configurables below
//***********************************************************************************************************************
library LightningWalls initializer Init uses DestructableHurt,SJS,DummRemove,CheckRawcodeAvailable,Linked,DelFX optional xebasic
//==================================CONFIGURABLES==================================//
globals
//Rawcode of Spell
private constant integer SPELL_ID = 'LNWA'
//Pathing Block Unit
private constant integer PATHING_BLOCK = 'YTpc'
//Wall Count
private constant integer WALLS_COUNT = 10
//Lightning Ball Effect
private constant string LIGHTNING_BALL = "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl"
//Combine with Ball
private constant string LIGHTNING_BALL_COMBINE= "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.mdl"
//Effect when lightning destroyed
private constant string LIGHTNING_EXPLORE = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
//Lightning Attach
private constant string LIGHTNING_ALT = "CLPB"
// Attachment of lightning ball
private constant string ATTACH_BALL = "chest"
// Attachment of lightning ball effect
private constant string ATTACH_BALL_EFFECT = "chest"
// Duration of Walls
private constant real DURATION_BASE = 3.
// Wall Size
private constant real WALLS_SIZE = 1.5
// Distance Between walls created
private constant real WALLS_DISTANCE = 125.
// HEIGHT of Balls
private constant real HEIGHT = 700.
// Safe Timer Will Destroy with Balls (Effect Only)
private constant real SAFE_TIMER = 2.
// Angle of Walls Created
private constant real WALLS_ANGLE = -90.
//==================================CONFIGURABLES==================================//
endglobals
//
//==================================Do not edit anything below==================================//
private function onDuration takes unit u returns real
return DURATION_BASE+GetUnitAbilityLevel(u,SPELL_ID)
endfunction
//
private function onCast takes nothing returns nothing
local integer i = WALLS_COUNT-1
local unit u = GetTriggerUnit()
local real tarx = GetSpellTargetX()
local real tary = GetSpellTargetY()
local real cos = Cos((GetUnitFacing(u)+WALLS_ANGLE)*3.14159/180)
local real sin = Sin((GetUnitFacing(u)+WALLS_ANGLE)*3.14159/180)
local real e = -WALLS_DISTANCE*WALLS_COUNT/2
local real dur = onDuration(u) + SAFE_TIMER
local unit d
local real x
local real y
local unit dd
local destructable des
//
loop
exitwhen i < 0
//
set e = e + WALLS_DISTANCE
set x = tarx + e * cos
set y = tary + e * sin
if RawcodeUnit(XE_DUMMY_UNITID) != null then
set d = CreateUnit(Player(15),XE_DUMMY_UNITID,x,y,bj_UNIT_FACING)
call CreateDelayedEffectTarget(LIGHTNING_BALL,d,ATTACH_BALL,0.,dur)
call CreateDelayedEffectTarget(LIGHTNING_BALL_COMBINE,d,ATTACH_BALL,0.,dur)
call SetUnitScale(d,WALLS_SIZE,WALLS_SIZE,WALLS_SIZE)
set dd = CreateUnit(Player(15),XE_DUMMY_UNITID,x,y,bj_UNIT_FACING)
call CreateDelayedEffectTarget(LIGHTNING_BALL,dd,ATTACH_BALL,0.,dur)
call CreateDelayedEffectTarget(LIGHTNING_BALL_COMBINE,dd,ATTACH_BALL,0.,dur)
call SetUnitScale(dd,WALLS_SIZE,WALLS_SIZE,WALLS_SIZE)
set des = CreateDestructable(PATHING_BLOCK,x,y,0.,1.,0)
call J.Jumping(1.,true,dur-SAFE_TIMER,d,HEIGHT,"",LIGHTNING_EXPLORE,false,true,false,0.)
call LL.LLSU(0.,d,dd,LIGHTNING_ALT,dur)
call D.DesHurt(dur,des)
call Dum.Remove(dd,dur)
else
debug BJDebugMsg("Error: Rawcode of this DUMMY is not Available, please check this rawcode !!")
endif
//
set i = i - 1
endloop
//
set des = null
set u = null
set d = null
set dd = null
endfunction
//
private function Init takes nothing returns nothing
call RegisterSpellEffectEvent(SPELL_ID,function onCast)
endfunction
//
endlibrary
[/HIDDEN]
//I Created xe dummy by Vexorian in your Object, Just create trigger and copy this in your trigger: //! runtextmacro RunXeUnit()
//! textmacro RunXeUnit
//! external ObjectMerger w3u ewsp xeca unam "xe unit" uhpm 1 uabi Aloc,Aeth, umdl "war3mapImported\dummy.mdx" uico "ReplaceableTextures\CommandButtons\BTNtemp.blp" usid 1 usin 1 unsf "(Caster System?)" uble 0.00 ucbs 0.00 umxp 0.00 umxr 0.00 uimz 0.00 ulpz 0.00 uprw 1.00 uspa "" udty Divine umvs 522 ucol 0.00 ufoo 0 uhom 1 umpi 1000 umpm 1000 umpr 1.00 urac Commoner utyp "" ubui "" upgr "" utub "http://wc3campaigns.net/vexorian-External By Elphis" utip ""
//! endtextmacro
//---------------------------------------------
//
//
//! zinc
//
//
//---------------------------------------------
//
library DestructableHurt requires TimerUtils
{
public struct D
{
destructable d;
//
static method Loop()
{
thistype this = GetTimerData(GetExpiredTimer());
if(GetWidgetLife(d) > 0.425)
{
RemoveDestructable(d);
ReleaseTimer(GetExpiredTimer());
d = null;
destroy();
}
}
//
static method DesHurt (real wait,destructable p)
{
thistype this;
if (GetWidgetLife(p) > 0.425)
{
this = allocate();
d = p;
TimerStart(NewTimerEx(this),wait,false,function thistype.Loop);
}
}
}
}
//
library SJS requires TimerUtils,AaD
{
constant real time = .032;
public struct J
{
real Fly;
real Dis;
real ins;
boolean kill;
unit U;
real High;
real d;
real Highsettings;
real Timer;
boolean Ag;
real ag;
boolean Jumpag;
boolean rem;
string EfEnd;
//
real savehigh;
boolean blockhig;
real timeblocking;
//
static method onLoopJ()
{
thistype this = GetTimerData(GetExpiredTimer());
if(IsUnitType(U, UNIT_TYPE_DEAD) != true && GetUnitTypeId(U) != 0)
{
if(d > 0)
d = d - time;
else
{
if (Fly > 0)
{
if(Fly >= savehigh)
{
Timer = Timer + 180/(Dis / 30.);
Fly = Sin(Timer*bj_DEGTORAD)*Highsettings*1.3;
if(blockhig && Fly > savehigh)
savehigh = Fly;
if (Ag == false)
SetUnitFlyHeight(U,Fly,0.);
else
SetUnitFlyHeight(U,Fly/ag,0.);
}
else
{
if(timeblocking > 0)
timeblocking = timeblocking - .032500000;
else
{
blockhig = false;
savehigh = 0.;
}
}
}
else
if (Jumpag == true)
{
Ag = true;
ag = ag + 1;
Fly = 1.;
Timer = 1.;
if (ag > 3.)
{
if(kill && !rem)
KillUnit(U);
if(!kill && rem && ins <= 0)
RemoveUnit(U);
if(!kill && rem && ins > 0)
Dum.Remove(U,ins);
UnitAddAbility(U,'Amrf');
UnitRemoveAbility(U,'Amrf');
SetUnitFlyHeight(U,0.,GetUnitDefaultFlyHeight(U));
DestroyEffect(AddSpecialEffect(EfEnd,GetUnitX(U),GetUnitY(U)));
U = null;
EfEnd = null;
ReleaseTimer(GetExpiredTimer());
destroy();
}
}
else
{
if(kill && !rem)
KillUnit(U);
if(!kill && rem && ins <= 0)
RemoveUnit(U);
if(!kill && rem && ins > 0)
Dum.Remove(U,ins);
UnitAddAbility(U,'Amrf');
UnitRemoveAbility(U,'Amrf');
SetUnitFlyHeight(U,0.,GetUnitDefaultFlyHeight(U));
DestroyEffect(AddSpecialEffect(EfEnd,GetUnitX(U),GetUnitY(U)));
U = null;
EfEnd = null;
ReleaseTimer(GetExpiredTimer());
destroy();
}
}
}
else
{
if(kill && !rem)
KillUnit(U);
if(!kill && rem && ins <= 0)
RemoveUnit(U);
if(!kill && rem && ins > 0)
Dum.Remove(U,ins);
UnitAddAbility(U,'Amrf');
UnitRemoveAbility(U,'Amrf');
SetUnitFlyHeight(U,0.,GetUnitDefaultFlyHeight(U));
U = null;
EfEnd = null;
ReleaseTimer(GetExpiredTimer());
destroy();
}
}
//
static method Jumping(real delay,boolean blockhe,real pauhe,unit wunit,real hei,string XJ,string EJ,boolean jumpags,boolean rems,boolean kills,real inss)
{
thistype this;
if(IsUnitType(wunit, UNIT_TYPE_DEAD) != true && GetUnitTypeId(wunit) != 0 && GetUnitFlyHeight(wunit) <= GetUnitDefaultFlyHeight(wunit)+10)
{
this = allocate();
U = wunit;
Timer = 0.;
Fly = 1.;
blockhig = blockhe;
timeblocking = pauhe;
ins = inss;
d = delay;
rem = rems;
kill = kills;
Dis = hei;
savehigh = 0.;
Jumpag = jumpags;
Ag = false;
ag = 0.5;
EfEnd = EJ;
DestroyEffect(AddSpecialEffect(XJ,GetUnitX(U),GetUnitY(U)));
High = 0.4;
Highsettings = Dis*High;
UnitAddAbility(U,'Amrf');
UnitRemoveAbility(U,'Amrf');
TimerStart(NewTimerEx(this),.032500000,true,function thistype.onLoopJ);
}
}
}
}
//
library AaD
{
public function Distance(real xa,real ya,real xb,real yb) -> real
{
real dx = xb - xa;
real dy = yb - ya;
return SquareRoot(dx * dx + dy * dy);
}
//
public function Angle(real xa,real ya,real xb,real yb) -> real
{
return bj_RADTODEG * Atan2(yb - ya, xb - xa);
}
}
//
library DummRemove requires TimerUtils
{
public struct Dum
{
unit u;
//
static method Loop()
{
thistype this = GetTimerData(GetExpiredTimer());
RemoveUnit(u);
u = null;
ReleaseTimer(GetExpiredTimer());
destroy();
}
//
static method Remove(unit whatunit,real dura) -> unit
{
thistype this = allocate();
u = whatunit;
TimerStart(NewTimerEx(this),dura,false,function thistype.Loop);
return whatunit;
}
}
}
//
library Linked requires TimerUtils
{
public struct LL
{
unit u;
unit tg;
lightning l;
boolean linked;
real time;
real x;
real y;
real w;
//
static method onPeriodic()
{
thistype this = GetTimerData(GetExpiredTimer());
boolean release = false;
//
if(w > 0)
w = w - .04;
else
{
if(!linked)
{
if(IsUnitType(u,UNIT_TYPE_DEAD) != true && GetUnitTypeId(u) != 0)
MoveLightningEx(l,true,GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u),x,y,0.);
else
release = true;
}
else
{
if(IsUnitType(u,UNIT_TYPE_DEAD) != true && GetUnitTypeId(u) != 0 && IsUnitType(tg,UNIT_TYPE_DEAD) != true && GetUnitTypeId(tg) != 0)
MoveLightningEx(l,true,GetUnitX(u),GetUnitY(u),GetUnitFlyHeight(u),GetUnitX(tg),GetUnitY(tg),GetUnitFlyHeight(tg));
else
release = true;
}
//
if(time > 0)
time = time - .04;
else
release = true;
//
}
//
if(release)
{
DestroyLightning(l);
ReleaseTimer(GetExpiredTimer());
u = null;
destroy();
}
}
//
static method LLSU(real wait,unit us,unit tgs,string ls,real times)
{
thistype this = allocate();
u = us;
tg = tgs;
time = times;
w = wait;
linked = true;
l = AddLightning(ls,true,GetUnitX(u),GetUnitY(u),x,y);
TimerStart(NewTimerEx(this),.04,true,function thistype.onPeriodic);
}
}
}
//
//! endzinc
[/HIDDEN]