Is it because I referenced Killing_Hero when setting up the variable Hero Current Kills? Both triggers do the job but the first trigger does it while also issuing an warning.
// Conditions
if (testConds) {
if (!((gv_engine_dialogUp == false))) {
return false;
}
if (!((gv_aITurnUp == false))) {
return false;
}
So what's happening in your first trigger is that:
Killing_Hero = Hero_Array[(Owner of (Triggering unit))] <Unit>
is being initialized for EVERY dying unit, and the dying unit is causing an index that's out of bounds for the Hero_Array. You can fix this by increasing the size of the Hero_Array to account for all possible values for Owner of (Triggering Unit), which should be 16.
This one works but gives the error.
This one works perfectly, but is less beautiful. Plus I just want to know why I would get an error.
Is it because I referenced Killing_Hero when setting up the variable Hero Current Kills? Both triggers do the job but the first trigger does it while also issuing an warning.
It's because in the script, variable declarations come BEFORE the conditions are checked. I c/ped this from my own script:
//--------------------------------------------------------------------------------------------------
// Trigger: Cancel
//--------------------------------------------------------------------------------------------------
bool gt_Cancel_Func (bool testConds, bool runActions) {
// Variable Declarations
int lv_jumpAbility;
// Variable Initialization
lv_jumpAbility = 0;
// Conditions
if (testConds) {
if (!((gv_engine_dialogUp == false))) {
return false;
}
if (!((gv_aITurnUp == false))) {
return false;
}
So what's happening in your first trigger is that:
Killing_Hero = Hero_Array[(Owner of (Triggering unit))] <Unit>
is being initialized for EVERY dying unit, and the dying unit is causing an index that's out of bounds for the Hero_Array. You can fix this by increasing the size of the Hero_Array to account for all possible values for Owner of (Triggering Unit), which should be 16.
@xenrathe: Go
Thanks for the help. Is there a reason why they have the variables before the conditions?
@KelvCM: Go
I'm sure there's a compile reason, but I couldn't say.