Mr H. – User talk
Killzone Kid (talk | contribs) No edit summary |
|||
Line 6: | Line 6: | ||
I have modified it per your request (and corrected a mistake I made when copy/pasting from my code editor) but it is not necessary to remove waypoint with index 0 (tested it before posting) | I have modified it per your request (and corrected a mistake I made when copy/pasting from my code editor) but it is not necessary to remove waypoint with index 0 (tested it before posting) | ||
:In order to empty waypoints array for a group you need to iterate through every waypoint, if you iterate through one less, the 1st one is never removed, not sure how you tested your code [[User:killzone_kid|killzone_kid]] ([[User talk:killzone_kid|talk]]) 20:33, 17 November 2019 (CET) | :In order to empty waypoints array for a group you need to iterate through every waypoint, if you iterate through one less, the 1st one is never removed, not sure how you tested your code [[User:killzone_kid|killzone_kid]] ([[User talk:killzone_kid|talk]]) 20:33, 17 November 2019 (CET) | ||
As I said the first waypoint is original position of group when spawned, so leaving it in the array makes no difference, the group will stop and all the other waypoints are deleted. So yes the array is not empty, but the first waypoint of the array is not a movement waypoint. | |||
<code>group _unit spawn | |||
{ | |||
[_this,(currentWaypoint _this)] setWaypointPosition [getPosASL ((units _this) select 0), -1]; | |||
sleep 0.1; | |||
for "_i" from count waypoints _this - 1 to 1 step -1 do | |||
{ | |||
deleteWaypoint [_this, _i]; | |||
}; | |||
}; | |||
</code> | |||
Does indeed leave a waypoint 0 in the array. But the group will stop. My concern is : I don't know how understand why Bohemia chose that "Index 0 is the position the group was spawned at, and is set by the engine when spawning." (information provided by Larrow here https://forums.bohemia.net/forums/topic/226459-setwaypointloiterradius-breaking-script/?tab=comments#comment-3385858) and since it makes no difference if you remove it or not, why remove it ? I ask in earnest, maybe you have more information about that than I do. |
Revision as of 20:46, 17 November 2019
deleteWaypoint
https://community.bistudio.com/wiki/deleteWaypoint
"so the example provided to delete all waypoints should be" - no it shouldn't. The example shows how to delete ALL waypoints, your example doesn't do this. Please edit your note killzone_kid (talk) 18:06, 17 November 2019 (CET) I have modified it per your request (and corrected a mistake I made when copy/pasting from my code editor) but it is not necessary to remove waypoint with index 0 (tested it before posting)
- In order to empty waypoints array for a group you need to iterate through every waypoint, if you iterate through one less, the 1st one is never removed, not sure how you tested your code killzone_kid (talk) 20:33, 17 November 2019 (CET)
As I said the first waypoint is original position of group when spawned, so leaving it in the array makes no difference, the group will stop and all the other waypoints are deleted. So yes the array is not empty, but the first waypoint of the array is not a movement waypoint.
group _unit spawn
{
[_this,(currentWaypoint _this)] setWaypointPosition [getPosASL ((units _this) select 0), -1];
sleep 0.1;
for "_i" from count waypoints _this - 1 to 1 step -1 do
{
deleteWaypoint [_this, _i];
};
};
Does indeed leave a waypoint 0 in the array. But the group will stop. My concern is : I don't know how understand why Bohemia chose that "Index 0 is the position the group was spawned at, and is set by the engine when spawning." (information provided by Larrow here https://forums.bohemia.net/forums/topic/226459-setwaypointloiterradius-breaking-script/?tab=comments#comment-3385858) and since it makes no difference if you remove it or not, why remove it ? I ask in earnest, maybe you have more information about that than I do.