Trollvottel
never aging title
- Reaction score
- 262
Import Difficulty: low-middle
GUI/Jass: Jass
vJass: yes, my first vJass spell
Leakless: I think so
Screenshot:
First(standart):
Second(with lifedrain):
Third(with lifedrain and transparency):
Code:
*update: you can now choose the lightning art and the lightning transparency, added a list with the lightning-codes
Have fun <3
I began using vJass this morning please say if and how I can make the coding better
GUI/Jass: Jass
vJass: yes, my first vJass spell
Leakless: I think so
Creates a thunder wheel of three bolts circling around the caster. Enemy units hit by the wheel will be chain lighted.
Screenshot:
First(standart):
Second(with lifedrain):
Third(with lifedrain and transparency):
Code:
JASS:
scope ThunderWheel
// ################################################################
// #How to implement: #
// #1. copy the spell trigger and if necessary the handle system #
// #2. copy the ability and the dummy and the dummy ability #
// #3. change the raw codes below #
// #4. change the values to anything you want #
// #5. have fun and merry christmas #
// ################################################################
globals
private constant integer spellraw = 039;A000039; // Spell raw code
private constant integer dummyspellraw = 039;A001039; // dummy ability's raw code
private constant integer dummyrawcode = 039;h000039; // dummy's raw code
private constant real duration = 10.00 // spell duration
private constant real incr = 5.00 // speed
private constant real maxr = 400.00 // max radius
private constant string ligh = "CLPB" // lightning code
private constant real trans = 1 // transparency (0 = invisible)
endglobals
// Codes for the lightning-color:
// Chain lightning "CLPB"
// Drain "DRAB"
// Life drain "DRAL"
// Mana drain "DRAM"
// Death finger "AFOD"
// Forked lightning "FORK"
// Healing wave "HWPB"
// Magic lasso "LEAS"
// mana burn "MBUR"
// mana lightning "MFPB"
// dunno the name <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /> "SPLK"
//o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
private function Trig_Spell_Conditions takes nothing returns boolean
return GetSpellAbilityId() == spellraw
endfunction
function fx takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local lightning l = GetHandleLightning(t, "light")
local unit u = GetHandleUnit(t, "u")
call PolledWait(1.5)
call DestroyLightning(l)
call SetUnitUserData(u, 0)
set l = null
set t = null
endfunction
function blitz takes unit u returns nothing
local lightning array lz
local real x0 = GetUnitX(u)
local real x1
local real x2
local real y0 = GetUnitY(u)
local real y1
local real y2
local integer int = 0
loop
exitwhen int > 10
set int = int + 1
set x1 = x0 + 50 * Cos(int *36.00 * bj_DEGTORAD)
set y1 = y0 + 50 * Sin(int *36.00 * bj_DEGTORAD)
set x2 = x0 + 50 * Cos((int-1)*36.00 * bj_DEGTORAD)
set y2 = y0 + 50 * Sin((int-1)*36.00 * bj_DEGTORAD)
set lz[int] = AddLightning(ligh, false, x1, y1, x2, y2)
call SetLightningColor(lz[int], 1,1,1,trans)
call SetHandleHandle(GetTriggeringTrigger(), "light", lz[int])
call SetHandleHandle(GetTriggeringTrigger(), "u", u)
call ExecuteFunc("fx")
call FlushHandleLocals(GetTriggeringTrigger())
endloop
set u = null
endfunction
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
private struct thing
unit C
unit T
real x
real y
real x2
real y2
real angle = 240
real angle2 = 120
real angle3 = 0
real an
real dis = 50
real maxdis = 500
real inc = 5
integer laber = 0
lightning l
lightning ll
lightning l2
lightning ll2
lightning l3
lightning ll3
static method create takes nothing returns thing
local thing init= thing.allocate()
set init.l = AddLightning(ligh, false, GetUnitX(init.C), GetUnitY(init.C), init.x, init.y)
call SetLightningColor(init.l, 1,1,1,trans)
set init.l2 = AddLightning(ligh, false, GetUnitX(init.C), GetUnitY(init.C), init.x, init.y)
call SetLightningColor(init.l2, 1,1,1,trans)
set init.l3 = AddLightning(ligh, false, GetUnitX(init.C), GetUnitY(init.C), init.x, init.y)
call SetLightningColor(init.l3, 1,1,1,trans)
set init.x = GetUnitX(init.C) + init.dis * Cos(init.angle * bj_DEGTORAD)
set init.y = GetUnitY(init.C) + init.dis * Sin(init.angle * bj_DEGTORAD)
set init.ll = AddLightningEx(ligh, false, init.x, init.y, 0.00, init.x, init.y, 1200)
call SetLightningColor(init.ll, 1,1,1,trans)
set init.ll2 = AddLightningEx(ligh, false, init.x, init.y, 0.00, init.x, init.y, 1200)
call SetLightningColor(init.ll2, 1,1,1,trans)
set init.ll3 = AddLightningEx(ligh, false, init.x, init.y, 0.00, init.x, init.y, 1200)
call SetLightningColor(init.ll3, 1,1,1,trans)
return init
endmethod
method MoveIt takes nothing returns nothing
set this.angle = this.angle + this.inc
set this.angle2 = this.angle2 + this.inc
set this.angle3 = this.angle3 + this.inc
set this.x = GetUnitX(this.C) + this.dis * Cos(this.angle * bj_DEGTORAD)
set this.y = GetUnitY(this.C) + this.dis * Sin(this.angle * bj_DEGTORAD)
call MoveLightningEx(this.ll, false, this.x, this.y, 0.00, this.x, this.y, 1200)
call MoveLightning(this.l, false, GetUnitX(this.C), GetUnitY(this.C), this.x,this.y)
set this.an = this.angle
call this.EnumIt()
set this.x = GetUnitX(this.C) + this.dis * Cos(this.angle2 * bj_DEGTORAD)
set this.y = GetUnitY(this.C) + this.dis * Sin(this.angle2 * bj_DEGTORAD)
call MoveLightningEx(this.ll2, false, this.x, this.y, 0.00, this.x, this.y, 1200)
call MoveLightning(this.l2, false, GetUnitX(this.C), GetUnitY(this.C), this.x,this.y)
set this.an = this.angle2
call this.EnumIt()
set this.x = GetUnitX(this.C) + this.dis * Cos(this.angle3 * bj_DEGTORAD)
set this.y = GetUnitY(this.C) + this.dis * Sin(this.angle3 * bj_DEGTORAD)
call MoveLightningEx(this.ll3, false, this.x, this.y, 0.00, this.x, this.y, 1200)
call MoveLightning(this.l3, false, GetUnitX(this.C), GetUnitY(this.C), this.x,this.y)
set this.an = this.angle3
call this.EnumIt()
endmethod
method EnumIt takes nothing returns nothing
local group g = CreateGroup()
local unit u
local integer i = 1
local real x = GetUnitX(this.C)
local real y = GetUnitY(this.C)
loop
set i = i + 20
exitwhen i >= this.dis
set x = x + 20 * Cos(this.an * bj_DEGTORAD)
set y = y + 20 * Sin(this.an * bj_DEGTORAD)
call GroupEnumUnitsInRange(g, x, y, 100, null)
loop
set this.T = FirstOfGroup(g)
call GroupRemoveUnit(g, this.T)
exitwhen this.T == null
if this.T != null and GetUnitUserData(this.T) != 1 and IsUnitEnemy(this.T, GetOwningPlayer(this.C)) and GetUnitState(this.T, UNIT_STATE_LIFE) > 0 then
call SetUnitUserData(this.T, 1)
set u = CreateUnit(GetOwningPlayer(this.C), dummyrawcode, this.x, this.y, 0)
call UnitApplyTimedLife(u, 039;BTLF039;, 2.00)
call UnitAddAbility(u, dummyspellraw)
call SetUnitAbilityLevel(u, dummyspellraw, GetUnitAbilityLevel(this.C, spellraw))
call IssueTargetOrder(u, "chainlightning", this.T)
call blitz(this.T)
endif
endloop
set u = null
call DestroyGroup(g)
set g = CreateGroup()
endloop
set g = null
endmethod
method onDestroy takes nothing returns nothing
call DestroyLightning(this.l)
call DestroyLightning(this.ll)
call DestroyLightning(this.l2)
call DestroyLightning(this.ll2)
call DestroyLightning(this.l3)
call DestroyLightning(this.ll3)
set this.ll = null
set this.ll2 = null
set this.l = null
set this.l2 = null
set this.l3 = null
set this.ll3 = null
set this.T = null
endmethod
endstruct
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
private function times takes nothing returns nothing
local timer t = GetExpiredTimer()
local thing ding = thing(GetHandleInt(t,"struct"))
call ding.MoveIt()
set ding.laber = ding.laber + 10
if ding.laber > ding.maxdis then
if ding.dis >= 60 then
set ding.dis = ding.dis - 10
else
set ding.laber = 0
endif
else
set ding.dis = ding.dis + 10
endif
set t = null
endfunction
private function Trig_Spell_Actions takes nothing returns nothing
local thing ding = thing.create()
local timer t = CreateTimer()
set ding.C = GetTriggerUnit()
set ding.maxdis = maxr
set ding.inc = incr
call SetHandleInt(t, "struct", ding)
call TimerStart(t, 0.03, true, function times)
call PolledWait(duration)
call FlushHandleLocals(t)
call DestroyTimer(t)
//call ding.OnDestroy()
call ding.destroy()
set t = null
endfunction
//==============================================================================================
function InitTrig_Spell takes nothing returns nothing
set gg_trg_Spell = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Spell, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Spell, Condition( function Trig_Spell_Conditions ) )
call TriggerAddAction( gg_trg_Spell, function Trig_Spell_Actions )
endfunction
endscope
*update: you can now choose the lightning art and the lightning transparency, added a list with the lightning-codes
Have fun <3
I began using vJass this morning please say if and how I can make the coding better