Dinowc
don't expect anything, prepare for everything
- Reaction score
- 223
I don't know if a similar thing was posted before, but I'd like to show you my first system (don't be harsh on me )
so it's a Polygon/Polyeder system, that allows you to create some standard geometric shapes using lightning effects and some math
this may be improved later, that would include more different shapes
I don't know what to explain more so here's the code with screenshots and the map
I was too bored to make a custom ability, so I used Blizzard spell
you'll have to cast it in order to create a shape
I improved the code
The 2 main shapes:
-prism
View attachment 31112
-pyramid
View attachment 31054
some nice tricks you can do:
View attachment 31064
View attachment 31111
View attachment 31051
View attachment 31147 - I know, it looks ugly in the ss
View attachment 31113 - if you make a polygon like this DON'T overuse it because each of these has over 30 lightning effects, creating only 10 of these results in 300 lightning effects and that may fulfill the array limit and lead to malfunction
IT'S UNFIXABLE
any comment appreciated :thup:
___________
updated (v2.5)
so it's a Polygon/Polyeder system, that allows you to create some standard geometric shapes using lightning effects and some math
this may be improved later, that would include more different shapes
I don't know what to explain more so here's the code with screenshots and the map
I was too bored to make a custom ability, so I used Blizzard spell
you'll have to cast it in order to create a shape
I improved the code
JASS:
//====================================//
// DINOWC'S POLYGON/POLYEDER SYSTEM //
//====================================//
//
// Configuration:
// 1. Copy the above code into trigger editor
// 2. Make a custom ability and use it's raw code to run the trigger
// 3. I suck at explaining so I hope you'll get it <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" />
//
// Pros:
// I don't like showing off so you say the positive stuff <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" />
//
// Cons:
// Shapes cannot be changed ingame... what you set here, stays.
// It's very easy to reach array limit cause of mass lightning effects, so I highly recommend not to set total N in 1 instance (before the timer expires) to greater than 200 - the more polygons you create, the less N should be and vice versa (more N, less polygons) or set timer's duration to lower value instead
//
// HOW TO USE?
//
// LIGHTNING - raw code of the lightning effect
// x,y - polygon's center coordinates
// StartHeight - starting height of the polygon set to higher value than Height and it will be upside-down
// Height - polygon's Z
// radius - polygon's width
// StartingAngle - determines polygon's rotation
// N - number of sides/angles
// Duration - duration of the polygon (seconds)
//
scope Polygons initializer init
private struct data
lightning array l[200] //the more the N is, the less the array size should be
integer N
integer ptype
endstruct
globals
private constant integer ID = 039;AHbz039;
private constant string light = "DRAM" //I used mana drain effect
private integer count = 0
private integer b = 0
private data array D
endglobals
private function conditions takes nothing returns boolean
return GetSpellAbilityId() == ID
endfunction
private function PolarX takes real x, real dist, real angle returns real
return x + dist * Cos(angle * bj_DEGTORAD)
endfunction
private function PolarY takes real y, real dist, real angle returns real
return y + dist * Sin(angle * bj_DEGTORAD)
endfunction
private function DestroyLight takes nothing returns nothing
local integer a = 0
local integer i = 0
local timer t = GetExpiredTimer()
local data d
set b = b - 1
set d = D[0]
loop
call DestroyLightning(d.l[a])
set d.l[a] = null
set a = a + 1
exitwhen a > d.N + (d.ptype * d.N)
endloop
call d.destroy()
loop
set D<i> = D[i+1]
set i = i + 1
exitwhen i == count
endloop
set count = count - 1
if b == 0 then
set count = 0
endif
call DestroyTimer(t)
set t = null
endfunction
public function Pyramid takes string LIGHTNING, real x, real y, real StartHeight, real Height, real radius, real StartingAngle, integer N, real Duration returns nothing
local data d = data.create()
local timer T = CreateTimer()
local integer i = 0
local real distance = radius
local real Height2 = StartHeight
local real angleI = 360.00 / I2R(N)
set StartingAngle = StartingAngle - angleI
set d.ptype = 1
set d.N = N
loop
set d.l<i> = AddLightningEx(LIGHTNING, false, PolarX(x,radius,StartingAngle), PolarY(y,radius,StartingAngle), StartHeight, PolarX(x,distance,StartingAngle + angleI), PolarY(y,distance,StartingAngle + angleI), Height2)
set StartingAngle = StartingAngle + angleI
if i >= N then
set distance = 0.00
set Height2 = Height
endif
set i = i + 1
exitwhen i > N + N
endloop
call TimerStart(T, Duration, false, function DestroyLight)
set D[count] = d
set b = b + 1
set count = count + 1
set T = null
endfunction
public function Prism takes string LIGHTNING, real x, real y, real StartHeight, real Height, real radius, real StartingAngle, integer N, real Duration returns nothing
local data d = data.create()
local timer T = CreateTimer()
local integer i = 0
local real heightI = StartHeight
local real angleI = 360.00 / I2R(N)
set StartingAngle = StartingAngle - angleI
set d.ptype = 2
set d.N = N
loop
set d.l<i> = AddLightningEx(LIGHTNING, false, PolarX(x,radius,StartingAngle), PolarY(y,radius,StartingAngle), StartHeight, PolarX(x,radius,StartingAngle + angleI), PolarY(y,radius,StartingAngle + angleI), heightI)
set angleI = 360.00 / I2R(N)
set StartingAngle = StartingAngle + angleI
if i >= N and i < N + N then
set angleI = 0.00
set heightI = Height
endif
if i >= N + N then
set angleI = 360.00 / I2R(N)
set StartHeight = Height
endif
set i = i + 1
exitwhen i > N * 3
endloop
call TimerStart(T, Duration, false, function DestroyLight)
set D[count] = d
set b = b + 1
set count = count + 1
set T = null
endfunction
public function Face takes string LIGHTNING, real x, real y, real Height, real radius, real StartingAngle, integer N, real Duration returns nothing
local data d = data.create()
local timer T = CreateTimer()
local integer i = 0
local real angleI = 360.00 / I2R(N)
set StartingAngle = StartingAngle - angleI
set d.ptype = 0
set d.N = N
loop
set d.l<i> = AddLightningEx(LIGHTNING, false, PolarX(x,radius,StartingAngle), PolarY(y,radius,StartingAngle), Height, PolarX(x,radius,StartingAngle + angleI), PolarY(y,radius,StartingAngle + angleI), Height)
set StartingAngle = StartingAngle + angleI
set i = i + 1
exitwhen i > N
endloop
call TimerStart(T, Duration, false, function DestroyLight)
set D[count] = d
set b = b + 1
set count = count + 1
set T = null
endfunction
private function actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location target = GetSpellTargetLoc()
local real angle = GetUnitFacing(caster)
local real x = GetLocationX(target)
local real y = GetLocationY(target)
call Prism(light, x, y, 0.00, 300.00, 400.00, angle, 4, 5.00)
call Pyramid(light, x, y, 300.00, 500.00, 400.00, angle, 4, 5.00)
call RemoveLocation(target)
set caster = null
set target = null
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(t, Condition(function conditions))
call TriggerAddAction(t, function actions)
endfunction
endscope</i></i></i></i>
The 2 main shapes:
-prism
View attachment 31112
-pyramid
View attachment 31054
some nice tricks you can do:
View attachment 31064
View attachment 31111
View attachment 31051
View attachment 31147 - I know, it looks ugly in the ss
View attachment 31113 - if you make a polygon like this DON'T overuse it because each of these has over 30 lightning effects, creating only 10 of these results in 300 lightning effects and that may fulfill the array limit and lead to malfunction
IT'S UNFIXABLE
any comment appreciated :thup:
___________
updated (v2.5)