Jump to content
frankovich213

Time brackets for objectives with scores? - Please help

Recommended Posts

Hi guys,

I was wondering if you could help me with something...

I'm working on a mission that requires you to make deliveries. I'm hoping to achieve a time trial kind of system where for each delivery mission, you have 3 time brackets in which you can complete the delivery and score points based on the bracket you finished in. So, for example, make the delivery in under 8 mins and you achieve GOLD which scores you x amount of points, make the delivery in under 10 mins to achieve SILVER and x amount of points, etc. etc.

Does anyone have any ideas as to how I'd go about this?

I've made a couple of missions before, but I'm a little stumped as to where to start with this one. Any help would be GREATLY appreciated!

Thanks in advance,

Frank :)

Share this post


Link to post
Share on other sites

Ok....guess it's a lot harder than I thought. lol Back to the drawing board I go.

It's a shame though, things like this would open a world of possibilities for game modes and missions.

I'm still going to attempt it, because it seems like something that should be doable within Arma. If anyone has any info that might be useful, please share it. I'll check this thread as I try to figure it out.

Cheers

Share this post


Link to post
Share on other sites

OK heres a little example..

Create a blank VR mission with just the player and place the below in init.sqf in the mission folder..

h= [] spawn {

//Number to keep track of tasks
_tskNumber = 0;

//Keep creating tasks
while {	true } do {

	//READY
	hint parseText "<t color='#FF3300' size='1.2'>Get Ready!</t>";
	playSound "Alarm";

	sleep 1;

	//SET
	hint parseText "<t color='#FFFF00' size='1.6'>SET!</t>";
	playSound "Alarm";

	sleep 1;

	//Increment task number
	_tskNumber = _tskNumber + 1;

	//Get random position 20m away from player
	_pos = [ player, 20, random 360 ] call BIS_fnc_relPos;
	//Create Marker at position
	_mrk = createMarker [ "tskmrk", _pos ];
	//Create large red arrow at position
	_arrow = createVehicle [ "Sign_Arrow_Large_F", _pos, [], 0, "NONE" ];

	//Create task
	[
		player,		//task owner
		format [ "tsk%1", _tskNumber ],		//task name
		//task - description, title, marker
		[
			"Complete the task by moving to the destination arrow. The quicker you are the better the reward",
			format [ "Task %1", _tskNumber ],
			_mrk
		],
		_mrk,	//task position
		true,	//set task as current
		1,
		true	//show task notification
	] call BIS_fnc_taskCreate;

	//Set task start time
	_tskstarttime = time;

	//GO
	_GOmsg = "<t color='#33CC33' size='2'>! GO !</t>";
	//Show a help hint for first task about tasks objective
	if ( _tskNumber == 1 ) then {
		 _GOmsg = _GOmsg + "<br /><br />Complete the task by moving to the destination arrow.<br />The quicker you are the better the reward";
	};
	hint parseText _GOmsg;
	playSound "FD_Course_Active_F";

	//wait until the player reaches the arrow
	waitUntil { player distance _pos < 2 };

	//set task end time
	_tskendtime = time;

	//Clean up task helpers
	deleteVehicle _arrow;
	deleteMarker _mrk;

	//set task as completed
	[ format [ "tsk%1", _tskNumber ], "Succeeded", true ] call BIS_fnc_taskSetState;

	//Some default values
	_rewardmsg = "";
	_rewardPoints = 0;

	//Work out time taken to complete task
	_timeTaken = _tskendtime - _tskstarttime;

	//Work out reward
	switch ( true ) do {
		case ( _timeTaken < 3 ) : {		//were we under 3 seconds
			//Set a message to display
			_rewardmsg = "<t color='#E6B800' size='2'>Gold</t><br /><br />Congratulations!!!<br />Your getting the hang of sprinting";
			//our reward points
			_rewardPoints = 10;
		};

		case ( _timeTaken < 4 ) : {
			_rewardmsg = "<t color='#CFCFCF' size='2'>Silver</t><br /><br />Well Done";
			_rewardPoints = 5;
		};

		case ( _timeTaken < 5.5 ) : {
			_rewardmsg = "<t color='#D4893E' size='2'>Bronze</t><br /><br />Not Bad<br />Try a little hustle next time";
			_rewardPoints = 2;
		};

		default {
			_rewardmsg = "No medal this time<br /><br />Did you fall asleep on your way?";
		};
	};

	//Get players current points from his stored variable ( default to 0 if not found )
	_currentPoints = player getVariable [ "Points", 0 ];
	//Add our new reward points and save back into player variable
	player setVariable [ "Points", _currentPoints + _rewardPoints ];

	//default msg
	_newBestTimemsg = "";
	//get players best time from his stored variable ( default to a very large number if not found )
	_bestTime = player getVariable [ "BestTime", 1e5 ];

	//if we made a new best time
	if ( _timeTaken < _bestTime ) then {
		//update stored variable with new time
		player setVariable [ "BestTime", _timeTaken ];
		//set our message
		_newBestTimemsg = "<t color='#2EB82E' size='1.2'>Thats a new best time</t>";
	};

	//compile all messages and show them in a hint
	hint parseText format [ "You completed the task in<br />Time : %1<br />%2<br /><br />You got<br /><br />%3<br /><br />Points gained<br />%4<br />Total Points<br />%5", _timeTaken, _newBestTimemsg, _rewardmsg, _rewardPoints, player getVariable [ "Points", 0 ] ];

	sleep 8;

};	//repeat

};

