Jump to content
Sign in to follow this  
RS30002

Tasks testing

Recommended Posts

Hi all

 

after the stellar results from my last thread i'm back for some more scripting goodness 🙂

 

So, the issue, right now i have 15 tasks and while it's still feasible to test it all, it won't be in a few days or a week when i'll have 20 + more.

Some of them are fly 20-30km, search for targets in a wide area, fly back 20 km, land VTOL on the frigate flight deck....my first attempts at testing took more time landing the plane than actual flying around doing the mission- i mean a pilot should know how to land amirite??? or so i thought lol - a few days later i implemented a laptop access option of flying in a CTOL aircraft that spawns, gets equipped, player is teleported inside and mission starts on the fly (this also skips landing, script teleport back on deck once in vicinity of the ship and a task before the land task is completed) - because VTOL is tedious lol.

 

But now all the sneaking comes into play...a slow boat/helicopter ride of 15 km driven by AI,  additional sneaking (more than before) and running around the island, return journey to the ship + probably a final flight of 40+ km + of bombing and dogfights etc etc....

 

.....like it won't be feasible to test the 31st task and do the 30 before it each time. Because i'm a beginner, there's a lot of trial and error involved in all of this and i anticipate that will be a further cost to time....

 

So...how to "skip" tasks? Putting some variable at the end of each one? Like <<task17done = true>>???  or is it <<task17done == true>> ??? and then calling  <<task17done>>  from a trigger i'd manually edit before testing that particular task? 

 

Or is there another, better way?🤨

 

Thanks in advance! 

 

 

 

Share this post


Link to post
Share on other sites

The best approach depends on how you have your tasks organized, and how you script your mission.

On the campaign I'm currently working on, I have each task isolated into its own script file. The first task is handled by task1.sqf, the second one by task2.sqf, and so on (I'm simplifying it a lot here, but you get the picture). However, sometimes testing a task requires that certain things be true or have occurred, such as the player being in a certain spot, or a certain enemy having been killed. So, I always add a small 'debug' section to the top of each task script that takes care of that, similarly to your VTOL skipping example. Then, if I want to test a particular task, let's say task 4, I would execute nul = [true] execVM "task4.sqf"; with the debug parameter to true.

 

In truth, I would need to see what your mission looks like in order to determine what the best approach would be.

  • Like 1

Share this post


Link to post
Share on other sites

 

23 hours ago, Rok Stuhne said:

it won't be feasible to test the 31st task and do the 30 before it each time.

 

With that many tasks I would resort to a mission flow FSM to handle them the way BIS tends to do, but you may be unfamiliar with FSM's so....

 

- You spawn or execvm a loop that handles setting the task states.  This way you have a single go-to script for testing whenever tasks get added in or modified.

- At the start, before the loop begins, you declare flag variables.  These flags prevent their specific task blocks from running more than once.

- Inside the loop, each task gets checked to see if its condition is met.  If so, the task state gets handled and the flag gets set.

- Each task has its own condition to satisfy, but it also checks the flag variable, in order to disregard after the task has already been handled.

Very basic and simplified:

Spoiler

_gameOver = false;

_task_01 = false;
_task_02 = false;
_task_03 = false;
_task_04 = false;
_task_05 = false;
_task_06 = false;

While {!_gameOver} do 
{
	if (<task01 condition is true> && !_task_01) then {_task_01 = true; <set task state completed>};
	if (<task02 condition is true> && !_task_02) then {_task_02 = true; <set task state completed>};
	if (<task03 condition is true> && !_task_03) then {_task_03 = true; <set task state completed>};
	if (<task04 condition is true> && !_task_04) then {_task_04 = true; <set task state completed>};
	if (<task05 condition is true> && !_task_05) then {_task_05 = true; <set task state completed>};
	if (<task06 condition is true> && !_task_06) then {_task_06 = true; <set task state completed>; _gameOver = true};

	Sleep 1;
};

 

 

And if one task is dependent on another being completed, that too can be added into the condition using its flag variable:

	if (<task04 condition is true> && _task_02 && !_task_04) then {_task_04 = true; <set task state completed>};

 

  • Like 1

Share this post


Link to post
Share on other sites

Yoooo, can i get some help here please!?!?

 

Why doesn't this work?

 

Start trigger that gives you next task

 

triggerActivated task11_succ Or {triggerActivated CTOLteleport} Or {TaskDone};

 

Trigger on radio call that's supposed to bypass first two conditions of above statement

 

{TaskDone = true};

Many thanks for any insight.

Share this post


Link to post
Share on other sites
1 hour ago, Rok Stuhne said:

Trigger on radio call that's supposed to bypass first two conditions of above statement

 


{TaskDone = true};

Many thanks for any insight. 

 

You wanna do

TaskDone = true;

instead of

{TaskDone = true};

 

  • Like 1

Share this post


Link to post
Share on other sites
48 minutes ago, _foley said:

 

You wanna do


TaskDone = true;

instead of


{TaskDone = true};

 

 

I had it like you suggest in the first place but it didn't work. 😔

 

Hmmm....idk how but it worked now, it just took ages to register. I tried it, went to write a reply, alt tabbed back into the game and saw it assigned. Not sure why triggers need so much time....they're set to fire on average after a 5 sec delay. 

 

Is it possibly because i have a gynormous init by now and things are loading while im already in the game? If so, can it be optimized in any way?

 

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  

×