My third and final question in the set:
How Do I Attach Item Tables to Newly Created Units?
and
When This Unit Dies Game Crashes. Why?
Well here goes:
Hey guys, let me tell you this one is pretty complicated and annoying, I suspect no one but Darg himself could figure it out:
I'm attempting to make a code that destroys the entrance and exit you could say, of any pair of waygates in which one of the waygates dies. (The gates are NOT pre-placed and are vulnerable to regular attacks.)
Here is a slightly bugged code I am trying to use:
Code
function your_trigger_actions takes nothing returns nothing
local unit u = GetDyingUnit()
local integer i = 0
loop
exitwhen ( GetBooleanOr( udg_WaygateA = u, udg_WaygateB = u )) %<--Problem%
set i = ( i + 1 )
endloop
set u = null
call ExplodeUnitBJ( udg_WaygateA )
call ExplodeUnitBJ( udg_WaygateB )
endfunction
For some reason WE says that it has an error and says it's expecting a "==" in the line indicated above.
But skipping over that let me tell you something about this code. It uses two global arrays of size 100. Another trigger not stated here stores a number of waygates within both arrays.
%%%%%The Problem I'm Trying to Solve%%%%%
You see the players can build an undetermined amount of waygates in this map. When a waygate finishes construction then a sister waygate will be created via triggers and automatically link up with the built one.
When this occurs the built waygate will also be stored within the index of the array 'WaygateA' and the sister waygate will be stored within the index of the array 'WaygateB'.
Making this even more complicated is the fact that a counter is attached to the indexes of the arrays. Every time a pair of waygates are stored within the pair of arrays the counter will go up by 1 so the next pair of waygates will be stored in the next entry of their corresponding arrays all the way up to 100.
This system makes sure that built and sister waygates all have the same index number in the two arrays so they can be used in the code above.
(Takes a breath) Finally, the code above simply makes it so when a unit dies the trigger will check for whether the dying unit was a waygate stored within either array and if it was attempt to destroy any waygate with the corresponding index number of the dying waygate therefore destroying both the built and sister waygates.
However of course... it doesn't do so for a reason that is beyond me. In fact I believe the loop in the code above may never even exit. But I am unfortunately fairly new at JASS and pretty nasty with its syntax.
Well the bottom line is: A little help guys?
How Do I Attach Item Tables to Newly Created Units?
and
When This Unit Dies Game Crashes. Why?
Well here goes:
Hey guys, let me tell you this one is pretty complicated and annoying, I suspect no one but Darg himself could figure it out:
I'm attempting to make a code that destroys the entrance and exit you could say, of any pair of waygates in which one of the waygates dies. (The gates are NOT pre-placed and are vulnerable to regular attacks.)
Here is a slightly bugged code I am trying to use:
Code
function your_trigger_actions takes nothing returns nothing
local unit u = GetDyingUnit()
local integer i = 0
loop
exitwhen ( GetBooleanOr( udg_WaygateA = u, udg_WaygateB = u )) %<--Problem%
set i = ( i + 1 )
endloop
set u = null
call ExplodeUnitBJ( udg_WaygateA )
call ExplodeUnitBJ( udg_WaygateB )
endfunction
For some reason WE says that it has an error and says it's expecting a "==" in the line indicated above.
But skipping over that let me tell you something about this code. It uses two global arrays of size 100. Another trigger not stated here stores a number of waygates within both arrays.
%%%%%The Problem I'm Trying to Solve%%%%%
You see the players can build an undetermined amount of waygates in this map. When a waygate finishes construction then a sister waygate will be created via triggers and automatically link up with the built one.
When this occurs the built waygate will also be stored within the index of the array 'WaygateA' and the sister waygate will be stored within the index of the array 'WaygateB'.
Making this even more complicated is the fact that a counter is attached to the indexes of the arrays. Every time a pair of waygates are stored within the pair of arrays the counter will go up by 1 so the next pair of waygates will be stored in the next entry of their corresponding arrays all the way up to 100.
This system makes sure that built and sister waygates all have the same index number in the two arrays so they can be used in the code above.
(Takes a breath) Finally, the code above simply makes it so when a unit dies the trigger will check for whether the dying unit was a waygate stored within either array and if it was attempt to destroy any waygate with the corresponding index number of the dying waygate therefore destroying both the built and sister waygates.
However of course... it doesn't do so for a reason that is beyond me. In fact I believe the loop in the code above may never even exit. But I am unfortunately fairly new at JASS and pretty nasty with its syntax.
Well the bottom line is: A little help guys?


