Jump to content
greywolf907

Random tasks\objectives

Recommended Posts

Yea I think its great, hey if I can understand it after looking at your code then I think most can. (when I say understand it, I mean edit and copy). Don't ask me to decipher it. When I get home I will send you my version, I added some stuff so.... its a flexible, clean and easier script to edit and understand. What else would one want?

Share this post


Link to post
Share on other sites

Yup you got something here with this script I was looking for something just like this for awhile place markers for the AO'S and be able to adjust the enemy units to what your happy with and the random objectives is a big part. This all plays real smooth together with a set of scripts like this for people to make some different missions with should be great results. Testing that out now almost have it tuned in here thanks.

---------- Post added at 02:21 PM ---------- Previous post was at 02:09 PM ----------

Bingo that did it except for the tower, once the AO was cleared all the remaining vehicles despawned nice work man. Not sure whatsup with that tower but not that big of deal to have the wreckage of it left behind more realistic I guess.

Share this post


Link to post
Share on other sites

Hey JShock just a update all is working good have not had any problems thus far we are putting the mission through a good heavy test run I will shoot you a link when its ready for DL. THANKS AGAIN FOR ALL YOUR HELP!!!

Share this post


Link to post
Share on other sites

Hey JShock what would be a useable call line for initserver.sqf for units to spawn with mission?

_units = ["mrkName",200,5,3,2,2,1,EAST] call JSHK_fnc_patrols;

Share this post


Link to post
Share on other sites

I would actually recommend running it in the initServer, and it shouldn't be any different than using it any where else.

Share this post


Link to post
Share on other sites

transiting from the other post about garrison. Here is my idea, and I know you stated prior you didn't intend it to be this, but I like this, its easy to edit and so....

I am using 7 markers total all with different units/amounts, so my thought because lack there of.... is name each call line different, having different fnc_patrols and not me but you can, change units/vehicles in each if need be and spawn all types of crap, also, this could be called via trigger, well I presume that, have not tested the trigger yet, will be.

_units = ["mrkName",200,5,5,5,5,2,0,0,0,EAST] call JSHK_fnc_patrols;  
_units = ["mrkName",200,5,5,5,5,0,0,0,0,EAST] call JSHK_fnc_patrols1;  
_units = ["mrkName",200,5,5,5,5,2,0,0,0,EAST] call JSHK_fnc_patrols2;
_units = ["mrkName",200,5,5,5,5,0,0,0,0,EAST] call JSHK_fnc_patrols3;

and so forth. Also, using this with Takistan, the randomPos doesn't work in Takistan so I had to define the mapSize with something I forget what. But now it works with A3MP maps.

here is the code that doesn't work with A3MP.

_randomPos = [[[getMarkerPos currentAO, PARAMS_AOSize],_dt],["water","out"]] call BIS_fnc_randomPos;

Edited by JAndrews1

Share this post


Link to post
Share on other sites

Hi! I need a group of divers and boats. Please Add this skripts [JSHK_fncs] _units = [_centerPos,100,5,2,2,2,2,?,?,RESISTANCE] call JSHK_fnc_patrols

Share this post


Link to post
Share on other sites
Hi! I need a group of divers and boats. Please Add this skripts [JSHK_fncs] _units = [_centerPos,100,5,2,2,2,2,?,?,RESISTANCE] call JSHK_fnc_patrols

I have not seen jshock here for a while. U have to edit his scripts in a few places to add those units. I doubt he would care. But doubt he has the time to help either.

Share this post


Link to post
Share on other sites
I have not seen jshock here for a while.

True.

U have to edit his scripts in a few places to add those units.

True.

I doubt he would care.

True.

But doubt he has the time to help either.

And also very true.

:D

As far as I'm concerned there is considerably enough information in this thread for you to figure it out, sorry if that makes me an ass, but eh :p.

Share this post


Link to post
Share on other sites

I himself might to add divers and boats, but they do not want to be reborn in water!

for example:

if (_numDiverPatrols > 0) then

