Jump to content
Sign in to follow this  
Scatty85

Weird addwaypoint bug

Recommended Posts

Hi,

I'm new to this so apologies if this is a simple problem.

I'm messing about with scripting and have created the below scrip, which works to a degree. The code is in a .sqf file and called by a trigger.

The waypoint is added but the waypoint line runs from the very bottom left of the map to the correct location, I can’t work out why the waypoint is not running from the group. Also the group does not respond to the waypoint.

Thanks for any help!

Scott

private "_unt";
private "_grp";
_grp = createGroup west;

for "_i" from 0 to 3 do
{
sol = round(random 3);
str_sol = "";
switch (sol) do {
	case 1: {
		str_sol = "USMC_Soldier_AR";
	};
	case 2: {
		str_sol = "USMC_Soldier_MG";
	};
	case 3: {
		 str_sol = "USMC_Soldier_Medic";
	};
	default
	{
		 str_sol = "USMC_Soldier";	
	};
};

_unt = _grp CreateUnit [str_sol,getMarkerPos "red_1",[],25,"FORM"];
};


[player] join group _unt;
wp1 = group _unt addwaypoint [(getmarkerpos "red_sd"),100];
wp1 setwaypointtype "DESTROY";
wp1 setwaypointBehaviour "AWARE";

hint "Reinforcements have arrived!";

Image

postimage.org/image/m30wwrm7l/

Edited by Scatty85
Added image

Share this post


Link to post
Share on other sites

I think that's just how it works.

There are a few ways of fixing it.

The first would be to delete waypoint 0 after the waypiont 1 has been created, this will stop the waypoints showin on the map only.

Second if you delete the waypopoint before the created one it will show in the map but from the correct location.

deletewAypoint [_grp,0];

You can also just move waypoint 0 to any position you want much like the second way.

[_grp, 0] setWaypointPosition [leader _grp, 0];

private "_grp";
_grp = createGroup west;

for "_i" from 0 to 3 do
{
sol = round(random 3);
str_sol = "";
switch (sol) do {
	case 1: {
		str_sol = "USMC_Soldier_AR";
	};
	case 2: {
		str_sol = "USMC_Soldier_MG";
	};
	case 3: {
		 str_sol = "USMC_Soldier_Medic";
	};
	default
	{
		 str_sol = "USMC_Soldier";	
	};
};

_grp CreateUnit [str_sol,getMarkerPos "red_1",[],25,"FORM"];
};


[player] join _grp;
wp1 = _grp addwaypoint [(getmarkerpos "red_sd"),100];
wp1 setwaypointtype "move";
wp1 setwaypointBehaviour "AWARE";

//deletewAypoint [_grp,0];
[_grp, 0] setWaypointPosition [leader _grp, 0]; 

hint "Reinforcements have arrived!";

I removed the _unt varaiable as it messes things up a little, I also changed Destroy waypoint to Move so that you can see it in the game.

A Destroy waypoint is really just a wait until an object has been destroyed.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Ah thats great thanks so much! I'm just about getting to grips with this scripting language, not done any scripting for a looong time! :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×