Jump to content
  • 0

Collaborate on a script? (PVP server based wreck spawn and loot)


machine6fd

Question

Ok so here is the deal I want to make a script similar to how breaking point has vehicles spawning gear in towns. I could sit in the editor and do this but I thought it would be neat to build something together.

 

This should be server side if possible and will spawn and despawn loot depending on players proximity.

 

Here is the start. 

//Find center of towns to spawn wreck
if (isServer) then {

_townCenter = CENTER;
_towns = nearestLocations [getPosATL _townCenter, ["NameVillage","NameCity","NameCityCapital"], 25000];
_RandomTownPosition = position (_towns select (floor (random (count _towns))));

{
	_wreck = createVehicle ["Land_Wreck_Hunter_F",_pos,[], 4, "NONE"]; 

} forEach _towns;
}

//tigger, smoke, and boxes.
waituntil{player == player};

_condition = "(vehicle player) in thislist";
_activation = "
	_smoke = createvehicle ["test_EmptyObjectForSmoke",(getpos _wreck),[],0,"NONE"];   
	_smoke attachTo[_wreck,[0,-2,0]];
	_box = createVehicle ["Land_PaperBox_open_full_F", (getpos _wreck), [], 0, "CANCOLLIDE"]; 
	_box = createVehicle ["Land_PaperBox_open_full_F", (getpos _wreck), [], 0, "CANCOLLIDE"]; 
	_box = createVehicle ["Land_PaperBox_open_full_F", (getpos _wreck), [], 0, "CANCOLLIDE"]; 
	_box = createVehicle ["Land_PaperBox_open_full_F", (getpos _wreck), [], 0, "CANCOLLIDE"];

";

_deactivation = "
	"delete vehicle _box";
	"delete vehicle _smoke";
";

_trigger = createTrigger ["EmptyDetector",(getpos _wreck)]; 
_trigger setTriggerActivation ["ANY", "PRESENT", true];
_trigger setTriggerArea [100, 100, 0, false];
_trigger setTriggerType "SWITCH";
_trigger setTriggerText "Trigger";
_trigger setTriggerStatements [_condition, _activation, _deactivation];
trigger = _trigger;

First its finding the center of all towns and spawning the wreck.

 

from there we want to create the trigger and start spawning loot and smoke when a player enters within the area. This is not at all close to done and is all wrote while sitting at my desk at work.... 

 

The idea here is this will be for PVP servers it will alert anyone approaching that the area is occupied. If anyone has more ideas lets add them... if this collaboration works out I have a few more that should be fun... once we have a working script we can add it to the scripts for all to use.

 

If this is not something people want to do I will finish this in time and release it also.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

alright a bit of an update... this is spawning a wreck in every town currently... however we can change it to major cities or other easily here: ["NameCityCapital","NameCity","NameVillage"]

 

next will be to spawn loot when someone is within x meters from the wreck with some sort of time out so they cant walk back and forth and respawn loot. 

_towns = nearestLocations [getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["NameCityCapital","NameCity","NameVillage"], 30000];
wreck = [];
{
    _pos = position _x;
	_wreckpos = [_pos, 1, 1, 0, 0, 20, 0] call BIS_fnc_findSafePos;
	_m = createMarker [format ["mrk%1",random 100000],_pos];
	wreck = wreck + [_m];
       _m setMarkerShape "ICON";
       _m setMarkerType "mil_dot";
       _m setMarkerColor "ColorGreen";
	
	_wreck = createVehicle ["Land_Wreck_Hunter_F",_wreckpos,[], 4, "NONE"]; 
	_smoke = createvehicle ["test_EmptyObjectForSmoke",_wreckpos,[],0,"NONE"];   
	_smoke attachTo[_wreck,[0,-2,0]]; 
	
} forEach _towns;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...