|
|
|
|
Reply From: |
GameVisitor |
Found ur issue, it was crashing at this instruction : get_point_position(1)
with a similar error:
ERROR: set: Condition ' p_index < 0 || p_index >= size() ' is true.
At: ./core/pool_vector.h:488.
Ugly description I know, but it means you are accessing an out of bound element.
Adding this temporary instruction : var count = get_point_count()
showed size=1 (and you were accessing the second element, since 0 based).
In the previous lines, you have:
if get_point_count() < 2:
add_point(Vector2(0,0))
set_point_position(1, AverageArmyPosition)
set_point_position(2, Destination)
which only adds 1 point (instead of 2 as you were expecting), solution is:
if get_point_count() < 2:
add_point(Vector2(0,0))
add_point(Vector2(0,0))
set_point_position(0, AverageArmyPosition)
set_point_position(1, Destination)
If this helps, mark it as accepted. Thanks
Thanks for the help, but it didn’t work
the code now reads:
func _proccess(delta):
if get_point_count() < 2:
add_point(Vector2(0,0))
add_point(Vector2(0,0))
set_point_position(0, AverageArmyPosition)
set_point_position(1, Destination)
if get_point_position(1).abs() - get_point_position(2).abs() < Vector2(1,1):
set_point_position(1, Destination)
var count = get_point_count()
print(count)
pass
btw, I’m sorry it took so long to respond, the email was sent to junk
Thanks for the help anyways!
Agentfox | 2019-04-14 16:26