Jump to content
Sign in to follow this  
J. Schmidt

Post Apocalypse Fallout Campaign WIP

Recommended Posts

Along with many other things I'm currently working on I've started another project in creating a sandbox campaign, but I need some help with some of the scripts I'm using/creating. As of now I'm trying to create a script which spawns random radiation areas around the map of Chernarus, but I don't know how to get the array to work properly. I was also wondering if it is at all possible to just have the game spawn random radiated areas itself. Here's is what I have so far:

Init.sqf:

// Begin init.sqf
// Add fnc_destroyCity

script = [] execVM "scr\gunControl.sqf";
script = [] execVM "scr\fnc_destroyCity.sqf";

if (!(isServer) && !(isDedicated) && (player != player) || (isNull player)) then 
{
waitUntil {(player == player) && !(isNull player)};
};

[] spawn 
{
private ["_ContArea_array", "_x"];
_ContArea_array = [ContArea1, ContArea1_1, ContArea1_3, ContArea1_4, ContArea1_5, ContArea1_6, ContArea1_7, ContArea1_8, ContArea1_9, ContArea1_10, ContArea1_11, ContArea1_12, ContArea1_13, ContArea1_14, ContArea1_15, ContArea1_16, ContArea1_17, ContArea1_18, ContArea1_19, ContArea1_20];
if (isServer) then 
{
	while {true} do 
	{
		_ContArea_array = "SmokeShellGreen" createVehicle (getPos _x); _ContArea_array setPos [(getPos _x select 0)-10*sin(0), (getPos _x select 1)-10*cos(0), 3];
		sleep 15; 
	};
};
};

null = [Player,100,20,10,3,6,-0.3,0.1,0.5,1,1,1,11,10,12,true,2] execFSM "Fog.fsm";

When I go in-game I find the the radiated areas (which are marked by game logics) don't have anything going on, no smoke, no nothing. So what am I missing or what did I do wrong?

Share this post


Link to post
Share on other sites

this will create a simple way of placing random smokeshells around the map using one marker placed in the center of your map called "center". Quick and easy way - no markers - but can be added

for "_i" from 0 to 10 do     
{
_distances = [100,250,500,750,1200,1500,2000,2500] call BIS_fnc_selectRandom;
_ang = random 360;  	
_dis = _distances; 
_dx = sin(_ang)*_dis; 
_dy = cos(_ang)*_dis; 
_loc = [((getmarkerpos "Center") select 0) + _dx, ((getmarkerpos "Center") select 1) + _dy, 0];
_ContaArea = "SmokeShellGreen" createVehicle (getPos _loc);
};

as for your array - if you have all the contents of the array placed - try this - another quick way of doing it.

{
private ["_ContArea_array", "_x"];
_ContArea_array = [ContArea1, ContArea1_1, ContArea1_3, ContArea1_4, ContArea1_5, ContArea1_6, ContArea1_7, ContArea1_8, ContArea1_9, ContArea1_10, ContArea1_11, ContArea1_12, ContArea1_13, ContArea1_14, ContArea1_15, ContArea1_16, ContArea1_17, ContArea1_18, ContArea1_19, ContArea1_20];
   if (isServer) then 
   {
    	     {
           _ContaArea = "SmokeShellGreen" createVehicle (getPos _x);
           _ContaArea setPos [(getPos _ContaArea select 0)-10*sin(0), (getPos _x select 1)-10*cos(0), 3];
           sleep 15; 
           } foreach _ContArea_array; 
   };
};

null = [Player,100,20,10,3,6,-0.3,0.1,0.5,1,1,1,11,10,12,true,2] execFSM "Fog.fsm";

Share this post


Link to post
Share on other sites
this will create a simple way of placing random smokeshells around the map using one marker placed in the center of your map called "center". Quick and easy way - no markers - but can be added

for "_i" from 0 to 10 do     
{
_distances = [100,250,500,750,1200,1500,2000,2500] call BIS_fnc_selectRandom;
_ang = random 360;  	
_dis = _distances; 
_dx = sin(_ang)*_dis; 
_dy = cos(_ang)*_dis; 
_loc = [((getmarkerpos "Center") select 0) + _dx, ((getmarkerpos "Center") select 1) + _dy, 0];
_ContaArea = "SmokeShellGreen" createVehicle (getPos _loc);
};

Thanks it works now! I am interested in using the code posted above but I'm getting an Error getpos: type array, expected object location for this part of the code:

_ContaArea = "SmokeShellGreen" createVehicle (getPos _loc);

Will that cause the script not to work? If so how does it need to be fixed?

Share this post


Link to post
Share on other sites

K, I removed the getpos and am using the _loc on its own, I'm no longer getting any errors. But I haven't come across any areas yet that have the radiation going on. I also just found a script which will spawn raiders but I don't know how to use it can anyone explain it to me?

raidersOn.sqf:

