Jump to content
Sign in to follow this  
jandrews

safe zone + player protection and objectsMapper questions.

Recommended Posts

1. I am using a "safe zone" script to prevent TK'ing at base AND trying to protect players from AI that may wonder in the base. However this script is not working anymore. Ideas?

Am using basic trigger with blufor present and this as condition;

{if(side _x == independent) || (side _x == east) then {_x setDamage ((damage _x) + 0.1)};} forEach thisList;

18:04:54 Error in expression <_x == independent) || (side _x == east) then {_x setDamage ((damage _x) + 0.1)};>
18:04:54   Error position: <then {_x setDamage ((damage _x) + 0.1)};>
18:04:54   Error then: Type Bool, expected if

2. attempting to spawn this to _officer1 but keeps coming back with generic error;

0 = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;

0 = [(getPos _officer1), random(359), call (>
17:51:45   Error position: <[(getPos _officer1), random(359), call (>
17:51:45   Error Generic error in expression

Share this post


Link to post
Share on other sites

1. try:

if ( (side _x == independent) || (side _x == east) ) then...........

I'm wondering the lack of extra brackets around the condition is stuffing it up

Share this post


Link to post
Share on other sites

this && ({side _x isEqualTo EAST || side _x isEqualTo INDEPENDENT} count thisList > 0)

Your set damage portion would go in onAct:

{_x setDamage ((damage _x) + 0.1)} forEach thisList;

Edited by JShock

Share this post


Link to post
Share on other sites

1. Solved. Thanks again JShock.

Anyone have ideas for #2. I tried removing the 0 = and still dumb generic error.

2. attempting to spawn this to _officer1 but keeps coming back with generic error;

0 = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;

0 = [(getPos _officer1), random(359), call (>
17:51:45   Error position: <[(getPos _officer1), random(359), call (>
17:51:45   Error Generic error in expression

Share this post


Link to post
Share on other sites

That means that _officer1 is not defined. If you have a unit in the editor named "officer1" then remove the underscore in the script. Else, define the variable before using it.

Share this post


Link to post
Share on other sites
That means that _officer1 is not defined. If you have a unit in the editor named "officer1" then remove the underscore in the script. Else, define the variable before using it.

Here is the script. :confused:

// spawn target
_off = createGroup EAST;
_officer1 = _off createUnit ["O_officer_F",[((getmarkerpos "side_area" select 0) + 150), getmarkerpos "side_area" select 1,0], [], 0, "CAN_COLLIDE"];
_officer1 setUnitPos "middle";
_officer1 setDir 45;
_officer2 = _off createUnit ["O_G_officer_F",[((getmarkerpos "side_area" select 0) + 154), getmarkerpos "side_area" select 1,0], [], 0, "CAN_COLLIDE"];
_officer2 setUnitPos "middle";
_officer2 setDir 90;

0 = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;

Share this post


Link to post
Share on other sites
Are the units being spawned?

yea, script stops at the error.

Share this post


Link to post
Share on other sites

Try putting the same parenthesis structure around the "y" position like you have with the "x" position when spawning the unit:

getmarkerpos "side_area" select 1

((getmarkerpos "side_area") select 1)

Share this post


Link to post
Share on other sites
Try putting the same parenthesis structure around the "y" position like you have with the "x" position when spawning the unit:

getmarkerpos "side_area" select 1

((getmarkerpos "side_area") select 1)

No luck! this error is crazy! or may be I am!

18:43:34 Error in expression <Pos "middle";
_officer2 setDir 90;

0 = [(getPos _officer1), random(359), call (>
18:43:34   Error position: <[(getPos _officer1), random(359), call (>
18:43:34   Error Generic error in expression
18:43:34 File C:\Users\Andrews\Documents\Arma 3\missions\mission_setup.Altis\sidemissions\side1.sqf, line 27

// spawn target
_off = createGroup EAST;
_officer1 = _off createUnit ["O_officer_F",[((getmarkerpos "side_area" select 0) + 150), ((getmarkerpos "side_area") select 1),0], [], 0, "CAN_COLLIDE"];
_officer1 setUnitPos "middle";
_officer1 setDir 45;
_officer2 = _off createUnit ["O_G_officer_F",[((getmarkerpos "side_area" select 0) + 154), ((getmarkerpos "side_area") select 1),0], [], 0, "CAN_COLLIDE"];
_officer2 setUnitPos "middle";
_officer2 setDir 90;

0 = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;  <---- line 27

Share this post


Link to post
Share on other sites

ok, since this is not my skill set. I am wondering if I could try another method to this madness. I will try this when I get home, just like other opinions.

The below link says:

"_this select 0: position of the template - Array [X, Y, Z]"

So I am to presume that I could do something similar to

[((getmarkerpos "side_area" select 0) + 150), ((getmarkerpos "side_area") select 1),0] 

BUT for this

0 = [((getmarkerpos "side_area" select 0) + 150), ((getmarkerpos "side_area") select 1),0], random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper

https://community.bistudio.com/wiki/BIS_fnc_ObjectsMapper

Edited by JAndrews1

Share this post


Link to post
Share on other sites

What does your Rebelcamp1.sqf look like? I have setup my own composition and used your script only changing the composition file contents for my own at it works without errors.

The code i used as shown in one of your previous posts.

// spawn target
_off = createGroup EAST;
_officer1 = _off createUnit ["O_officer_F",[((getmarkerpos "side_area" select 0) + 150), getmarkerpos "side_area" select 1,0], [], 0, "CAN_COLLIDE"];
_officer1 setUnitPos "middle";
_officer1 setDir 45;
_officer2 = _off createUnit ["O_G_officer_F",[((getmarkerpos "side_area" select 0) + 154), getmarkerpos "side_area" select 1,0], [], 0, "CAN_COLLIDE"];
_officer2 setUnitPos "middle";
_officer2 setDir 90;

0 = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;  

Share this post


Link to post
Share on other sites
What does your Rebelcamp1.sqf look like? I have setup my own composition and used your script only changing the composition file contents for my own at it works without errors.

The code i used as shown in one of your previous posts.

// spawn target
_off = createGroup EAST;
_officer1 = _off createUnit ["O_officer_F",[((getmarkerpos "side_area" select 0) + 150), getmarkerpos "side_area" select 1,0], [], 0, "CAN_COLLIDE"];
_officer1 setUnitPos "middle";
_officer1 setDir 45;
_officer2 = _off createUnit ["O_G_officer_F",[((getmarkerpos "side_area" select 0) + 154), getmarkerpos "side_area" select 1,0], [], 0, "CAN_COLLIDE"];
_officer2 setUnitPos "middle";
_officer2 setDir 90;

0 = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;  

that's interesting, I wonder, to my knowledge (memory banks) it doesn't have anything crazy. I will try another composition. Thanks for this information.

here is rebelcamp1

/*
Grab data:
Mission: Rebelcamp
World: Altis
Anchor position: [23346.1, 18654]
Area size: 50
Using orientation of objects: no
*/
_Rebelcamp1 = 
[
["FirePlace_burning_F",[0,0,0],0,1,0,[],"","",true,false], 
["Land_WoodPile_F",[1.92383,-1.05469,0],51.6273,1,0,[],"","",true,false], 
["Land_Sleeping_bag_brown_F",[-0.365234,2.83594,0],0,1,0,[],"","",true,false], 
["Land_Sleeping_bag_brown_F",[2.51758,1.91992,0],0,1,0,[],"","",true,false], 
["Box_FIA_Wps_F",[6.65234,-6.57813,0],0,1,0,[],"","",true,false], 
["CamoNet_INDP_F",[-3.17578,9.17578,0],346.71,1,0,[],"","",true,false], 
["Box_FIA_Ammo_F",[5.39648,-8.5,0],0,1,0,[],"","",true,false], 
["Land_TentDome_F",[-5.47266,8.65625,0],0,1,0,[],"","",true,false], 
["Box_FIA_Wps_F",[9.91016,4.51367,0],0,1,0,[],"","",true,false], 
["Land_TentDome_F",[-0.8125,10.873,0],0,1,0,[],"","",true,false], 
["CamoNet_INDP_F",[7.32227,-8.72656,0],119.475,1,0,[],"","",true,false], 
["Land_TentDome_F",[-10.9941,-0.830078,0],0,1,0,[],"","",true,false], 
["Land_WaterBarrel_F",[-11.043,-3.31445,0],0,1,0,[],"","",true,false], 
["CamoNet_INDP_F",[-11.5879,-2.25391,0],266.881,1,0,[],"","",true,false], 
["Box_FIA_Support_F",[10.1309,6.28711,0],0,1,0,[],"","",true,false], 
["Land_Sleeping_bag_brown_F",[-10.6211,-4.9668,0],0,1,0,[],"","",true,false], 
["B_G_Offroad_01_F",[8.52344,-8.54688,0.0628548],40.5798,1,0,[],"","",true,false], 
["CamoNet_INDP_F",[11.6504,5.50586,0],86.5859,1,0,[],"","",true,false], 
["Land_Sleeping_bag_brown_F",[-12.2129,-4.49414,0],0,1,0,[],"","",true,false], 
["B_G_Offroad_01_armed_F",[12.4043,6.01758,0.065361],0,1,0,[],"","",true,false], 
["I_GMG_01_high_F",[-3.09375,-15.9629,0],102.615,1,0,[],"","",true,false], 
["I_Mortar_01_F",[-8.4668,-14.9121,8.89301e-005],102.615,1,0,[],"","",true,false], 
["I_HMG_01_high_F",[-3.5918,-18.2891,0],102.615,1,0,[],"","",true,false], 
["Box_IND_AmmoVeh_F",[-6.71289,-18.1563,0],0,1,0,[],"","",true,false], 
["I_Mortar_01_F",[-10.3145,-16.8047,8.89301e-005],102.615,1,0,[],"","",true,false], 
["CamoNet_INDP_big_F",[-6.21289,-19.8301,0],233.546,1,0,[],"","",true,false], 
["I_Truck_02_transport_F",[-5.91016,-21.2109,0.260936],99.5341,1,0,[],"","",true,false]
]

Edited by JAndrews1

Share this post


Link to post
Share on other sites
Remove the "_Rebelcamp1 =". I think that's the problem.

Or return it:

/* 
Grab data: 
Mission: Rebelcamp 
World: Altis 
Anchor position: [23346.1, 18654] 
Area size: 50 
Using orientation of objects: no 
*/ 
_Rebelcamp1 =  
[ 
   ["FirePlace_burning_F",[0,0,0],0,1,0,[],"","",true,false],  
   ["Land_WoodPile_F",[1.92383,-1.05469,0],51.6273,1,0,[],"","",true,false],  
   ["Land_Sleeping_bag_brown_F",[-0.365234,2.83594,0],0,1,0,[],"","",true,false],  
   ["Land_Sleeping_bag_brown_F",[2.51758,1.91992,0],0,1,0,[],"","",true,false],  
   ["Box_FIA_Wps_F",[6.65234,-6.57813,0],0,1,0,[],"","",true,false],  
   ["CamoNet_INDP_F",[-3.17578,9.17578,0],346.71,1,0,[],"","",true,false],  
   ["Box_FIA_Ammo_F",[5.39648,-8.5,0],0,1,0,[],"","",true,false],  
   ["Land_TentDome_F",[-5.47266,8.65625,0],0,1,0,[],"","",true,false],  
   ["Box_FIA_Wps_F",[9.91016,4.51367,0],0,1,0,[],"","",true,false],  
   ["Land_TentDome_F",[-0.8125,10.873,0],0,1,0,[],"","",true,false],  
   ["CamoNet_INDP_F",[7.32227,-8.72656,0],119.475,1,0,[],"","",true,false],  
   ["Land_TentDome_F",[-10.9941,-0.830078,0],0,1,0,[],"","",true,false],  
   ["Land_WaterBarrel_F",[-11.043,-3.31445,0],0,1,0,[],"","",true,false],  
   ["CamoNet_INDP_F",[-11.5879,-2.25391,0],266.881,1,0,[],"","",true,false],  
   ["Box_FIA_Support_F",[10.1309,6.28711,0],0,1,0,[],"","",true,false],  
   ["Land_Sleeping_bag_brown_F",[-10.6211,-4.9668,0],0,1,0,[],"","",true,false],  
   ["B_G_Offroad_01_F",[8.52344,-8.54688,0.0628548],40.5798,1,0,[],"","",true,false],  
   ["CamoNet_INDP_F",[11.6504,5.50586,0],86.5859,1,0,[],"","",true,false],  
   ["Land_Sleeping_bag_brown_F",[-12.2129,-4.49414,0],0,1,0,[],"","",true,false],  
   ["B_G_Offroad_01_armed_F",[12.4043,6.01758,0.065361],0,1,0,[],"","",true,false],  
   ["I_GMG_01_high_F",[-3.09375,-15.9629,0],102.615,1,0,[],"","",true,false],  
   ["I_Mortar_01_F",[-8.4668,-14.9121,8.89301e-005],102.615,1,0,[],"","",true,false],  
   ["I_HMG_01_high_F",[-3.5918,-18.2891,0],102.615,1,0,[],"","",true,false],  
   ["Box_IND_AmmoVeh_F",[-6.71289,-18.1563,0],0,1,0,[],"","",true,false],  
   ["I_Mortar_01_F",[-10.3145,-16.8047,8.89301e-005],102.615,1,0,[],"","",true,false],  
   ["CamoNet_INDP_big_F",[-6.21289,-19.8301,0],233.546,1,0,[],"","",true,false],  
   ["I_Truck_02_transport_F",[-5.91016,-21.2109,0.260936],99.5341,1,0,[],"","",true,false] 
];

_Rebelcamp1;  

Share this post


Link to post
Share on other sites

that worked guys. Thanks again!! Now on to deleting it after task complete.

Share this post


Link to post
Share on other sites
that worked guys. Thanks again!! Now on to deleting it after task complete.

The objectsMapper function returns an array of the spawned objects so that should be pretty simple :D.

Share this post


Link to post
Share on other sites
The objectsMapper function returns an array of the spawned objects so that should be pretty simple :D.

Ok, I am already using a garbage cleaner script AND

// remove mans/vehicles/air/static "optional"
sleep 30;
{if (!(isplayer _x)) then {deleteVehicle _x;};} foreach nearestobjects [_sidepos,[
   "air","StaticWeapon","Landvehicle"
   ],2000]; 
sleep 10;
{if (!(isplayer _x)) then {deleteVehicle _x;};} foreach nearestobjects [_sidepos,[
   "man"
   ],2000]; 

sleep 5;

Could you point me in the direction of what else I may need to depose of these compositions?

Or could I just add more to the above array to include those empty objects?

Share this post


Link to post
Share on other sites

What I was getting at was more of this:

_compositionSpawnedObjects = [(getPos _officer1), random(359), call (compile (preprocessFileLineNumbers "compositions\Rebelcamp1.sqf"))] call BIS_fnc_ObjectsMapper;

//after task completed or whatever

{
   deleteVehicle _x;
} forEach _compositionSpawnedObjects;

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  

×