Geocache

  • Offline Mokey
  • Fractured Wasteland
  • Elite
  • ******
  • Posts: 606
  • Https://Fractured-Gaming.com

Geocache

« posted: Apr 12, 2015, 09:39 PM »
I've seen geo cache missions a long time ago...

Random crate spawns with goodies, marked on the map. Does anyone have this script and willing to share?
Posts once, edits post 40 times in 60 seconds. STUPID FAT FINGERS!
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1085
  • ^_^;;

Re: Geocache

« Reply #1 posted: Apr 12, 2015, 10:08 PM »
I've seen geo cache missions a long time ago...

Random crate spawns with goodies, marked on the map. Does anyone have this script and willing to share?

It's from the Sa-Matra mission ... should be able to use one of the current missions like airplane crash and change the conditions for ending the mission something like _waitUntilSuccessCondition =  (player distance _missionPos ) < 50;

- from the grassy knoll -
  • Offline Mokey
  • Fractured Wasteland
  • Elite
  • ******
  • Posts: 606
  • Https://Fractured-Gaming.com

Re: Geocache

« Reply #2 posted: Apr 12, 2015, 10:22 PM »
Hmmm, do you have that mission for stratis?  Will work on it  thursday, then post it up when finished.
Posts once, edits post 40 times in 60 seconds. STUPID FAT FINGERS!
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1085
  • ^_^;;

Re: Geocache

« Reply #3 posted: Apr 12, 2015, 10:24 PM »
Hmmm, do you have that mission for stratis?  Will work on it  thursday, then post it up when finished.

I dabbled - i just have to fix the successCondition ...


Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Version: 1.0
// @file Name: mission_geoCache.sqf
// @file Author: [404] Deadbeat, [404] Costlyy, AgentRev
// @file Created: 08/12/2012 15:19

if (!isServer) exitwith {};
#include "sideMissionDefines.sqf"

private ["_nbUnits", "_wreckPos", "_wreck", "_box1", "_box2"];

_setupVars =
{
_missionType = "Geocache Location";
_locationsArray = MissionSpawnMarkers;
_nbUnits = if (missionDifficultyHard) then { AI_GROUP_LARGE } else { AI_GROUP_MEDIUM };
};

_setupObjects =
{
_missionPos = markerPos _missionLocation;
//delete existing base parts and vehicles at location
_baseToDelete = nearestObjects [_missionPos, ["All"], 25];
{ deleteVehicle _x } forEach _baseToDelete;


_box1 = createVehicle ["Box_NATO_WpsSpecial_F", _missionPos, [], 5, "None"];
_box1 setDir random 360;
[_box1, "mission_USSpecial"] call fn_refillbox;

_box2 = createVehicle ["Box_East_WpsSpecial_F", _missionPos, [], 5, "None"];
_box2 setDir random 360;
[_box2, "mission_USLaunchers"] call fn_refillbox;

{ _x setVariable ["R3F_LOG_disabled", true, true] } forEach [_box1, _box2];



_missionHintText = "Someone has marked a GeoCache on the Map - get there first and it's yours !";
};

_waitUntilMarkerPos = nil;
_waitUntilExec = nil;
_waitUntilCondition = nil;
_waitUntilSuccessCondition = (player distance _missionPos) < 50; // need to fix this for it to work ^^


_failedExec =
{
// Mission failed
{ deleteVehicle _x } forEach [_box1, _box2];
};

_successExec =
{
// Mission completed
{ _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2];


_successHintMessage = "The GeoCache supplies have been found !";
};

_this call sideMissionProcessor;

- from the grassy knoll -
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Geocache

« Reply #4 posted: Apr 14, 2015, 03:35 AM »
I dabbled - i just have to fix the successCondition ...

You forgot the curly braces

No braces: code is only evaluated once, immediately when file is first read, before the mission even starts
Inside curly braces: code is evaluated whenever the script wants to run it
  • Offline JoSchaap
  • Developer
  • Mercenary
  • ******
  • Posts: 483
  • Had a life.. Got a modem.. (~1996)

Re: Geocache

« Reply #5 posted: Apr 14, 2015, 10:16 AM »

Re: Geocache

« Reply #6 posted: Apr 15, 2015, 12:31 PM »
Soo, as usual i dont know what im talking about here but should it be like this then?
Code: [Select]
_waitUntilSuccessCondition = {(player distance _missionPos) < 50};

Re: Geocache

« Reply #7 posted: Apr 15, 2015, 01:23 PM »
BTW, how would one go about adding to to detection so you also have to fly lower than a certain height?

I guess fn_getPos3D is usable somehow?
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Geocache

« Reply #8 posted: Apr 16, 2015, 12:53 AM »
Soo, as usual i dont know what im talking about here but should it be like this then?
Code: [Select]
_waitUntilSuccessCondition = {(player distance _missionPos) < 50};

"player" is null on the server, it would be something more like this:

Code: [Select]
_waitUntilSuccessCondition = {{isPlayer _x && _x distance _missionPos < 50} count playableUnits > 0};

I guess fn_getPos3D is usable somehow?

"(_vehicle call fn_getPos3D) select 2" should get you the same height as shown on aircraft altimeters.

Re: Geocache

« Reply #9 posted: Apr 16, 2015, 07:40 AM »
Thank you Rev, much appreciated!
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1085
  • ^_^;;

Re: Geocache

« Reply #10 posted: Apr 16, 2015, 08:25 AM »
Thank you Rev, much appreciated!

All good and working now - thanks AgentRev for fixing the successCondition ;)

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Version: 1.0
// @file Name: mission_geoCache.sqf
// @file Author: [404] Deadbeat, [404] Costlyy, AgentRev
// @file Created: 08/12/2012 15:19

if (!isServer) exitwith {};
#include "sideMissionDefines.sqf"

private ["_nbUnits","_box1","_box2"];

_setupVars =
{
_missionType = "Geocache Location";
_locationsArray = MissionSpawnMarkers;
_nbUnits = if (missionDifficultyHard) then { AI_GROUP_LARGE } else { AI_GROUP_MEDIUM };
};


_setupObjects =
{
_missionPos = markerPos _missionLocation;
//delete existing base parts and vehicles at location
_baseToDelete = nearestObjects [_missionPos, ["All"], 25];
{ deleteVehicle _x } forEach _baseToDelete;


_box1 = createVehicle ["Box_NATO_WpsSpecial_F", _missionPos, [], 5, "None"];
_box1 setDir random 360;
[_box1, "mission_USSpecial"] call fn_refillbox;

_box2 = createVehicle ["Box_East_WpsSpecial_F", _missionPos, [], 5, "None"];
_box2 setDir random 360;
[_box2, "mission_USLaunchers"] call fn_refillbox;

{ _x setVariable ["R3F_LOG_disabled", true, true] } forEach [_box1, _box2];


_missionHintText = "Someone has marked a GeoCache on the Map - get there first and it's and it's yours !";

};

_ignoreAiDeaths = true;
_waitUntilMarkerPos = nil;
_waitUntilExec = nil;
_waitUntilCondition = nil;
_waitUntilSuccessCondition = {{isPlayer _x && _x distance _missionPos < 50} count playableUnits > 0};




_failedExec =
{
// Mission failed
{ deleteVehicle _x } forEach [_box1, _box2];
};

_successExec =
{
// Mission completed
{ _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2];

_successHintMessage = "The GeoCache supplies have been found !";
};

_this call sideMissionProcessor;

- from the grassy knoll -
  • Offline LouD
  • Silent but deadly ;)
  • Moderator
  • Veteran
  • ******
  • Posts: 1415

Re: Geocache

« Reply #11 posted: Apr 16, 2015, 09:30 AM »
Would be nice if you make the crates spawn randomly near the missionmarker. This way the players would still have to search for it ;)

Re: Geocache

« Reply #12 posted: Apr 16, 2015, 10:53 AM »
Would be nice if you make the crates spawn randomly near the missionmarker. This way the players would still have to search for it ;)

Nice suggestion, also, i dont know if they are usable but isn't there a crate/box with some camonetting? or was that a custom object i saw somewhere?
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1085
  • ^_^;;

Re: Geocache

« Reply #13 posted: Apr 16, 2015, 11:06 AM »
Nice suggestion, also, i dont know if they are usable but isn't there a crate/box with some camonetting? or was that a custom object i saw somewhere?

I use the camonet boxes on my mission file ...

You could also only spawn the box AFTER they are within 5m or so of the objective ^^ or just randomize the spawn location within 25m of the marker

Code: [Select]
_boxPos = _missionPos vectorAdd ([[25 + random 20, 0, 0], random 360] call BIS_fnc_rotateVector2D);
   
Code: [Select]
// Mission completed
_randomBox = ["mission_USLaunchers","mission_USSpecial","mission_Main_A3snipers"] call BIS_fnc_selectRandom;
_box1 = createVehicle ["Box_FIA_Support_F", _boxPos, [], 5, "None"];
_box1 setDir random 360;
[_box1, _randomBox] call fn_refillbox;

- from the grassy knoll -
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1085
  • ^_^;;

Re: Geocache

« Reply #14 posted: Apr 16, 2015, 11:49 AM »
Here we go as requested

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Version: 1.0
// @file Name: mission_geoCache.sqf
// @file Author: [404] Deadbeat, [404] Costlyy, AgentRev, edit by CRE4MPIE
// @file Created: 08/12/2012 15:19

if (!isServer) exitwith {};
#include "sideMissionDefines.sqf"

private ["_nbUnits","_box1"];

_setupVars =
{
_missionType = "Geocache Location";
_locationsArray = MissionSpawnMarkers;
_nbUnits = if (missionDifficultyHard) then { AI_GROUP_LARGE } else { AI_GROUP_MEDIUM };
};


_setupObjects =
{
_missionPos = markerPos _missionLocation;
_boxPos = _missionPos vectorAdd ([[25 + random 20, 0, 0], random 360] call BIS_fnc_rotateVector2D);
//delete existing base parts and vehicles at location
_baseToDelete = nearestObjects [_missionPos, ["All"], 25];
{ deleteVehicle _x } forEach _baseToDelete;

_randomBox = ["mission_USLaunchers","mission_USSpecial","mission_Main_A3snipers"] call BIS_fnc_selectRandom;
_box1 = createVehicle ["Box_FIA_Support_F", _boxPos, [], 5, "None"];
_box1 setDir random 360;
[_box1, _randomBox] call fn_refillbox;


{ _x setVariable ["R3F_LOG_disabled", true, true] } forEach [_box1];

_missionHintText = "an Abandoned GeoCache has been marked on the map - get there first and it's and it's yours !";

};

_ignoreAiDeaths = true;
_waitUntilMarkerPos = nil;
_waitUntilExec = nil;
_waitUntilCondition = nil;
_waitUntilSuccessCondition = {{isPlayer _x && _x distance _boxPos < 5} count playableUnits > 0};


_failedExec =
{
// Mission failed
{ deleteVehicle _x } forEach [_box1];
};

_successExec =
{
// Mission completed
{ _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1];

_successHintMessage = "The GeoCache supplies have been claimed !";
};

_this call sideMissionProcessor;

- from the grassy knoll -