- Joined
- Mar 15, 2012
- Messages
- 2,885
Lightning Unit to Unit system
This is an example and a system in progress to show a possible better method of lightning manipulation.
[trigger=]
hashtable
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Hashtable - Create a hashtable
Set DatTable = (Last created hashtable)
[/trigger]
[jass=]
function yays takes nothing returns nothing
local unit u=LoadUnitHandle(udg_DatTable,GetHandleId(GetTriggeringTrigger()),StringHash("da"))
local trigger t=LoadTriggerHandle(udg_DatTable,GetHandleId(GetTriggeringTrigger()),StringHash("trig"))
call IssueImmediateOrder(u,"unravenform")
call IssuePointOrder(u,"move",GetUnitX(u),GetUnitY(u)) // this is to fix the animation bug which is unit death
set u=null
call DestroyTrigger(t)
set t=null
endfunction[/code]
[trigger=]
lu2u main
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Set groupint = 0
Set groupint2 = 0
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
Loop - Actions
Set groupint = (groupint + 1)
Set grouped[groupint] = (Picked unit)
Custom script: loop
Custom script: exitwhen udg_groupint2 == udg_groupint
Set groupint2 = (groupint2 + 1)
Trigger - Run lu2u run <gen> (ignoring conditions)
Custom script: endloop
[/trigger]
[trigger=]
lu2u run
Events
Conditions
Actions
Custom script: local trigger t=CreateTrigger()
Set u = grouped[groupint2]
Unit - Add Crow Form to u
Custom script: call IssueImmediateOrder(udg_u,"ravenform")
Custom script: call SaveUnitHandle(udg_DatTable,GetHandleId(t),StringHash("da"),udg_u)
Custom script: call SaveTriggerHandle(udg_DatTable,GetHandleId(t),StringHash("trig"),t)
Custom script: call TriggerRegisterTimerEvent(t,0.01,false)
Custom script: call TriggerAddCondition(t,Condition(function yays))
[/trigger]
A bug was recently revealed to me thanks to GhostHunter123, it seems that every lightning attach can only handle 1 lightning at a time so even though this is sadly limiting it doesn't wreck anything. Just have to look at it from a different angle for example look at it like a projectile system instead. Even though a dummy unit can be in more then one spot at once it doesn't look good due to the dummy unit flashing at high speeds.
Though if anyone finds a workaround to this then I would really appreciate it being shared.
This is an example and a system in progress to show a possible better method of lightning manipulation.
[trigger=]
hashtable
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Hashtable - Create a hashtable
Set DatTable = (Last created hashtable)
[/trigger]
[jass=]
function yays takes nothing returns nothing
local unit u=LoadUnitHandle(udg_DatTable,GetHandleId(GetTriggeringTrigger()),StringHash("da"))
local trigger t=LoadTriggerHandle(udg_DatTable,GetHandleId(GetTriggeringTrigger()),StringHash("trig"))
call IssueImmediateOrder(u,"unravenform")
call IssuePointOrder(u,"move",GetUnitX(u),GetUnitY(u)) // this is to fix the animation bug which is unit death
set u=null
call DestroyTrigger(t)
set t=null
endfunction[/code]
[trigger=]
lu2u main
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Set groupint = 0
Set groupint2 = 0
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
Loop - Actions
Set groupint = (groupint + 1)
Set grouped[groupint] = (Picked unit)
Custom script: loop
Custom script: exitwhen udg_groupint2 == udg_groupint
Set groupint2 = (groupint2 + 1)
Trigger - Run lu2u run <gen> (ignoring conditions)
Custom script: endloop
[/trigger]
[trigger=]
lu2u run
Events
Conditions
Actions
Custom script: local trigger t=CreateTrigger()
Set u = grouped[groupint2]
Unit - Add Crow Form to u
Custom script: call IssueImmediateOrder(udg_u,"ravenform")
Custom script: call SaveUnitHandle(udg_DatTable,GetHandleId(t),StringHash("da"),udg_u)
Custom script: call SaveTriggerHandle(udg_DatTable,GetHandleId(t),StringHash("trig"),t)
Custom script: call TriggerRegisterTimerEvent(t,0.01,false)
Custom script: call TriggerAddCondition(t,Condition(function yays))
[/trigger]
A bug was recently revealed to me thanks to GhostHunter123, it seems that every lightning attach can only handle 1 lightning at a time so even though this is sadly limiting it doesn't wreck anything. Just have to look at it from a different angle for example look at it like a projectile system instead. Even though a dummy unit can be in more then one spot at once it doesn't look good due to the dummy unit flashing at high speeds.
Though if anyone finds a workaround to this then I would really appreciate it being shared.
Attachments
Last edited: