Jump to content
Sign in to follow this  
Nephris1

dynamic mission targets

Recommended Posts

Hi folks,

i would like to update my map with dynamic misison targets.

My plan is to create a pool of maybe 6 targets.

By chance 3 of that pool are valid for the mission to accomplish.

Could you plz help me to get into it?

The problem is not to choose a variable by chance but to adopt it ionto the briefing......so maybe you have an approach?!

Share this post


Link to post
Share on other sites

try this :

it's a script for make random objective :

// Rmission = this addAction "Demande de Mission", "RandomMission.sqf";

//Ici on déclenche au hasard une des 5 missions

waitUntil { BIS_fnc_init };

_target = _this select 0;

_unit = _this select 1;

_id = _this select 2;

switch (floor(random 5)) do {

case 0: {

// SideMission1

obj1 = player createSimpleTask["Tuer salope."];

obj1 setSimpleTaskDestination (getMarkerPos "");

sleep 1;

[nil,nil,rHINT,"Nouveau run : Tuer salope."] call RE;

sleep 1;

"mAirport" setMarkerType "dot";

sleep 1;

_target removeaction _id;

[this] exec "mission\salope.sqf";

};

case 1: {

// SideMission2

obj2 = player createSimpleTask["Trouver le pick up"];

obj2 setSimpleTaskDestination (getMarkerPos "");

sleep 1;

[nil,nil,rHINT,"Nouveau run : Trouver le pick up"] call RE;

sleep 1;

"pickup" setMarkerType "dot";

sleep 1;

_target removeaction _id;

[this] exec "mission\pickup.sqf";

};

case 2: {

// SideMission3

obj3 = player createSimpleTask["Allez au waypoint 1"];

obJ3 setSimpleTaskDescription["A fond les manettes jusqu'au point 1", "Allez au point 1", "Allez au point 1"];

obj3 setSimpleTaskDestination (getMarkerPos "");

sleep 1;

[nil,nil,rHINT,"Nouveau run : Etape 1"] call RE;

sleep 1;

"Pint1" setMarkerType "dot";

sleep 1;

_target removeaction _id;

[this] exec "mission\point1.sqf";

};

case 3: {

// SideMission4

obj4 = player createSimpleTask["Trouver le humvee"];

obJ4 setSimpleTaskDescription["Amélioré votre véhicule en trouvant le humvee", "Tuning", "Tuning"];

obj4 setSimpleTaskDestination (getMarkerPos "");

sleep 1;

[nil,nil,rHINT,"Nouvelle tâche affectée : Sécuriser et enquêter sur le crash du c-130"] call RE;

sleep 1;

"humvee" setMarkerType "dot";

sleep 1;

_target removeaction _id;

[this] exec "mission\tuning.sqf";

};

case 4: {

// SideMission5

OBJ_NOM = player createSimpleTask["OBJ_TITRE"];

OBJ_NOM setSimpleTaskDescription["OBJ_DESCRIPTION", "OBJ_TITRE", "OBJ_TITRE"];

OBJ_NOM setSimpleTaskDestination (getMarkerPos "OBJ_MARQUEUR");

sleep 1;

_target removeaction _id;

[this] exec "side\bombe\panside5.sqf";

};

};

Share this post


Link to post
Share on other sites

Thx for your approach!

Gonna check it out tonight!:)

Share this post


Link to post
Share on other sites

Personnaly i use another approach.

First i put an object on editor, i group it with 3 markers, the object change his position each time you launch the game. I put 3 triggers on the three markers area and i group with the object.

If the object is in the trigger 1, i launch obj1.sqf if it is in the second area it launch obj2.sqf etc...

I prefer this because sometimes this script doesn't work. After i delete all triggers and markers.

Share this post


Link to post
Share on other sites

Please guys....when you post code use the code tags "#". Use the Go Advanced button below.

Otherwise it's just a jumble of text and too hard to read!

Share this post


Link to post
Share on other sites

Another approach would be to just execute a random file, which includes the task stuff... ;)

_Tasks = ["Task1.sqf","Task2.sqf","Task3.sqf"];
_Task = _Tasks select (floor(random(count _Tasks)));
execVM _Task;

Share this post


Link to post
Share on other sites

Nice thanks :)

But do you have a tips for delete task1 if we play it and if we go launch again this script for don't play the same task?

Share this post


Link to post
Share on other sites

Sure...

AllTasks = ["Task1.sqf","Task2.sqf","Task3.sqf"]; <-- This is an array. Arrays can be modified. So if a task has been played we simply delete it from the array. Its important that you put this array into a different file then the code below. Because we want to define it only once. Ini.sqf would be a good place.

if (count AllTasks < 1) exitWith { hint "no tasks left to play!"; }; [color="SeaGreen"]// Maybe you can make use of this line[/color]


_Task = AllTasks select (floor(random(count AllTasks )));
AllTasks = AllTasks - [_Task]; [color="SeaGreen"]// Delete the task from the "AllTasks" array[/color]
execVM _Task;

:)

Share this post


Link to post
Share on other sites

tanke you veri muuuch

it's better than the script i used before :)

Share this post


Link to post
Share on other sites
Another approach would be to just execute a random file, which includes the task stuff... ;)

_Tasks = ["Task1.sqf","Task2.sqf","Task3.sqf"];
_Task = _Tasks select (floor(random(count _Tasks)));
execVM _Task;

Hi I have been looking at this with some intrest as I want this in my mission. Could you please tell me where this code goes and how you would execute it Thanks :)

Share this post


Link to post
Share on other sites

Just put in sqf, exemple in unit ini write "this exec "task.sqf"

and in task.sqf write the script and it's ok.

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  

×