- Joined
- Apr 26, 2014
- Messages
- 211
- Reaction score
- 39
- First Language
- English
- Primarily Uses
I've managed to get my tactical movement system nearly finished. However, I've run into yet another snag. Of all the ones I've run into, this one is probably the smallest... but it might help if I had another pair of eyes looking at it to tell me what I did wrong:
I have a parallel event keeping up with the X and Y cords of each visible enemy unit as well as an "aggro" variable set at map start (this is the maximum distance at which an enemy will attack you). I have a separate parallel process keeping up with the current X and Y coordinates of the player (Current X and Current Y).
here is how they are defined:
1101: Enemy 1 X Coord
1102: Enemy 1 Y Coord
1103: Enemy Aggro (set to 3 at map start, but it could be anything)
1076: Current X Coord (Player)
1077: Current Y Coord (Player)
# If enemy 1 is to the right of the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable [1101: Enemy 1 X Coord] >= Variable [1076:Current X Coord ]
Conditional Branch: Script: $game_variables[1101] - $game_variables[1076] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
----------------
# If enemy 1 is to the left of the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable[1076:Current X Coord ] >= Variable [1101: Enemy 1 X Coord]
Conditional Branch: Script: $game_variables[1076] - $game_variables[1101] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
----------------
# If enemy 1 is above the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable [1102: Enemy 1 Y Coord] >= Variable [1077:Current Y Coord ]
Conditional Branch: Script: $game_variables[1102] - $game_variables[1072] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
----------------
# If enemy 1 is below the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable [1077:Current Y Coord ] >= Variable [1102: Enemy 1 Y Coord]
Conditional Branch: Script: $game_variables[1072] - $game_variables[1102] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
-----------------
The hashtags are what the code is supposed to be doing. It works... sort of. I noticed that the creatures continue to agro toward the player though, regardless of distance. I'm not sure if I have my Scripted Conditional Branch working correctly.
Any Ideas?
I have a parallel event keeping up with the X and Y cords of each visible enemy unit as well as an "aggro" variable set at map start (this is the maximum distance at which an enemy will attack you). I have a separate parallel process keeping up with the current X and Y coordinates of the player (Current X and Current Y).
here is how they are defined:
1101: Enemy 1 X Coord
1102: Enemy 1 Y Coord
1103: Enemy Aggro (set to 3 at map start, but it could be anything)
1076: Current X Coord (Player)
1077: Current Y Coord (Player)
# If enemy 1 is to the right of the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable [1101: Enemy 1 X Coord] >= Variable [1076:Current X Coord ]
Conditional Branch: Script: $game_variables[1101] - $game_variables[1076] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
----------------
# If enemy 1 is to the left of the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable[1076:Current X Coord ] >= Variable [1101: Enemy 1 X Coord]
Conditional Branch: Script: $game_variables[1076] - $game_variables[1101] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
----------------
# If enemy 1 is above the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable [1102: Enemy 1 Y Coord] >= Variable [1077:Current Y Coord ]
Conditional Branch: Script: $game_variables[1102] - $game_variables[1072] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
----------------
# If enemy 1 is below the target and less then or equal to $game_variables[1103] away, move toward player
Conditional Branch: Variable [1077:Current Y Coord ] >= Variable [1102: Enemy 1 Y Coord]
Conditional Branch: Script: $game_variables[1072] - $game_variables[1102] <= $game_variables[1103]
Set Move Route: [Monster 1] (Wait)
Change Speed: 4
Move Toward Player
Else
Branch End
-----------------
The hashtags are what the code is supposed to be doing. It works... sort of. I noticed that the creatures continue to agro toward the player though, regardless of distance. I'm not sure if I have my Scripted Conditional Branch working correctly.
Any Ideas?