Had way to much fun making this than i probably should have lol.

Best time GOLD - 2.55 seconds :D

Edited by Larrow
  • Like 1

Share this post


Link to post
Share on other sites
OK heres a little example..

Create a blank VR mission with just the player and place the below in init.sqf in the mission folder..

h= [] spawn {

//Number to keep track of tasks
_tskNumber = 0;

//Keep creating tasks
while {	true } do {

	//READY
	hint parseText "<t color='#FF3300' size='1.2'>Get Ready!</t>";
	playSound "Alarm";

	sleep 1;

	//SET
	hint parseText "<t color='#FFFF00' size='1.6'>SET!</t>";
	playSound "Alarm";

	sleep 1;

	//Increment task number
	_tskNumber = _tskNumber + 1;

	//Get random position 20m away from player
	_pos = [ player, 20, random 360 ] call BIS_fnc_relPos;
	//Create Marker at position
	_mrk = createMarker [ "tskmrk", _pos ];
	//Create large red arrow at position
	_arrow = createVehicle [ "Sign_Arrow_Large_F", _pos, [], 0, "NONE" ];

	//Create task
	[
		player,		//task owner
		format [ "tsk%1", _tskNumber ],		//task name
		//task - description, title, marker
		[
			"Complete the task by moving to the destination arrow. The quicker you are the better the reward",
			format [ "Task %1", _tskNumber ],
			_mrk
		],
		_mrk,	//task position
		true,	//set task as current
		1,
		true	//show task notification
	] call BIS_fnc_taskCreate;

	//Set task start time
	_tskstarttime = time;

	//GO
	_GOmsg = "<t color='#33CC33' size='2'>! GO !</t>";
	//Show a help hint for first task about tasks objective
	if ( _tskNumber == 1 ) then {
		 _GOmsg = _GOmsg + "<br /><br />Complete the task by moving to the destination arrow.<br />The quicker you are the better the reward";
	};
	hint parseText _GOmsg;
	playSound "FD_Course_Active_F";

	//wait until the player reaches the arrow
	waitUntil { player distance _pos < 2 };

	//set task end time
	_tskendtime = time;

	//Clean up task helpers
	deleteVehicle _arrow;
	deleteMarker _mrk;

	//set task as completed
	[ format [ "tsk%1", _tskNumber ], "Succeeded", true ] call BIS_fnc_taskSetState;

	//Some default values
	_rewardmsg = "";
	_rewardPoints = 0;

	//Work out time taken to complete task
	_timeTaken = _tskendtime - _tskstarttime;

	//Work out reward
	switch ( true ) do {
		case ( _timeTaken < 3 ) : {		//were we under 3 seconds
			//Set a message to display
			_rewardmsg = "<t color='#E6B800' size='2'>Gold</t><br /><br />Congratulations!!!<br />Your getting the hang of sprinting";
			//our reward points
			_rewardPoints = 10;
		};

		case ( _timeTaken < 4 ) : {
			_rewardmsg = "<t color='#CFCFCF' size='2'>Silver</t><br /><br />Well Done";
			_rewardPoints = 5;
		};

		case ( _timeTaken < 5.5 ) : {
			_rewardmsg = "<t color='#D4893E' size='2'>Bronze</t><br /><br />Not Bad<br />Try a little hustle next time";
			_rewardPoints = 2;
		};

		default {
			_rewardmsg = "No medal this time<br /><br />Did you fall asleep on your way?";
		};
	};

	//Get players current points from his stored variable ( default to 0 if not found )
	_currentPoints = player getVariable [ "Points", 0 ];
	//Add our new reward points and save back into player variable
	player setVariable [ "Points", _currentPoints + _rewardPoints ];

	//default msg
	_newBestTimemsg = "";
	//get players best time from his stored variable ( default to a very large number if not found )
	_bestTime = player getVariable [ "BestTime", 1e5 ];

	//if we made a new best time
	if ( _timeTaken < _bestTime ) then {
		//update stored variable with new time
		player setVariable [ "BestTime", _timeTaken ];
		//set our message
		_newBestTimemsg = "<t color='#2EB82E' size='1.2'>Thats a new best time</t>"
	};

	//compile all messages and show them in a hint
	hint parseText format [ "You completed the task in<br />Time : %1<br />%2<br /><br />You got<br /><br />%3<br /><br />Points gained<br />%4<br />Total Points<br />%5", _timeTaken, _newBestTimemsg, _rewardmsg, _rewardPoints, player getVariable [ "Points", 0 ] ];

	sleep 8;

};	//repeat

};

