Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
DahToaster

Having mission randomly pull from 3 different tasks

Recommended Posts

So, I'm at a mental block at the moment and I'm 99% certain it's entirely just me staring at the screen and being at a loss.

 

I have a mission where I want it to be replayable for my group while I work on new stuff. My idea was to have a framework where, upon start of the mission, it would randomly choose one of 3-5 tasks to assign the squad.

 

Now, I'm not sure if I went the hard way about doing this. I've been making missions for a long time, but never really have done randomized stuff like this outside of enemy spawns and such.

 

In the init.sqf, I defined the array of tasks like:

Quote

TaskArray=["task1.sqf","task2.sqf","task3.sqf"];

 

Then, in another file called randomArray.sqf (which is activated when you pick up the first piece of intel at the beginning), it has:

Quote

_repeatTasks=false;

if (count TaskArray > 0)
    then {
    
_randomN=floor (random count TaskArray);
_randomScript=TaskArray select _randomN;

    null = [] execVM _randomScript;
    
    if (!_repeatTasks)
                then {
                
    TaskArray = TaskArray - [_randomScript];
                    
                    };
    }else{    
        
 Hint "All tasks Complete, return to base for debriefing.";
            
        };

 

 

I suppose my mental block would be, in the .sqf files for each task, what would I need to do to have those activate in-game tasks? For instance, one of the tasks is to destroy an ammo depot I just named "russian_ammo_dump". For further clarification, I used the in-game modules to create each task.

Share this post


Link to post
Share on other sites
39 minutes ago, DahToaster said:

So, I'm at a mental block at the moment and I'm 99% certain it's entirely just me staring at the screen and being at a loss.

 

I have a mission where I want it to be replayable for my group while I work on new stuff. My idea was to have a framework where, upon start of the mission, it would randomly choose one of 3-5 tasks to assign the squad.

 

Now, I'm not sure if I went the hard way about doing this. I've been making missions for a long time, but never really have done randomized stuff like this outside of enemy spawns and such.

 

In the init.sqf, I defined the array of tasks like:

 

Then, in another file called randomArray.sqf (which is activated when you pick up the first piece of intel at the beginning), it has:

 

 

I suppose my mental block would be, in the .sqf files for each task, what would I need to do to have those activate in-game tasks? For instance, one of the tasks is to destroy an ammo depot I just named "russian_ammo_dump". For further clarification, I used the in-game modules to create each task.

Is your random selection not working?

Are you asking how to randomize task selection?

Or how to make tasks from .sqf?

 

Not really sure from your post.

 

Cheers

Share this post


Link to post
Share on other sites

Sorry if I wasn't being very clear, it was after quite a few hours of staring at my code and trying a few different things to see if I was happy with the result. The randomarray.sqf and init.sqf completely work, my issue is that I'm at a loss for where to go from there.

 

I'm looking for either a solution to do one of the following:
A)Have my task1-3 .sqf's assign tasks that are pre-created using the in-eden modules

or

B)Find a way to entirely bypass the .sqf's and do it entirely in-eden with the modules

I hope that clarifies what I'm looking for.

Share this post


Link to post
Share on other sites

You could always just add a variable = 0 and with the main script equal it to 1. 

Then add a trigger with condition variable = 1 that fires the script or triggers all the modules.

Thing with in-eden modules is that it will be pretty "pre-made" and not so random.

 

If what you are looking for is one task for each session/game/mission, I think the if count TaskArray > 0 is not necessary.

Share this post


Link to post
Share on other sites

Yeah I don't want the tasks THEMSELVES to be random, just which one is assigned to the group. I do see what you mean with the if count TaskArray >0 being unnecessary most likely.

Share this post


Link to post
Share on other sites

Still unclear to me what exactly you're trying to do since at one point you talk about randomly choosing a .sqf to execVM, then you want it via modules?

In your first example there's no task to be seen, except it's happening inside the randomly chosen .sqf, in which case you have randomly selected a task, which was what you wanted to do in the first place?

 

Cheers

Share this post


Link to post
Share on other sites
On 12/1/2017 at 6:03 AM, DahToaster said:

I suppose my mental block would be, in the .sqf files for each task, what would I need to do to have those activate in-game tasks? For instance, one of the tasks is to destroy an ammo depot I just named "russian_ammo_dump". For further clarification, I used the in-game modules to create each task.

 

You already have the three task SQFs in your array, instead of using the task modules from the editor, write the tasks creation / handling in the scripts. Check out https://community.bistudio.com/wiki/BIS_fnc_taskCreate and https://community.bistudio.com/wiki/Arma_3_Tasks_Overhaul for more information on how to script tasks instead of using the modules. Mixing scripts and placed modules does not work very well in my experience.

Share this post


Link to post
Share on other sites
On 12/3/2017 at 2:05 PM, lukio said:

 

You already have the three task SQFs in your array, instead of using the task modules from the editor, write the tasks creation / handling in the scripts. Check out https://community.bistudio.com/wiki/BIS_fnc_taskCreate and https://community.bistudio.com/wiki/Arma_3_Tasks_Overhaul for more information on how to script tasks instead of using the modules. Mixing scripts and placed modules does not work very well in my experience.

 

Yeahhhh that's what I was thinking I'd have to resort to. I was instead looking for a way to integrate them back into the modules, as to be honest I just hate doing a ton of scripting nowadays lol. The modules are so much easier for me to deal with.

 

On 12/2/2017 at 4:08 AM, Grumpy Old Man said:

Still unclear to me what exactly you're trying to do since at one point you talk about randomly choosing a .sqf to execVM, then you want it via modules?

In your first example there's no task to be seen, except it's happening inside the randomly chosen .sqf, in which case you have randomly selected a task, which was what you wanted to do in the first place?

 

Cheers

 

I wanted the randomly chosen .sqf to activate the "create task" module that I placed in eden. Lukio brings up the very valid point, however, that even with how well eden works now that scripting and modules still don't play well. So I may just have to do no randomization or entirely scripted for tasking.

Share this post


Link to post
Share on other sites

×