I have a neat idea for a boat-combat level in my campaign. I want the player to control a single boat that is controlled by a custom movement system. In short, the boat moves in its facing direction but also moves in the direction the water current is going. The first is easy to do, but I worry that the second might be too inefficient.
What I need: a system that detects the boat's position, and then sets the water currents direction and strength. In short, I need 2 real variables that change depending on the unit's location on the map.
My plan: cover water area of my entire map with small regions, and whenever the boat enters that region I change the reals.
My questions:
1. Is having many regions inefficient? I will probably have over 100, each with its own trigger to detect entry.
2. Is there a limit to the number of regions you can have?
3. Would it be more efficient to use JASS to get the unit's x and y coordinates every few seconds, and then do a massive string of "if x > 120, x < 250, and y > -1350 and y < -1100; then set CurrentDirection to 250, and CurrentStrength to 5" type triggers? That seems worse to me, but I don't know. I could also use a more intelligent system that zeros in on the location, for example:
- if UnitX > 0 and Unit Y > 0, then run trigger "look in northeast quadrant regions"
- if UnitX > 0 and Unit Y <= 0, then run trigger "look in southeast quadrant regions"
- and so on...
4. Is there a better way that I can't see to set 2 real variables in response to a unit's location on the map?
What I need: a system that detects the boat's position, and then sets the water currents direction and strength. In short, I need 2 real variables that change depending on the unit's location on the map.
My plan: cover water area of my entire map with small regions, and whenever the boat enters that region I change the reals.
My questions:
1. Is having many regions inefficient? I will probably have over 100, each with its own trigger to detect entry.
2. Is there a limit to the number of regions you can have?
3. Would it be more efficient to use JASS to get the unit's x and y coordinates every few seconds, and then do a massive string of "if x > 120, x < 250, and y > -1350 and y < -1100; then set CurrentDirection to 250, and CurrentStrength to 5" type triggers? That seems worse to me, but I don't know. I could also use a more intelligent system that zeros in on the location, for example:
- if UnitX > 0 and Unit Y > 0, then run trigger "look in northeast quadrant regions"
- if UnitX > 0 and Unit Y <= 0, then run trigger "look in southeast quadrant regions"
- and so on...
4. Is there a better way that I can't see to set 2 real variables in response to a unit's location on the map?