Had way to much fun making this than i probably should have lol.

Best time GOLD - 2.55 seconds :D

think I spotted a typo in the above:

        if ( _timeTaken < _bestTime ) then {
           //update stored variable with new time
           player setVariable [ "BestTime", _timeTaken ];
           //set our message
           _newBestTimemsg = "<t color='#2EB82E' size='1.2'>Thats a new best time[b]</t>"[/b]
       };

should be a semi-colon on the end of _newBestTimemsg

  • Like 1

Share this post


Link to post
Share on other sites
think I spotted a typo in the above:

        if ( _timeTaken < _bestTime ) then {
           //update stored variable with new time
           player setVariable [ "BestTime", _timeTaken ];
           //set our message
           _newBestTimemsg = "<t color='#2EB82E' size='1.2'>Thats a new best time[b]</t>"[/b]
       };

should be a semi-colon on the end of _newBestTimemsg

Cool, fixed it so as not to introduce errors if anyone ever trys to play around with the code. Didnt come up with a script error due to it being at the end of scope.

  • Like 2

Share this post


Link to post
Share on other sites

Holy @#$%! I wasn't expecting all this! Thank you soooo much Larrow. Looking at what you've done here, there's no way I could have done this so thank you a million times. Once I have the mission finished I will definitely be giving you a BIG shoutout in the credits. I'll try and name a character or something after you too. lol Thank you again!:yay:

Share this post


Link to post
Share on other sites

I've tried it in the init file and it works great but now I've saved it as task1.sqm and I'm trying to run it via a trigger placed in the editor but I can't seem to get it running.

I set a trigger for blufor, once, present

For On Act I tried: null = this execVM "task1.sqf"

task1 = this execVM "task1.sqf"

but neither worked.

Also I'm wondering how to get the time trial to run once rather than an infinite loop so that I can run it for each mission separately.

And I'm assuming I can enter coordinates after _pos = for a custom marker position is that right?

Sorry for the noob questions, I've never done a mission entirely by scripting like you did, so some things are confusing me a little. :confused:

PS - If I am able to run the mission once for each task separately rather than an infinite loop, will the score still continue to tally the second and third time I run the script or will it be reset?

Edited by Frankovich213

Share this post


Link to post
Share on other sites
I've tried it in the init file and it works great but now I've saved it as task1.sqm and I'm trying to run it via a trigger placed in the editor but I can't seem to get it running.

I set a trigger for blufor, once, present

For On Act I tried: null = this execVM "task1.sqf"

task1 = this execVM "task1.sqf"

but neither worked.

Also I'm wondering how to get the time trial to run once rather than an infinite loop so that I can run it for each mission separately.

And I'm assuming I can enter coordinates after _pos = for a custom marker position is that right?

Sorry for the noob questions, I've never done a mission entirely by scripting like you did, so some things are confusing me a little. :confused:

PS - If I am able to run the mission once for each task separately rather than an infinite loop, will the score still continue to tally the second and third time I run the script or will it be reset?

null = this execVM "task1.sqf"

I don't think you quite understand what the parameters that can be passed to scripts really are.

They are only to pass data to the script, if no information is required (if it needs data to be passed then it's indicated by a VARIABLE = _this select NUMBER; usually near the top, though it can be farther down if the script spawns a new thread inside itself (a script inside a script I guess), in that case then it will also need data passed if it uses anything from above it), then simply dont put anything infront of the execVM (except for maybe a script handle if its needed, which you have).

  • Like 1

Share this post


Link to post
Share on other sites

Oh sorry, I forgot to mention I already tried simply: execVM "task1.sqf" but it gives me an error and says im missing something. If I add a semicolon it says "missing ;".

Share this post


Link to post
Share on other sites

Ill try and help you out a bit more after the weekend, not feeling to well atm.

use

nul = [] execvm "task1.sqf"

I tried to comment the code as much as possible to make it easy for you to understand.

To stop the task repeating remove the while loop...

//Keep creating tasks
while {	true } do {

and its closing bracket

};	//repeat

I wrote the code as to show the flow you would need to follow e.g

Pre task stuff

//READY
	hint parseText "<t color='#FF3300' size='1.2'>Get Ready!</t>";
	playSound "Alarm";

	sleep 1;

	//SET
	hint parseText "<t color='#FFFF00' size='1.6'>SET!</t>";
	playSound "Alarm";

	sleep 1;

	//Increment task number
	_tskNumber = _tskNumber + 1;

Create task and objects needed for task

		//Get random position 20m away from player
	_pos = [ player, 20, random 360 ] call BIS_fnc_relPos;
	//Create Marker at position
	_mrk = createMarker [ "tskmrk", _pos ];
	//Create large red arrow at position
	_arrow = createVehicle [ "Sign_Arrow_Large_F", _pos, [], 0, "NONE" ];

	//Create task
	[
		player,		//task owner
		format [ "tsk%1", _tskNumber ],		//task name
		//task - description, title, marker
		[
			"Complete the task by moving to the destination arrow. The quicker you are the better the reward",
			format [ "Task %1", _tskNumber ],
			_mrk
		],
		_mrk,	//task position
		true,	//set task as current
		1,
		true	//show task notification
	] call BIS_fnc_taskCreate;

	//Set task start time
	_tskstarttime = time;

	//GO
	_GOmsg = "<t color='#33CC33' size='2'>! GO !</t>";
	//Show a help hint for first task about tasks objective
	if ( _tskNumber == 1 ) then {
		 _GOmsg = _GOmsg + "<br /><br />Complete the task by moving to the destination arrow.<br />The quicker you are the better the reward";
	};
	hint parseText _GOmsg;
	playSound "FD_Course_Active_F";

task completion

		//wait until the player reaches the arrow
	waitUntil { player distance _pos < 2 };

	//set task end time
	_tskendtime = time;

task cleanup

		

	//Clean up task helpers
	deleteVehicle _arrow;
	deleteMarker _mrk;

	//set task as completed
	[ format [ "tsk%1", _tskNumber ], "Succeeded", true ] call BIS_fnc_taskSetState;

manage player rewards

		//Some default values
	_rewardmsg = "";
	_rewardPoints = 0;

	//Work out time taken to complete task
	_timeTaken = _tskendtime - _tskstarttime;

	//Work out reward
	switch ( true ) do {
		case ( _timeTaken < 3 ) : {		//were we under 3 seconds
			//Set a message to display
			_rewardmsg = "<t color='#E6B800' size='2'>Gold</t><br /><br />Congratulations!!!<br />Your getting the hang of sprinting";
			//our reward points
			_rewardPoints = 10;
		};

		case ( _timeTaken < 4 ) : {
			_rewardmsg = "<t color='#CFCFCF' size='2'>Silver</t><br /><br />Well Done";
			_rewardPoints = 5;
		};

		case ( _timeTaken < 5.5 ) : {
			_rewardmsg = "<t color='#D4893E' size='2'>Bronze</t><br /><br />Not Bad<br />Try a little hustle next time";
			_rewardPoints = 2;
		};

		default {
			_rewardmsg = "No medal this time<br /><br />Did you fall asleep on your way?";
		};
	};

	//Get players current points from his stored variable ( default to 0 if not found )
	_currentPoints = player getVariable [ "Points", 0 ];
	//Add our new reward points and save back into player variable
	player setVariable [ "Points", _currentPoints + _rewardPoints ];

	//default msg
	_newBestTimemsg = "";
	//get players best time from his stored variable ( default to a very large number if not found )
	_bestTime = player getVariable [ "BestTime", 1e5 ];

	//if we made a new best time
	if ( _timeTaken < _bestTime ) then {
		//update stored variable with new time
		player setVariable [ "BestTime", _timeTaken ];
		//set our message
		_newBestTimemsg = "<t color='#2EB82E' size='1.2'>Thats a new best time</t>";
	};

	//compile all messages and show them in a hint
	hint parseText format [ "You completed the task in<br />Time : %1<br />%2<br /><br />You got<br /><br />%3<br /><br />Points gained<br />%4<br />Total Points<br />%5", _timeTaken, _newBestTimemsg, _rewardmsg, _rewardPoints, player getVariable [ "Points", 0 ] ];

So what you need to think about is what do you need..

  1. task manager to look after which task to start
  2. a file per task that includes
    • Create task and objects needed for task
    • task completion
    • task cleanup

[*]a script to look after player rewards

Have a look at my scripts in the example mission in this THREAD that sets up dynamic missions from a white board for more ideas.

initPlayer creates some actions

the actions call a function on the server

the server chooses the right mission to start

each mission has its own script that (creates, waits for completion,cleans up)

which then allows you to choose another mission from the board

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for this mate. I'm sorry to hear you're not well atm. Hope you're feeling better soon. It'll take me a while to chew through this anyway so no rush mate. Get well. :)

