JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser .
[GUI] Simple Lightning Handling System v1.21 [GUI]
This bundle is marked as recommended . It works and satisfies the submission rules.
INTRODUCTIONS
- This system allows you to create Lightning in 4 ways (Unit2Unit | Unit2Point | Point2Unit | Point2Point)
- It is in GUI (you do not need JNGP to edit this system)
HOW TO USE
- Open World Editor - File - Preferences... - General Tab - Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Lightning Handling System folder.
- Further instructions inside the LH Setup Trigger.
- You can also take a look at the examples (4) and see how do you want to manipulate this system.
TRIGGERS
LH Loop
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
For each (Integer LH_CurrentIndex) from 1 to LH_MaxIndex, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
LH_UnitSource[LH_CurrentIndex] Not equal to No unit
Then - Actions
Custom script: set x1 = GetUnitX(udg_LH_UnitSource[udg_LH_CurrentIndex])
Custom script: set y1 = GetUnitY(udg_LH_UnitSource[udg_LH_CurrentIndex])
Custom script: call MoveLocation(udg_LH_Location, x1, y1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(LH_UnitSource[LH_CurrentIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z1 = GetLocationZ(udg_LH_Location) + udg_LH_UnitZ
Else - Actions
Custom script: set z1 = GetLocationZ(udg_LH_Location) + GetUnitFlyHeight(udg_LH_UnitSource[udg_LH_CurrentIndex])
Else - Actions
Custom script: set x1 = GetLocationX(udg_LH_PointSource[udg_LH_CurrentIndex])
Custom script: set y1 = GetLocationY(udg_LH_PointSource[udg_LH_CurrentIndex])
Custom script: call MoveLocation(udg_LH_Location, x1, y1)
Custom script: set z1 = GetLocationZ(udg_LH_Location) + udg_LH_PointSourceZ[udg_LH_CurrentIndex]
-------- For UnitSource Location --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
LH_UnitTarget[LH_CurrentIndex] Not equal to No unit
Then - Actions
Custom script: set x2 = GetUnitX(udg_LH_UnitTarget[udg_LH_CurrentIndex])
Custom script: set y2 = GetUnitY(udg_LH_UnitTarget[udg_LH_CurrentIndex])
Custom script: call MoveLocation(udg_LH_Location, x2, y2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(LH_UnitTarget[LH_CurrentIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z2 = GetLocationZ(udg_LH_Location) + udg_LH_UnitZ
Else - Actions
Custom script: set z2 = GetLocationZ(udg_LH_Location) + GetUnitFlyHeight(udg_LH_UnitTarget[udg_LH_CurrentIndex])
Else - Actions
Custom script: set x2 = GetLocationX(udg_LH_PointTarget[udg_LH_CurrentIndex])
Custom script: set y2 = GetLocationY(udg_LH_PointTarget[udg_LH_CurrentIndex])
Custom script: call MoveLocation(udg_LH_Location, x2, y2)
Custom script: set z2 = GetLocationZ(udg_LH_Location) + udg_LH_PointTargetZ[udg_LH_CurrentIndex]
-------- For TargetSource Location --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
LH_Duration[LH_CurrentIndex] Greater than 0.00
Then - Actions
Set LH_Duration[LH_CurrentIndex] = (LH_Duration[LH_CurrentIndex] - LH_Interval)
Set LH_LightningAlpha[LH_CurrentIndex] = (LH_LightningAlpha[LH_CurrentIndex] - LH_LightningFadeInterval[LH_CurrentIndex])
Custom script: if udg_LH_LightningAlpha[udg_LH_CurrentIndex] < 0.00 then
Custom script: set udg_LH_Duration[udg_LH_CurrentIndex] = -0.01
Custom script: else
Custom script: call MoveLightningEx(udg_LH_Lightning[udg_LH_CurrentIndex], true, x1, y1, z1, x2, y2, z2)
Custom script: call SetLightningColor(udg_LH_Lightning[udg_LH_CurrentIndex], 1.00, 1.00, 1.00, udg_LH_LightningAlpha[udg_LH_CurrentIndex])
Custom script: endif
Else - Actions
Lightning - Destroy LH_Lightning[LH_CurrentIndex]
Custom script: call RemoveLocation(udg_LH_PointSource[udg_LH_CurrentIndex])
Custom script: call RemoveLocation(udg_LH_PointTarget[udg_LH_CurrentIndex])
Set LH_PointSource[LH_CurrentIndex] = LH_PointSource[LH_MaxIndex]
Set LH_PointTarget[LH_CurrentIndex] = LH_PointTarget[LH_MaxIndex]
Set LH_Duration[LH_CurrentIndex] = LH_Duration[LH_MaxIndex]
Set LH_Lightning[LH_CurrentIndex] = LH_Lightning[LH_MaxIndex]
Set LH_UnitSource[LH_CurrentIndex] = LH_UnitSource[LH_MaxIndex]
Set LH_UnitTarget[LH_CurrentIndex] = LH_UnitTarget[LH_MaxIndex]
Set LH_PointSourceZ[LH_CurrentIndex] = LH_PointSourceZ[LH_MaxIndex]
Set LH_PointTargetZ[LH_CurrentIndex] = LH_PointTargetZ[LH_MaxIndex]
Set LH_LightningName[LH_CurrentIndex] = LH_LightningName[LH_MaxIndex]
Set LH_LightningAlpha[LH_CurrentIndex] = LH_LightningAlpha[LH_MaxIndex]
Set LH_LightningFadeInterval[LH_CurrentIndex] = LH_LightningFadeInterval[LH_MaxIndex]
Set LH_CurrentIndex = (LH_CurrentIndex - 1)
Set LH_MaxIndex = (LH_MaxIndex - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
LH Setup
Events
Conditions
Actions
-------- ---------- --------
-------- DATA CONFIGURABLE --------
-------- LH_UnitZ = The Z adjustment to unit that is classified as Ground Unit (so that the Lightning do not created at base of the unit) --------
Set LH_UnitZ = 50.00
-------- END OF CONFIGURABLE --------
-------- ---------- --------
-------- LIGHTNING NAME --------
-------- CLPB - CHAIN LIGHTNING PRIMARY --------
-------- CLSB - CHAIN LIGHTNING SECONDARY --------
-------- DRAB - DRAIN --------
-------- DRAL - DRAIN LIFE --------
-------- DRAM - DRAIN MANA --------
-------- AFOD - FINGER OF DEATH --------
-------- FORK - FORKED LIGHTNING --------
-------- HWPB - HEALING WAVE PRIMARY --------
-------- HWSB - HEALING WAVE SECONDARY --------
-------- CHIM - LIGHTNING ATTACK --------
-------- LEAS - MAGIC LEASH --------
-------- MBUR - MANA BURN --------
-------- MFPB - MANA FLARE --------
-------- SPLK - SPIRIT LINK --------
-------- ---------- --------
-------- AT ALL TIME, YOU MUST INCLUDE THESE 3 VARIABLES --------
-------- LH_MaxIndex = LH_MaxIndex + 1 --------
-------- LH_Duration[LH_MaxIndex] = Duration of the Lightning --------
-------- LH_LightningName[LH_MaxIndex] = The name of your Lightning (refer above list) --------
-------- ---------- --------
-------- DO NOT TOUCH THIS IF YOU DON'T KNOW WHAT YOU ARE DOING --------
Set LH_CurrentIndex = 0
Set LH_Location = (Center of (Playable map area))
Set LH_Interval = 0.03
Trigger - Add to LH Loop <gen> the event (Time - Every LH_Interval seconds of game time)
-------- INSTRUCTIONS --------
-------- ---------- --------
-------- Requirement for Unit2Unit function --------
-------- ---------- --------
-------- LH_DurationSet = The duration of the Lightning --------
-------- LH_LightningNameSet = The name of the Lighting --------
-------- LH_UnitSourceSet = The source of the Lightning starts from this unit --------
-------- LH_UnitTargetSet = The target of the Lightning from source to this unit --------
-------- ---------- --------
-------- Requirement for Unit2Point function --------
-------- LH_DurationSet = The duration of the Lightning --------
-------- LH_LightningNameSet = The name of the Lighting --------
-------- LH_PointTargetZSet = The Z height of your lightning at target point --------
-------- LH_UnitSourceSet = The Lightning (Source) is attached to this unit --------
-------- LH_PointTargetSet = The Lightning (Target) is attached to this point --------
-------- ---------- --------
-------- Requirement for Point2Unit function --------
-------- LH_DurationSet = The duration of the Lightning --------
-------- LH_LightningNameSet = The name of the Lighting --------
-------- LH_PointSourceZSet = The Z height of Lightning at Source --------
-------- LH_PointSourceSet = The Lightning (Source) is attached to this point --------
-------- LH_UnitTargetSet = The Lightning (Target) is attached to this unit --------
-------- ---------- --------
-------- Requirement for Point2Point function --------
-------- LH_DurationSet = The duration of the Lightning --------
-------- LH_LightningNameSet = The name of the Lighting --------
-------- LH_PointSourceZSet = The Z height of Lightning at Source --------
-------- LH_PointTargetZSet = The Z height of Lightning at Target --------
-------- LH_PointSourceSet = The Lightning (Source) is attached to this point --------
-------- LH_PointTargetSet = The Lightning (Target) is attached to this point --------
-------- ---------- --------
LH Unit2Unit
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
Set LH_MaxIndex = (LH_MaxIndex + 1)
Set LH_Duration[LH_MaxIndex] = LH_DurationSet
Set LH_LightningName[LH_MaxIndex] = LH_LightningNameSet
Set LH_UnitSource[LH_MaxIndex] = LH_UnitSourceSet
Set LH_UnitTarget[LH_MaxIndex] = LH_UnitTargetSet
Set LH_LightningFadeInterval[LH_MaxIndex] = ((1.00 / LH_DurationSet) x LH_Interval)
Set LH_LightningAlpha[LH_MaxIndex] = 1.00
Custom script: set x1 = GetUnitX(udg_LH_UnitSource[udg_LH_MaxIndex])
Custom script: set y1 = GetUnitY(udg_LH_UnitSource[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x1, y1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(LH_UnitSource[LH_MaxIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z1 = GetLocationZ(udg_LH_Location) + udg_LH_UnitZ
Else - Actions
Custom script: set z1 = GetLocationZ(udg_LH_Location) + GetUnitFlyHeight(udg_LH_UnitSource[udg_LH_MaxIndex])
Custom script: set x2 = GetUnitX(udg_LH_UnitTarget[udg_LH_MaxIndex])
Custom script: set y2 = GetUnitY(udg_LH_UnitTarget[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x2, y2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(LH_UnitTarget[LH_MaxIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z2 = GetLocationZ(udg_LH_Location) + udg_LH_UnitZ
Else - Actions
Custom script: set z2 = GetLocationZ(udg_LH_Location) + GetUnitFlyHeight(udg_LH_UnitTarget[udg_LH_MaxIndex])
Custom script: set udg_LH_Lightning[udg_LH_MaxIndex] = AddLightningEx(udg_LH_LightningName[udg_LH_MaxIndex], true, x1, y1, z1, x2, y2, z2)
Trigger - Turn on LH Loop <gen>
LH Unit2Point
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
Set LH_MaxIndex = (LH_MaxIndex + 1)
Set LH_Duration[LH_MaxIndex] = LH_DurationSet
Set LH_LightningName[LH_MaxIndex] = LH_LightningNameSet
Set LH_PointTargetZ[LH_MaxIndex] = LH_PointTargetZSet
Set LH_UnitSource[LH_MaxIndex] = LH_UnitSourceSet
Set LH_PointTarget[LH_MaxIndex] = LH_PointTargetSet
Set LH_LightningFadeInterval[LH_MaxIndex] = ((1.00 / LH_DurationSet) x LH_Interval)
Set LH_LightningAlpha[LH_MaxIndex] = 1.00
Custom script: set x1 = GetUnitX(udg_LH_UnitSource[udg_LH_MaxIndex])
Custom script: set y1 = GetUnitY(udg_LH_UnitSource[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x1, y1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(LH_UnitSource[LH_MaxIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z1 = GetLocationZ(udg_LH_Location) + udg_LH_UnitZ
Else - Actions
Custom script: set z1 = GetLocationZ(udg_LH_Location) + GetUnitFlyHeight(udg_LH_UnitSource[udg_LH_MaxIndex])
Set LH_UnitTarget[LH_MaxIndex] = No unit
Custom script: set x2 = GetLocationX(udg_LH_PointTarget[udg_LH_MaxIndex])
Custom script: set y2 = GetLocationY(udg_LH_PointTarget[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x2, y2)
Custom script: set z2 = GetLocationZ(udg_LH_Location) + udg_LH_PointTargetZ[udg_LH_MaxIndex]
Custom script: set udg_LH_Lightning[udg_LH_MaxIndex] = AddLightningEx(udg_LH_LightningName[udg_LH_MaxIndex], true, x1, y1, z1, x2, y2, z2)
Trigger - Turn on LH Loop <gen>
LH Point2Unit
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
Set LH_MaxIndex = (LH_MaxIndex + 1)
Set LH_Duration[LH_MaxIndex] = LH_DurationSet
Set LH_LightningName[LH_MaxIndex] = LH_LightningNameSet
Set LH_PointSourceZ[LH_MaxIndex] = LH_PointSourceZSet
Set LH_PointSource[LH_MaxIndex] = LH_PointSourceSet
Set LH_UnitTarget[LH_MaxIndex] = LH_UnitTargetSet
Set LH_LightningFadeInterval[LH_MaxIndex] = ((1.00 / LH_DurationSet) x LH_Interval)
Set LH_LightningAlpha[LH_MaxIndex] = 1.00
Set LH_UnitSource[LH_MaxIndex] = No unit
Custom script: set x1 = GetLocationX(udg_LH_PointSource[udg_LH_MaxIndex])
Custom script: set y1 = GetLocationY(udg_LH_PointSource[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x1, y1)
Custom script: set z1 = GetLocationZ(udg_LH_Location) + udg_LH_PointSourceZ[udg_LH_MaxIndex]
Custom script: set x2 = GetUnitX(udg_LH_UnitTarget[udg_LH_MaxIndex])
Custom script: set y2 = GetUnitY(udg_LH_UnitTarget[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x2, y2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(LH_UnitTarget[LH_MaxIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z2 = GetLocationZ(udg_LH_Location) + udg_LH_UnitZ
Else - Actions
Custom script: set z2 = GetLocationZ(udg_LH_Location) + GetUnitFlyHeight(udg_LH_UnitTarget[udg_LH_MaxIndex])
Custom script: set udg_LH_Lightning[udg_LH_MaxIndex] = AddLightningEx(udg_LH_LightningName[udg_LH_MaxIndex], true, x1, y1, z1, x2, y2, z2)
Trigger - Turn on LH Loop <gen>
LH Point2Point
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
Set LH_MaxIndex = (LH_MaxIndex + 1)
Set LH_Duration[LH_MaxIndex] = LH_DurationSet
Set LH_LightningName[LH_MaxIndex] = LH_LightningNameSet
Set LH_PointSourceZ[LH_MaxIndex] = LH_PointSourceZSet
Set LH_PointTargetZ[LH_MaxIndex] = LH_PointTargetZSet
Set LH_PointSource[LH_MaxIndex] = LH_PointSourceSet
Set LH_PointTarget[LH_MaxIndex] = LH_PointTargetSet
Set LH_LightningFadeInterval[LH_MaxIndex] = ((1.00 / LH_DurationSet) x LH_Interval)
Set LH_LightningAlpha[LH_MaxIndex] = 1.00
Set LH_UnitSource[LH_MaxIndex] = No unit
Custom script: set x1 = GetLocationX(udg_LH_PointSource[udg_LH_MaxIndex])
Custom script: set y1 = GetLocationY(udg_LH_PointSource[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x1, y1)
Custom script: set z1 = GetLocationZ(udg_LH_Location) + udg_LH_PointSourceZ[udg_LH_MaxIndex]
Set LH_UnitTarget[LH_MaxIndex] = No unit
Custom script: set x2 = GetLocationX(udg_LH_PointTarget[udg_LH_MaxIndex])
Custom script: set y2 = GetLocationY(udg_LH_PointTarget[udg_LH_MaxIndex])
Custom script: call MoveLocation(udg_LH_Location, x2, y2)
Custom script: set z2 = GetLocationZ(udg_LH_Location) + udg_LH_PointTargetZ[udg_LH_MaxIndex]
Custom script: set udg_LH_Lightning[udg_LH_MaxIndex] = AddLightningEx(udg_LH_LightningName[udg_LH_MaxIndex], true, x1, y1, z1, x2, y2, z2)
Trigger - Turn on LH Loop <gen>
CREDITS
Maker - Inspired by his Lightning System
mckill2009 - Location manipulation of GetLocationZ
Magtheridon96 - Changed user setting style
CHANGELOGS
v1.0
- Initial release
v1.1
- Changed the user setting by turning it to non-array variable
- Changed functions' name to improve readability
v1.2
- Lightning will now fade corresponding with the duration
Keywords:
simple, lightning, handle, handling, system, defskull, index, indexing, thunder, duration, fade.
17:28, 26th Sep 2012
Magtheridon96:
Approved.
This is quite a useful system. The instance stack is efficient and the loop code is short.
17:28, 26th Sep 2012
Magtheridon96:
Approved.
This is quite a useful system. The instance stack is efficient and the loop code is short.
This is why it's better to let the user set some non-array variables which you will eventually store into your system arrays after increasing the index by 1.
My idea is that to create 2 types of same variable, 1 is non-array, and 1 is array, for example;
LH_LightningName0 - This is for user to set it up
LH_LightningName[array] - This is for the code-use
So, the code will
LH_LightningName[LH_MaxIndex] = LH_LightningName0
, BUT by doing this, I will increase the amount of variables, is that okay ?
Currently I have like 5 array variables for the user to set, so I have to create another 5 non-array variable for the user to set, is that okay ?
I'm just afraid creating much variable, that's all.
I FEEL PALADON WAY OF MAKING SYSTEMS MAG96!
I'm just afraid creating much variable, that's all.
You should be more afraid of creating arrays, non-arrays takes no space at all compared to an arrayed variable (which makes it so stupid to use arrays for simple things where you dont use the arrays to the fully like settings damage like Damage[1] = 3 Damage[2] = 4 etc.).
Actually this:
set udg_Unit1 = unitA
set udg_Unit2 = unitB
set udg_Unit3 = unitC
and this:
set udg_Unit[1] = unitA
set udg_Unit[2] = unitB
set udg_Unit[3] = unitC
is technically the same...arrays using [1] is hard to read in indexing...
EDIT:
May I suggest also to replace the names 'LH P2P' and alike to a readable one?...
You should be more afraid of creating arrays, non-arrays takes no space at all compared to an arrayed variable (which makes it so stupid to use arrays for simple things where you dont use the arrays to the fully like settings damage like Damage[1] = 3 Damage[2] = 4 etc.).
Okay, I'll make a copy of each array variable for the user to set, so that they won't mess the code up
Like
LH_LightningName[LH_MaxIndex] = LH_LightningNameSet
Where 'Set' is to acknowledge the variable which should be set by users.
Actually this:
set udg_Unit1 = unitA
set udg_Unit2 = unitB
set udg_Unit3 = unitC
and this:
set udg_Unit[1] = unitA
set udg_Unit[2] = unitB
set udg_Unit[3] = unitC
is technically the same...arrays using [1] is hard to read in indexing...
So what is your point from that comment ?
I'm not using array[1], I used array[indexName] am I ?
May I suggest also to replace the names 'LH P2P' and alike to a readable one?...
Like LH Point2Point ?
So what is your point from that comment ?
I'm not using array[1], I used array[indexName] am I ?
I'm just saying that if you're scared of making so many non-arrayed variables, well dont be coz the outcome will be the same, you're just creating a variable pointing to that unit handle for example...
Updated to v1.1 (read changelog).
Updated to v1.2 (read changelog - require test).
Updated to v1.21
- Fixed Lightning Alpha value when fades out.
Last edited: Sep 29, 2012
It doesnt support any custom colors,hard for those beginners who doesnt know how to use it.
Hey guys how to easily change the height of triggered lightning .??
ow , now I know . i just read the beginers guide to lightning effects
Dont double post,you might get banned.
Just click the edit button
Everyting in the instructions, or do I need to read it for you -,-"
Would have been better if the fadings are also configurable but still useful system, 4.5/5 !