// Made by request 1/28/12. This script is called in the init.sqf right before the infotext Marks a town on the map and fills them with raiders. Yes, it's very cute. Why am I writing this? Do I need a reason? Your right, I don't. Have fun trying to get these to work, and if you do please tell me because I will give you a high five I'll also extra comment this for you'll see the townlist variable to _towns, just for aesthetics.

private ["_towns", "_townnumber", "_town", "_townpos", "_group", "_raider", "_man", "_marker"];

_towns = townlist;
//Count the number of towns and pick a random one

_townnumber = random floor (count _towns);
//select that random one

_town = _towns select _townnumber;
//Find the towns position

_townpos = getpos _town;
//Spawn the raiders

//create a group
_group = createGroup resistance;
_raider = ["Ins_Commander", "Ins_Soldier_1", "Ins_Soldier_AR", "Ins_Soldier_CO",
"Ins_Soldier_MG", "Ins_Soldier_Medic", "Ins_Soldier_Sniper",
"Ins_Villager3", "Ins_Villager4", "Ins_Worker2",
"Ins_Woodlander1", "Ins_Woodlander2", "Ins_Woodlander3"] call BIS_fnc_selectRandom;

//create a soldier at that group
//Create a bunch of soldiers...

_man = _group createunit ["_raider",position _town, [], 0, "Form"];
_man = _group createunit ["_raider",position _town, [], 0, "Form"];
_man = _group createunit ["_raider",position _town, [], 0, "Form"];
_man = _group createunit ["_raider",position _town, [], 0, "Form"];
_man = _group createunit ["_raider",position _town, [], 0, "Form"];
_man = _group createunit ["_raider",position _town, [], 0, "Form"];

//Tell them to defend
[_group,position _town] call BIS_fnc_taskDefend;

//Finally put a marker on the town
_marker = createMarker ["Raiders",position _town];
_marker setMarkerType "mil_destroy";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Survivors";
_marker setMarkerSize [1,1];
//And that's it. They will defend the town, tell me if it works...

Do I have to create a _town array with the names of town markers that need to be created in the editor?

Edited by JSF 82nd Reaper

Share this post


Link to post
Share on other sites

grabbed this from Rydygier

- add a gamelogic called centre - bang it in the centre of map

change the smoke shell to something big so you can see it and it doesn't disappear after releasing smoke

			_gamelogic = centre;

			[color="#FF0000"]_towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
                        	for "_i" from 0 to 10 do 
			{[/color]
			_RandomTownPosition = position (_towns select (floor (random (count _towns)))); 
			_posX = (_RandomTownPosition select 0) + (random 200) - (random 200); 
			_posY = (_RandomTownPosition select 1) + (random 200) - (random 200); 
			_MoreRandomTownPosition = [_posX,_posY,0];  
			_loc = [((_MoreRandomTownPosition) select 0) + _dx, ((_MoreRandomTownPosition) select 1) + _dy, 0];
			_ContaArea = "SmokeShellGreen" createVehicle (_loc);
			};

//bit added [FOCK] MIKIE J - as towns are where the names are not necessarily the buildings
		_list = (getpos _ContaArea) nearObjects ["House",200];
	      	 _random = floor (random(count _list));
		_nearest = _list select _random; 
		 _ContaArea setPos (getpos _nearest);

Edited by Mikie boy

Share this post


Link to post
Share on other sites

just add it to the bottom of the other code - sorry my bad - only if you want it to be closer to buildings

Share this post


Link to post
Share on other sites

Ok, how long does it take for the script to work, and where would I expect the radiation to spawn? Also what do you recommend to replace the green smoke and is there a way in which the green smoke can be in a loop?

Share this post


Link to post
Share on other sites

the script takes a while to complete - due to it having to scan a load of stuff (academic answer)

in any case - just so you know something is spawing - create a truck or anything to make sure that its there.

then use the below to teleport to that location - suggest using a marker to be created at each location so you know where to tele

init of player

this addaction ["teleport","teleport.sqf"];

teleport.sqf

onMapSingleClick { { _x setPosATL _pos } forEach units group player };

as for the smoke you could use

"ARTY_SmokeShellWhite"

check the post above slight edit - oversight!

Edited by Mikie boy

Share this post


Link to post
Share on other sites

Once I know the scriPt is working Im going to have to edit the other scripts to get them to work. The other scripts cause the radiated areas to start damaging the player, and creates a custom sound of being radiated unless he is using protective gear. So Im may need some extra help with that.

I'm also going to need some help in creating a script to randomly spawn loot around the map along with some sort of currency. Also I'm going to need some help in creating a shop script where you can buy and sell weapons, items, gear, and possibly food. I decide to create a food necessities

---------- Post added at 03:27 AM ---------- Previous post was at 03:21 AM ----------

If I decide to add that you need to eat food and drink water, no doubt I'm going to need help with doing this also, and I'll try to script these myself but have doubt that'll I be able to do a lot of the scripting myself.

Share this post


Link to post
Share on other sites

SOunds like you got your work cut out for you then - good luck with it all

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  

×