Share this post


Link to post
Share on other sites

Hi! Just an update. Everything is working really well. I've got each task running separately now with triggers thanks to your last post. The scores are still tallying up each time it's run. I've figured out how to make the destination a specific location rather than random and I've managed to get custom graphics come up in the middle of the screen for 'Ready, 'Set', 'Go' and also when you get to the destination which looks awesome.

There's only really one thing I need help with now and a couple of lesser important things which aren't critical to the mission.

I was wondering how to add a checkpoint that you must travel to before traveling to the final destination, in to your code. One of the missions, is basically a sight-seeing trip, so I want to make checkpoints that the player must go through rather than them being able to go straight to the finish and cheat the time trial system.

Less important

A way to have to the time trial clock constantly showing while you are doing the run. (This would be cool)

A way to make the score and tasks show up on the scoreboard when you end the mission. The tasks currently show up in the map but when you end the mission, the objectives and score are blank. I've already edited your code so the tasks are each numbered because it was obviously recreating task 1 over and over again each time I started a delivery. (I'm not too worried about this one though because I can simply make the score hint from the last delivery stay on the screen until the mission ends which is all the player really needs to see anyway.)

I really appreciate your help with this. I'm learning an immense amount.:)

Share this post


Link to post
Share on other sites
I was wondering how to add a checkpoint that you must travel to before traveling to the final destination, in to your code. One of the missions, is basically a sight-seeing trip, so I want to make checkpoints that the player must go through rather than them being able to go straight to the finish and cheat the time trial system.