{

for "_i" from 1 to (_numDiverPatrols) step 1 do

{

_configDGrp = _DiverUnits call BIS_fnc_selectRandom;

_rndPos = [_AOmarker,50,_radius,5,0,0.5,0,[],[]] call BIS_fnc_findSafePos;

_spawnGroup = [_AOmarker,_center, (configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "SpecOps" >> " (_configDGrp))] call BIS_fnc_spawnGroup;

[_grp, (_AOmarker), (random(50)+75)] call BIS_fnc_taskPatrol;

{_units pushBack _x} forEach units _grp;

};

};

Here in this lineneed to write correctly.?

_rndPos = [_AOmarker,50,_radius,5,0,0.5,0,[],[]] call BIS_fnc_findSafePos;

On the ground, there are the divers in the water, they do not, I can not find right expressions!

Edited by sergeziegler

Share this post


Link to post
Share on other sites

Try this:

_rndPos = [_AOmarker,50,_radius,5,2,0.5,0,[],[]] call BIS_fnc_findSafePos;

Share this post


Link to post
Share on other sites

Hi! Thanks, it worked! But there is still another problempoint their routes is not area of the marker!

Share this post


Link to post
Share on other sites

have divers waypoint is not on the water and not on the marker, what do I do?

[_grp, (_AOmarker), (random(50)+75)] call BIS_fnc_taskPatrol ???

Share this post


Link to post
Share on other sites

Yea it's probably the BIS function, you will need to find another community script that allows for waypoint/patrol generation in water.

  • Like 1

Share this post


Link to post
Share on other sites

Yea it's probably the BIS function, you will need to find another community script that allows for waypoint/patrol generation in water.

 

It's a pity! I have to look for other options

Share this post


Link to post
Share on other sites

I have setup random missions with the scripts from this thread and everything runs great.

 

Could anyone tell/show me how i could make/change the script below to not be random but instead closest to player, i have a player with a large placement radius and so would prefer to use that for randomness instead.

 

I dont code by i can get my head around some things.

//objectiveInit.sqf

_objType = floor(random(10));

if (count glb_objectiveLocations > 0) then
{
    _rndLoc = glb_objectiveLocations call BIS_fnc_selectRandom;
    switch (_objType) do
    {
        case 0: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective0Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
        case 1: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective1Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
        case 2: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective2Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
        case 3: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective3Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
        case 4: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective4Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
        case 5: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective5Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
		case 6: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective6Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
		case 7: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective7Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
		case 8: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective8Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
		case 9: {[(getMarkerPos _rndLoc)] execVM "Objectives\objective9Create.sqf"; glb_objectiveLocations = glb_objectiveLocations - [_rndLoc];};
        default {diag_log "Objective not defined"};
    };
}
else
{
    ["Won"] call BIS_fnc_endMissionServer;
};  

Share this post


Link to post
Share on other sites

hey guys,

 

I'm trying to work this out and Im not having much luck.. not even sure if its possible.

 

//example objective0Create.sqf
//call line being: [(getMarkerPos _rndLoc)] execVM "objective0Create.sqf";
_centerPos = (_this select 0); 

//This is where any DAC stuff would go, assuming it can use the "_centerPos" to spawn stuff around 
DAC_Basic_Value = 0;
execVM "DAC\DAC_Config_Creator.sqf"; 

_trg1 = createTrigger ["EmptyDetector",_centerPos]; 
_trg1 setTriggerArea [50, 50, 0, false]; 
_trg1 setTriggerActivation ["LOGIC", "PRESENT", true]; 
_trg1 setTriggerStatements ["true","fun = ['z1',[1,0,0],[3,3,20,6],[],[],[],[0,0,0,0,1]] spawn DAC_Zone", ""];  

_clearTask =[.........

 

 

Basically where you see 'z1' on triggerStatements is where I believe I'm having issues. The DAC_Zone function is trying to reference the triggers "variable name" of the trigger that was just created.

Can I even set a string type name to triggers to later access them by name? Normally this would be done in the editor and you'd directly assign a var name to the trigger you place down, but I want the random functionality.

I'm at a total lose with this one...

 

I know this is a bit off topic, but this DAC implementation is spawning off the random tasks scripts you'll have been working on.

 

Any help will be greatly appreciated. thanks

Share this post


Link to post
Share on other sites

So, the first parameter into DAC_Zone is the reference to the trigger?

 

If so:

_trg1 setTriggerStatements ["true",format ["fun = [%1,[1,0,0],[3,3,20,6],[],[],[],[0,0,0,0,1]] spawn DAC_Zone",_trg1], ""];

Share this post


Link to post
Share on other sites

I already tried that and I think whats happening is, when you call in _trg1 for the %1 holder you're just calling in the trigger object. For the function to work it needs the name of the trigger in string format, which in the editor is super easy to do by adding a value to the variable name field. I just can't find anything on how to set that value in script other then what bis wiki states on the createTrigger function. Name is a valid param, but no examples as to how to implement it.

Share this post


Link to post
Share on other sites

So...

_trg1 setTriggerStatements ["true",format ["fun = [""%1"",[1,0,0],[3,3,20,6],[],[],[],[0,0,0,0,1]] spawn DAC_Zone",name _trg1], ""];

Share this post


Link to post
Share on other sites

_trg1 = createTrigger ["EmptyDetector",_centerPos];
_trg1 setVehicleVarName "z1";
missionNamespace setVariable [ "z1", _trg1 ];
_trg1 setTriggerArea [50, 50, 0, false]; 
_trg1 setTriggerActivation ["LOGIC", "PRESENT", true]; 
_trg1 setTriggerStatements ["true","fun = ['z1',[1,0,0],[3,3,20,6],[],[],[],[0,0,0,0,1]] spawn DAC_Zone", ""];
or

_trg1 = createTrigger ["EmptyDetector",_centerPos];
_trg1 setTriggerArea [50, 50, 0, false]; 
_trg1 setTriggerActivation ["LOGIC", "PRESENT", true]; 
_trg1 setTriggerStatements ["true","fun = [thisTrigger call BIS_fnc_objectVar,[1,0,0],[3,3,20,6],[],[],[],[0,0,0,0,1]] spawn DAC_Zone", ""];

Share this post


Link to post
Share on other sites

Awesome!! Thanks guys. This one worked perfectly.

 

 

_trg1 setTriggerStatements ["true","fun = [thisTrigger call BIS_fnc_objectVar,[1,0,0],[3,3,20,6],[],[],[],[0,0,0,0,1]] spawn DAC_Zone", ""];

 

 

Now I just need to figure out how to detect when EAST not present in the trigger area to complete the clear area task. Adding another trigger over the one that was just created doesn't seem to be working when I clear out the DAC spawned AI.

Any ideas?

Share this post


Link to post
Share on other sites

Could you not just set _trg1 activation to: ["EAST", "NOT PRESENT", true] or does DAC need a specific trigger activation?

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

×