Jump to content
Sign in to follow this  
1para{god-father}

How to Randomise Game / Tasks to complete

Recommended Posts

If I wanted a condition for say two of them that have been set to true,

in my trigger cond would I use

myNameTask1&&myNameTask1 or is it just 1 & ?

thanks

Share this post


Link to post
Share on other sites

I have somewhat of the same problem...but, how would I make it to where after taking out the 3 helicopters and 2 planes...it would show where the evac or end mission is at?

EDIT: I know you guys are probably telling me how to in the previous posts...but could someone give me a full list of the scripting needed to do this? (and how would I show it in the briefing or w/e)

Share this post


Link to post
Share on other sites

Hi shk, really sorry to keep pestering you !

For some reason tasks so not show for JIP , any idea why , and how i can solve this as it works fine when i start but when someone joins later which they normally do they get no tasks ?

Thanks again for all you help and support

Share this post


Link to post
Share on other sites

It's normal that JIPs don't see them automatically. There are multiple ways to handle it, here's one: SHK_Taskmaster.

With that, instead of doing this:

case 0: {
 tskobj_1 = player createSimpleTask["1"];
 tskobj_1 setSimpleTaskDescription ["1", "1", "1"];
 tskobj_1 setSimpleTaskDestination (getMarkerPos "camara");
};
case 1: {
 tskobj_2 = player createSimpleTask["2"];
 tskobj_2 setSimpleTaskDescription ["2", "2", "2"]; 
 tskobj_2 setSimpleTaskDestination (getMarkerPos "pinley");
};

You do this:

case 0: {
 ["Task1","Task1Title","Task1Desc"] call SHK_Taskmaster_add;
};
case 1: {
 ["Task2","Task2Title","Task2Desc"] call SHK_Taskmaster_add;
};

Share this post


Link to post
Share on other sites

I am testing it now on your Random Task Example but it does not seem to work:-

Sorry i was going to send you the mission but have no idae how to send files on here !

taskCount = paramsarray select 0;

//taskCount = 6;

fncAddTask = {

switch _this do {

case 0: {

["Task1","Task1Title","Task1Desc"] call SHK_Taskmaster_add;

};

case 1: {

["Task2","Task1Title","Task2Desc"] call SHK_Taskmaster_add;

};

case 2: {

["Task3","Task1Title","Task3Desc"] call SHK_Taskmaster_add;

};

case 3: {

["Task4","Task1Title","Task4Desc"] call SHK_Taskmaster_add;

};

case 4: {

["Task5","Task1Title","Task51Desc"] call SHK_Taskmaster_add;

};

case 5: {

["Task6","Task1Title","Task6Desc"] call SHK_Taskmaster_add;

};

};

};

fncPickTask = {

if isserver then {

if (count tasks == 0) then {

theEnd = true;

publicvariable "theEnd";

} else {

addTask = tasks select (floor random count tasks);

tasks = tasks - [addTask];

publicvariable "addTask";

if !isdedicated then { addTask call fncAddTask };

};

};

};

theEnd = false;

if isserver then {

tasks = [];

for "_i" from 0 to (taskCount - 1) do {

tasks set [_i,_i];

};

} else {

[] spawn {

waituntil {!isnil "addTask"};

addTask call fncAddTask;

"addTask" addpublicvariableeventhandler {(_this select 1) call fncAddTask};

};

};

call fncPickTask; // add first task for briefing

---------- Post added at 11:08 AM ---------- Previous post was at 11:01 AM ----------

opps forgot to put in :- call compile preprocessfile "shk_taskmaster.sqf";

is that what i need ?and how i call it.

Would I put that in after or before the call to FncPicktask ?

Thanks

Share this post


Link to post
Share on other sites

Yeah, you should call the file before doing anything with tasks because the add function obviously needs to defined before using it. :)

Share this post


Link to post
Share on other sites

Have it all working tested it last night and all JIP received the tasks !! Well happy !

The only thing is Notes how would I call them ?

I have tried your example and put this after the ... call fncPickTask;

but I get no notes still would i have to call this differently ?

[["Note1","Hello West",WEST],

["Note2","Hello East",EAST],

["Credits","Made by: Shuko of LDD Kyllikki<br />www.kyllikki.fi"]

]] execvm "shk_taskmaster.sqf";

Share this post


Link to post
Share on other sites

First array is for tasks, second for notes.

[ [],
 [
   ["Note1","Hello West",WEST],
   ["Note2","Hello East",EAST]
 ]
] exec...

Or you can do:

["Note1","Text1"] call SHK_Taskmaster_addNote;
["Note2","Text2"] call SHK_Taskmaster_addNote;

However, I haven't added JIP support for notes (that are created after mission started). Obviously, JIPs will see notes added in init.sqf.

Share this post


Link to post
Share on other sites

So how would we make the enemy presence at the mission area also be generated by a script.

so we can create a heap of side missions and not lag the server out. like fore example the domination side missions all the enemy and main target at the side are triggered by a script.

Share this post


Link to post
Share on other sites

Many Many ways to do that,

I use like to use UPSMON.

Set up a template i.e make a group place this in leader:-

null=[this,"marker_template_area","delete:",150,"template:",1] execvm "scripts\UPSMON.sqf";

Then call them in when you need to via any script i.e spawnmission1.sqf:-