Just think of your checkpoints as mini missions within your mission without tasks. e.g using previous task creation and completion examples

//********
//Main task - as per previous examples
//********

//Get random position 20m away from player
_pos = [ player, 20, random 360 ] call BIS_fnc_relPos;
//Create Marker at position
_mrk = createMarker [ "tskmrk", _pos ];
//Create large red arrow at position
_arrow = createVehicle [ "Sign_Arrow_Large_F", _pos, [], 0, "NONE" ];

//Create task
[
   player,        //task owner
   format [ "tsk%1", _tskNumber ],        //task name
   //task - description, title, marker
   [
       "Complete the task by moving to the destination arrow. The quicker you are the better the reward",
       format [ "Task %1", _tskNumber ],
       _mrk
   ],
   _mrk,    //task position
   true,    //set task as current
   1,
   true    //show task notification
] call BIS_fnc_taskCreate; 


//********
//Checkpoints
//********

//An array of markers to visit
_checkpointMarkers = [ "CP1", "CP2", "CP3" ];

{
//Current marker
_CPmrk = _x;

//add waypoint at the current markers position
_wp = addWaypoint [ getMarkerPos _CPmrk, 0 ];

//Waituntil the player gets close to the marker
waitUntil { player distance getMarkerPos _CPmrk < 2 };

}forEach _checkpointMarkers;

//checkpoints done add waypont to completion marker
group player addWaypoint [ getMarkerPos _mrk, 0 ];


//********
//Main task completion - as per previous examples
//********

//wait until the player reaches the arrow
waitUntil { player distance _pos < 2 };

//set task end time
_tskendtime = time;

Here the player is never going to get to complete the task until he has visited each _checkPointMarkers in order.

A way to have to the time trial clock constantly showing while you are doing the run. (This would be cool)

Would be nice to maybe create your own little UI that you could cutText to show the time some where, but as an example im just going to use the hint box.

Once the clock has started spawn a loop that shows time - _tskstarttime .

//END of task setup

//Set task start time
_tskstarttime = time; 


//*****
//Timer Display
//****

//Spawn a new thread
_handle = _tskstarttime spawn {
//Passed starttime
_startTime = _this;

//Global variable to exit loop
TASKDONE = false;

//looop
while { !TASKDONE } do {
	//get current time elapsed since start
	_time = time - _startTime;
	//convert time to something nice to display
	_currentTime = [ _time ] call BIS_fnc_timeToString;
	//show elapsed time in hint
	hintSilent format[ "Current Time\n%1", _currentTime ];
};
};


//*****
//Task completion
//*****

//wait until the player reaches the arrow
waitUntil { player distance _pos < 2 };

//set task end time
_tskendtime = time;
//Set global variable to true to stop display of elapsed time
TASKDONE = true;

A way to make the score and tasks show up on the scoreboard when you end the mission. The tasks currently show up in the map but when you end the mission, the objectives and score are blank. I've already edited your code so the tasks are each numbered because it was obviously recreating task 1 over and over again each time I started a delivery.
See the CfgDebriefingSections in the debriefing information HERE that allows you to add your own sections which can also have variables attached so you could pass maybe time taken and reward for each task etc.
  • Like 1

Share this post


Link to post
Share on other sites

Sorry Larrow, I hadn't realised you had replied. I've been a bit busy for the last week or so and only just now remembered the thread. I'll try all this out as soon as I can get on Arma this weekend. Thanks once again mate for your help and patience with me :) I was a little daunted by doing things all in code like this at first but I love how reliably everything works and I'm quickly beginning to appreciate it, especially since it keeps the editor so tidy. I'll let you know how it goes.

