Jump to content
spelmo3

Adding VA to a Spawned in composition

Recommended Posts

So im working on a FOB spawn script. upto now it all works fine.

Addaction on container truck to run the SQF script. the script despawns the truck then runs the code and spawns in all my compositions. but i need to add virtual arsenal to two supply crates in the _object array..
i originally added it the supply crates init fields before i used object grabber. to grab the composition.. obviously this doesnt copy over into the array

im not sure how i go about that.. btw the object im trying to add virtual Arsenal to is "B_A_supplyCrate_F"

code so far is below;

 

_markerName = createMarker ["FOB Alpha", player];
_markerName setMarkerType "hd_flag"; 
_markerName setMarkerText "FOB Alpha";


deleteVehicle FOBTRUCK1;

sleep 3;


_objectsArray = [

	["B_A_supplyCrate_F",[-7.49097,-3.54138,1.43051e-006],58.9527,1,0,[-0.0003387,3.54903e-006],"","",true,false] 
	["Land_Cargo_House_V1_F",[7.28906,6.12756,0],87.6723,1,0,[0,0],"","",true,false], 
	["Land_WaterTank_F",[-5.43066,-7.16418,2.00272e-005],358.416,1,0,[0.00140761,-0.000315334],"","",true,false], 
	["B_A_supplyCrate_F",[-8.54297,3.66064,0],125.868,1,0,[-4.63595e-006,-1.37018e-006],"","",true,false], 
	["Land_PortableLight_double_F",[-3.17969,-8.9541,0],340.729,1,0,[0,0],"","",true,false], 
	["CamoNet_BLUFOR_open_F",[-9.25562,0.519653,0],268.702,1,0,[0,0],"","",true,false], 
	["Land_ToiletBox_F",[9.88672,0.405273,6.67572e-006],88.4163,1,0,[-0.000229069,-0.000436622],"","",true,false], 
	["Land_GarbageBarrel_01_F",[10.1389,-1.72766,-0.00604343],307.257,1,0,[0.3308,0.935652],"","",true,false], 
	["Land_HBarrier_5_F",[-11.0273,3.53418,0],87.9017,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[-2.61914,-10.4092,0],178.557,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_5_F",[-10.6934,-6.56934,0],268.147,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[8.38672,-10.1221,0],178.557,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_5_F",[11.959,3.57324,0],87.7722,1,0,[0,0],"","",true,false], 
	["Land_PortableLight_double_F",[9.74097,-7.47314,0],143.108,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_5_F",[-7.38672,-10.5029,0],227.148,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[12.4219,-6.52246,0],267.546,1,0,[0,0],"","",true,false], 
	["Land_PaperBox_closed_F",[-7.3042,10.8262,0],69.6406,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[-11.3164,9.06934,0],87.3005,1,0,[0,0],"","",true,false], 
	["Land_PaperBox_closed_F",[-9.50366,9.16528,0],312.011,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[12.2266,-6.77246,0],135.892,1,0,[0,-0],"","",true,false], 
	["Land_PortableLight_double_F",[-8.74414,10.4397,0],324.693,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[11.7031,9.14941,0],87.9017,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[-7.42188,12.6924,0],356.646,1,0,[0,0],"","",true,false], 
	["Flag_UK_F",[4.37622,-12.7537,0],179.05,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_5_F",[8.13477,13.2725,0],178.557,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_3_F",[-10.02,10.6465,1.33939],127.492,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_3_F",[-7.08447,12.8091,1.3314],149.258,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_3_F",[-8.82275,11.9532,0],140.781,1,0,[0,-0],"","",true,false], 
	["Land_TTowerSmall_2_F",[8.72632,8.93225,-3.02009],180.361,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[8.39258,13.0693,0],46.9021,1,0,[0,0],"","",true,false], 
	["Land_HBarrierTower_F",[0.218262,15.7477,0],181.546,1,0,[0,0],"","",true,false], 
	["Land_PortableLight_double_F",[2.50903,15.2213,0.00282383],34.0734,1,0,[0,0],"","",true,false], 
	["B_A_Quadbike_01_F",[-5.47314,-15.9047,-0.0102015],161.695,1,0,[-0.102109,0.0473369],"","",true,false], 
	["Land_HBarrier_1_F",[-17.4121,-3.23926,0],355.469,1,0,[0,0],"","",true,false], 
	["Land_Razorwire_F",[-17.832,-0.202148,-2.38419e-006],265.407,1,0,[0,0],"","",true,false], 
	["Land_Razorwire_F",[-12.1367,-14.7178,-2.38419e-006],226.555,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[-16.4492,-9.76855,0],318.366,1,0,[0,0],"","",true,false], 
	["Land_Razorwire_F",[19.1328,0.254883,-2.38419e-006],265.407,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[-18.2891,6.18457,0],355.469,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[-9.68555,-17.0479,0],318.366,1,0,[0,0],"","",true,false], 
	["Land_PortableLight_double_F",[-1.89478,18.7633,-0.00322342],136.662,1,0,[0,-0],"","",true,false], 
	["Land_Razorwire_F",[13.7441,-13.9756,-2.38419e-006],314.574,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[19.6289,-2.94629,0],173.384,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_1_F",[11.5742,-16.3135,0],224.613,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[18.8535,6.84277,0],173.384,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_1_F",[18.3438,-9.4209,0],224.613,1,0,[0,0],"","",true,false]
 ];
 
   [getMarkerPos "FOB Alpha", 0, _objectsArray, 0] call BIS_fnc_objectsMapper;


 

Share this post


Link to post
Share on other sites

This is not an object but the class name of this object, so a string, not an object.

If you save a composition in editor, with codes in init field of the objects, then add this custom composition in any of your scenario, the codes will work (so the arsenal).

 

So, why not:

- place this composition in a specific layer (3den, new layer icon at bottom left),

name this layer: myBase1 in 3den

then do what you want....

example:

at start, in initServer.sqf:

{_x enableSimulationGlobal false; _x hideObjectGlobal true} forEach (getMissionLayerEntities "myBase1" #0);

// or equivalent in 3den

 

then, during mission, on server:

{_x enableSimulationGlobal true; _x hideObjectGlobal false} forEach (getMissionLayerEntities "myBase1" #0);

 

 

 

Share this post


Link to post
Share on other sites
23 hours ago, pierremgi said:

This is not an object but the class name of this object, so a string, not an object.

If you save a composition in editor, with codes in init field of the objects, then add this custom composition in any of your scenario, the codes will work (so the arsenal).

 

So, why not:

- place this composition in a specific layer (3den, new layer icon at bottom left),

name this layer: myBase1 in 3den

then do what you want....

example:

at start, in initServer.sqf:

{_x enableSimulationGlobal false; _x hideObjectGlobal true} forEach (getMissionLayerEntities "myBase1" #0);

// or equivalent in 3den

 

then, during mission, on server:

{_x enableSimulationGlobal true; _x hideObjectGlobal false} forEach (getMissionLayerEntities "myBase1" #0);

 

 

 

 

Thanks for the reply, so pretty much create it on a new layer and have it hidden? I'd have to adapt it because the FOBS are created at the players position when the script is run. il do some research into your suggestion. im still a novice with scripting.

Quote: "If you save a composition in editor, with codes in init field of the objects, then add this custom composition in any of your scenario, the codes will work (so the arsenal)."
i use 0 = ["AmmoboxInit", [this, true]] spawn BIS_fnc_arsenal; in the init field of my supply crates, they work on crates already in the editor but not composition thats spawned in during mission. like the init scripts are not carried?


im using the same object "B_A_supplyCrate_F" in both already in the editor (they work) and in the spawned comp (broken)
I was thinking is there a way to call / check multiples of a certain object is present(possiblity by using its class name). then basically apply the arsenal..  it would need to run once on mission init and run once during my spawn script to update the newly spawned in crates.

again i dont know if that would be effective way or not to run it. and i dont even know if its possible?

 

 

Share this post


Link to post
Share on other sites

You shared a code with defined positions for objects... So, 3den was the solution hiding/showing objects (+simulation)

 

Now, if you spawn them on any possible player's position while in game, I suggest you to have a look at Larrow's script. That demands some extra readings.

 

As comparison, your BIS function object grabber/mapper  are "light". They play with object classes (strings), recorded positions, direction... and that's all, roughly.

So, no joy for keeping specific appearance, init field script, any other setting in attributes of the object (unit stance, group behavior, damage, fuel, ammo, skill...)

... and, first of all, good luck for positioning them on uneven terrain (if you "teleport" them at player's place).

 

So, I gave you the easiest method for hiding/showing FOB on certain places, but not exactly where you want. You must plan several of them in 3den (with the guarantee that everything will be OK), but the restriction is to pre-plan their positions. And truly, for big FOB, it's far better.

 

What you want is more related with Larrow's solution. That's for spawning "anywhere" small living FOB, with guards, houses, vehicles...

If I'm right, if units stances, waypoints... are saved, there is no (not yet?) possibility to grab/run a code in init field of the object. Perhaps, arsenal as infinite equipment storage (see 3den) is working. I don't know if this attribute is saved.

Share this post


Link to post
Share on other sites
8 minutes ago, pierremgi said:

You shared a code with defined positions for objects... So, 3den was the solution hiding/showing objects (+simulation)

 

Now, if you spawn them on any possible player's position while in game, I suggest you to have a look at Larrow's script. That demands some extra readings.

 

As comparison, your BIS function object grabber/mapper  are "light". They play with object classes (strings), recorded positions, direction... and that's all, roughly.

So, no joy for keeping specific appearance, init field script, any other setting in attributes of the object (unit stance, group behavior, damage, fuel, ammo, skill...)

... and, first of all, good luck for positioning them on uneven terrain (if you "teleport" them at player's place). 

 

So, I gave you the easiest method for hiding/showing FOB on certain places, but not exactly where you want. You must plan several of them in 3den (with the guarantee that everything will be OK), but the restriction is to pre-plan their positions. And truly, for big FOB, it's far better.

 

What you want is more related with Larrow's solution. That's for spawning "anywhere" small living FOB, with guards, houses, vehicles...

If I'm right, if units stances, waypoints... are saved, there is no (not yet?) possibility to grab/run a code in init field of the object. Perhaps, arsenal as infinite equipment storage (see 3den) is working. I don't know if this attribute is saved.

 

thanks for the help. There isnt any units or waypoints. the FOB's are quite small. basically small camp like FOB's.  I was also thinking of using your example then just teleporting to the player location..as you've mentioned and from teleporting stuff in the past doesnt  play well with uneven terrain.  going to give larrows script a good read and see how i get on over the next week.

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

×