if (!isServer) exitWith {};
_upsgrp1 = [1,getmarkerpos "Spawnmarkername",1,["Patrolmarkername","showmarker","spawned","respawn:",5,"delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

Download UPSMON and have a look

Share this post


Link to post
Share on other sites

Cheers mate truely appreciate the help,

my results,

Ok i downloaded upsmon and have had a look, i get the part where i place a group in the editor and place

null=[this,"marker_template_area","delete:",150,"template:",1] execvm "scripts\UPSMON.sqf";

in the leaders init

but i dont get how i can remove them from the editor and call them in by a script at the specific mission location when the mission is called.

Dont suppose you could make a little demo just i group spawning when a mission is called.

i.e - I have used the random tasks demo on page 2 of this thread to create my random missions i just need to spawn enemy at the mission area when the mission is active and delet them when the mission is not active

therefore i do not wish to have any enemy units in the editor i hope i make sense lol.

---------- Post added at 00:22 ---------- Previous post was at 23:48 ----------

Also i am using the taskmaster as mentioned above but when it randomly gets the mission i get no marker so no one knows where to go a;lso it does not tell you a mission has been started but if you go to map its in the tasks.

my init

call compile preprocessfile "shk_taskmaster.sqf";

//taskCount = paramsarray select 0;
taskCount = 6;

SHK_addTask = {
 if isserver then {
   if (count SHK_Tasks == 0) then {
     // whatever you want server to do when mission should end
     TheEnd = true;
     publicvariable "TheEnd";
   } else {
     [] spawn {
       if (count SHK_Tasks != taskCount) then {sleep 1};
       private "_t";
       _t = SHK_Tasks select (floor random count SHK_Tasks);
       SHK_Tasks = SHK_Tasks - [_t];
       switch _t do {
         case 0: { ["Task1","Task1Title","Task1Desc"] call SHK_Taskmaster_add };
         case 1: { ["Task2","Task2Title","Task2Desc"] call SHK_Taskmaster_add };
         case 2: { ["Task3","Task3Title","Task3Desc"] call SHK_Taskmaster_add };
         case 3: { ["Task4","Task4Title","Task4Desc"] call SHK_Taskmaster_add };
         case 4: { ["Task5","Task5Title","Task5Desc"] call SHK_Taskmaster_add };
         case 5: { ["Task6","Task6Title","Task6Desc"] call SHK_Taskmaster_add };
       };
     };
   };
 };
};
if isserver then {
 SHK_Tasks = [];
 for "_i" from 0 to (taskCount - 1) do {
   SHK_Tasks set [_i,_i];
 };

 call SHK_addTask; // first task
};

i also have the class Params set up in the description.

Share this post


Link to post
Share on other sites

Don't even place them in the editor. Just create them with a script somewhere around the target area, create (or move) an invisible marker with a script, and start the UPSMON on the units you just spawned. For example, if _group points to the group you just spawned, then you will use:

null=[(units _group) select 0, "spawned", "nameOfMarkerIJustMoved", "delete:" ,150, "template:", 1] execvm "scripts\UPSMON.sqf";

Or, if _unit is a unit in the group, then:

null=[_unit,"nameOfMarkerIJustMoved", "spawned", "delete:", 150, "template:", 1] execvm "scripts\UPSMON.sqf";

I don't remember what the "template" does since I've never used it (may want to read on that on the UPSMON thread), and not sure if you actually want to delete them 150 seconds after they die or just use a bigger cleanup script for your mission, but that should give you an idea how to do it. Assuming you know how to actually spawn units (with either createUnit or BIS_fnc_spawnGroup).

Share this post


Link to post
Share on other sites

galzohar and psvialli thanks guys you have put me on a good direction ill play with that a bit and to answer your question no i dont know how to actually spawn units (with either createUnit or BIS_fnc_spawnGroup).

but ill try to learn you cant put me in the right direction to learn that can you m8 maybe a tutorial or forum.

Guess i should off mentioned im a noob at mission scripting actually this is my first mission design.

---------- Post added at 02:11 ---------- Previous post was at 02:07 ----------

Forgot to ask,

how do i make a marker appear on the mission location and remove it once mission is compleate using shk_taskmaster

in my init to randomly create a misswion i use

case 0: { ["Task1","Task1Title","Task1Desc"] call SHK_Taskmaster_add };

in the shk yaskmaster file in the read me part is says

Optional parameters:

Condition boolean/side/faction/unit/group/string Units the task is added to. Default is everyone

Marker array Marker related to the task. It will be created only for the units who have the task. Marker will be hidden after task is completed.

Name string Name of the marker to create.

Position string Position of the marker.

Type string Marker type. Optional, default is "selector_selectedMission".

Color string Marker color. Optional, default is red.

State string Task state of the newly created task. Default is "created".

how do i implement that into my init to show and delet the marker.

Share this post


Link to post
Share on other sites

i got the marker showing on the taks by using

["Task1","Task1Title","Task1Desc"[color="#FF8C00"],true,["mrkTaskMM1",getmarkerpos "task1","","","text1"][/color]] call SHK_Taskmaster_add };

the orange is the code for the marker

now break it down

mrkTaskMM1 = the type of marker to show

task1 = is the marker you have on the map for the task area ( this is needed becouse taskmaster will spawn its marker at this position)

text1 = you can change that to what ever you want to be typed beside the marker in game on the map

hope this helps someone

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  

×