Btw, I don't mean to be lazy just asking you for the answers every time. I could achieve some of these things, like the checkpoints, in the editor already but you've started to convert me to scripting and having awesome examples like the ones you've provided makes learning this language a whole lot easier. It is greatly appreciated mate!

Edited by Frankovich213

Share this post


Link to post
Share on other sites

Just think of your checkpoints as mini missions within your mission without tasks. e.g using previous task creation and completion examples

 

 

Hi Larrow! :D Long time no speak. I hope you are doing well. I don't mean to bother you but I saw that you still seem to be active on here so thought I'd ask.

I'm finally able to work on this mission again as a mod it was reliant upon has recently been updated and fixed so I've just been trying out the checkpoint code you suggested in your last post.

I've added the following code in the correct place:

        //An array of markers to visit
	  _checkpointMarkers = [ "CP1", "CP2", "CP3" ];

	  {
		//Current marker
		_CPmrk = _x;
	
		//add waypoint at the current markers position
		_wp = addWaypoint [ getMarkerPos _CPmrk, 0 ];
	
		//Waituntil the player gets close to the marker
		waitUntil { player distance getMarkerPos _CPmrk < 2 };
		
	  }forEach _checkpointMarkers;

	 //checkpoints done add waypont to completion marker
	 group player addWaypoint [ getMarkerPos _mrk, 0 ];

I also placed 3 markers on the map and named them CP1, CP2, CP3.

However, when I try to run the mission I get an error message saying the code is missing a ";" on line 72 which is the following line:

_wp = addWaypoint [ getMarkerPos _CPmrk, 0 ];

The error message shows a [#] after addWaypoint.

I've been messing with it for a few hours but can't seem to make any progress. Any idea what might be causing it? :unsure: Your help is greatly appreciated mate!

 

**EDIT

I just tried changing the following line:

_wp = addWaypoint [ getMarkerPos _CPmrk, 0 ];

to this:

_wp = group player addWaypoint [ getMarkerPos _CPmrk, 0 ];

and the error message no longer appears. The mission begins as normal and the first checkpoint appears. When you walk to it it disappears as it should however the second checkpoint does not appear. Walking to the finish line doesn't end the task either.

Not sure if this is progress but it does seem to confirm that something is wrong with that particular line.

Share this post


Link to post
Share on other sites

I managed to get it working! :D I must have had some sort of error in the formatting or something but now all 3 checkpoints points appear in order. Cheers mate!

Oh, just thought I'd ask, when I use addWaypoint, is there any way to make the waypoint appear at a designated height? I noticed it's possible if placing it in the editor but so far have been unsuccessful with code. I tried placing an invisible object in the air and then using setPos/getPos to change the waypoint's position to that of the object in the air but not having much luck.

Share this post


Link to post
Share on other sites

Glad you got it sorted.

 

You can change the height by just supply it in the addWaypoint. This for example will add a waypoint 20m in front of the player 10m in the air.

_pos = player getPos[ 20, getDir player ];
_pos set[ 2, 10 ];
group player addWaypoint[ _pos, 0 ];
  • Like 1

Share this post


Link to post
Share on other sites

 

Glad you got it sorted.

 

You can change the height by just supply it in the addWaypoint. This for example will add a waypoint 20m in front of the player 10m in the air.

Thanks mate, you're a bloody legend! ;) Will the same work when I use createVehicle?

I'm trying to create signs at the same place as the waypoints using the following:

_sign = "Sign_Circle_F" createVehicle [(getPos _CPmrk select 0),(getPos _CPmrk select 1),20];

but it's not working properly, giving me an error. Any ideas?

Cheers mate.

Share this post


Link to post
Share on other sites

Thanks mate, you're a bloody legend! ;) Will the same work when I use createVehicle?

I'm trying to create signs at the same place as the waypoints using the following:

_sign = "Sign_Circle_F" createVehicle [(getPos _CPmrk select 0),(getPos _CPmrk select 1),20];

but it's not working properly, giving me an error. Any ideas?

Cheers mate.

 

i replied to your question in the other thread, give that a shot

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

×