Background:
There are 3 masts of which each have 7 sails of which each have 4 unclipping points.
The int-array SailStatus gives the status of the sails. Each sail (on each mast) has an element in the array (i.e. 0 is for sail 0 on mast 0, 1 is for sail 1 on mast 0, ..., 7 is for sail 0 on mast 1).
The int-array RiggingSailClip gives the status of an unclipping point. Each unclipping point (for each sail on each mast) has an element in the array (i.e. 0-4 is for unclipping points on sail 0 on mast 0, ...).
I am having trouble with some code for which the event is a unit entering a region (many of these regions are added by another trigger). Then the code checks whether the triggering unit is within the first region in a region array and that some variables are satisfied. If the unit is in the first region and the conditions are satisfied then it is given a skill. The conditions relate to a variables in arrays of which the desired variable's position is determined by which mast/sail/unclipping point has been entered; this is why the loop is split into many different loops of varying lengths.
This trigger works with varying success (in some regions it doesn't work at all, other regions have a better success rate). The loops run many many times and I assume this is the problem but cannot see why.
If I check a region/variable then does this leak? I have tried removing the leaks but to no avail.
Any other input into why this is not working/alternative methods would be much appreciated.
Thanks in advance for your help.
Xan
There are 3 masts of which each have 7 sails of which each have 4 unclipping points.
The int-array SailStatus gives the status of the sails. Each sail (on each mast) has an element in the array (i.e. 0 is for sail 0 on mast 0, 1 is for sail 1 on mast 0, ..., 7 is for sail 0 on mast 1).
The int-array RiggingSailClip gives the status of an unclipping point. Each unclipping point (for each sail on each mast) has an element in the array (i.e. 0-4 is for unclipping points on sail 0 on mast 0, ...).
I am having trouble with some code for which the event is a unit entering a region (many of these regions are added by another trigger). Then the code checks whether the triggering unit is within the first region in a region array and that some variables are satisfied. If the unit is in the first region and the conditions are satisfied then it is given a skill. The conditions relate to a variables in arrays of which the desired variable's position is determined by which mast/sail/unclipping point has been entered; this is why the loop is split into many different loops of varying lengths.
This trigger works with varying success (in some regions it doesn't work at all, other regions have a better success rate). The loops run many many times and I assume this is the problem but cannot see why.
If I check a region/variable then does this leak? I have tried removing the leaks but to no avail.
Any other input into why this is not working/alternative methods would be much appreciated.
Thanks in advance for your help.
Xan
-
GiveRiggerSkills
-
Events
-
Unit - A unit enters Mainsail1 <gen>
-
-
Conditions
-
Actions
-
-------- If a fully clipped/partially unclipped sail is ready to be unclipped then a crew member may unclip it --------
-
Game - Display to (All players) the text: Crew entered mast r...
-
-------- Loop: number of unclipping point --------
-
For each (Integer A) from 0 to 4, do (Actions)
-
Loop - Actions
-
-------- Loop: Number of sail --------
-
For each (Integer B) from 0 to 6, do (Actions)
-
Loop - Actions
-
-------- Loop: Number of mast --------
-
For each (Integer IntegerC) from 0 to 2, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(RiggingSailRegion[((IntegerC x 28) + (((Integer B) x 4) + (Integer A)))] contains (Triggering unit)) Equal to True
-
RiggingSailClip[((IntegerC x 28) + (((Integer B) x 4) + (Integer A)))] Equal to 0
-
SailStatus[((IntegerC x 7) + (Integer B))] Equal to 6
-
-
Then - Actions
-
Game - Display to (All players) the text: Unfurl Sail given t...
-
Unit - Add Unfurl Sail to (Triggering unit)
-
Unit - Add Acid Bomb to (Triggering unit)
-
-
Else - Actions
-
Do nothing
-
-
-
-
-
-
-
-
-
-