Help: How to make a command find the closest co-ords
#6

as soon the script knows the checkpoint, you can go further and associate it with your mission array. i guess its 2 dimensional? anyways, one already mentioned solution could be calculating all checkpoints' distances, and then chosing the smallest one. if there are a few, like <20 checkpoints only, then this can work.
as soon you have more and more checkpoints, the longer the calculation loop will take just to get one value (the closest CP's id) back, so you should consider a more flexible way. i think about creating a dynamic areas wchich cover each checkpoint in a distance like 2000 units.
IsPlayerInDynamicArea() could then be used to check if a player is in a certain position, and therefore start the accoring mission.
may i ask how many checkpoints locations you already have? if there are more than 100 locations, with like >50 units in between each, or if you intent to let your system react on changes (in position or amount of checkpoints etc), tell us if so, please. its easier to help you if we know what you want to achieve.
one aspect is clear already: the factions/teams. a pilot should not be able to start a trash pickup mission indeed, so there a multi-pass sorting/pruning would be a neat thing already: throwing invalid mission startpoints away before calculating the distance, in different words...
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)