Jump to content
Dramacius

Create Object, AttachTo Player and Allow Player to manipulate and place object

Recommended Posts

Please see posts further down for details

Spoiler

[west, -1, 
		[["Land_BagFence_Corner_F", 1, "Sandbag"], 
		["Land_BagFence_End_F", 1, "Sandbag"], 
		["Land_BagFence_Long_F", 1, "Sandbag"], 
		["Land_BagFence_Round_F", 1, "Sandbag"], 
		["Land_BagFence_Short_F", 1, "Sandbag"], 
		["Land_SandbagBarricade_01_half_F", 1, "Sandbag"], 
		["Land_SandbagBarricade_01_F", 1, "Sandbag"], 
		["Land_SandbagBarricade_01_hole_F", 1, "Sandbag"], 
		["Land_BagFence_01_corner_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_end_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_long_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_round_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_short_green_F", 1, "Sandbag"],
		["Land_BagFence_Corner_F", 1, "Sandbag"], 
		["Land_BagFence_End_F", 1, "Sandbag"], 
		["Land_BagFence_Long_F", 1, "Sandbag"], 
		["Land_BagFence_Round_F", 1, "Sandbag"], 
		["Land_BagFence_Short_F", 1, "Sandbag"], 
		["Land_SandbagBarricade_01_half_F", 1, "Sandbag"], 
		["Land_SandbagBarricade_01_F", 1, "Sandbag"], 
		["Land_SandbagBarricade_01_hole_F", 1, "Sandbag"], 
		["Land_BagFence_01_corner_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_end_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_long_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_round_green_F", 1, "Sandbag"], 
		["Land_BagFence_01_short_green_F", 1, "Sandbag"],
		["EFM_coverage_plywood_2_7m_fortified_A", 1, "Wood"], 
		["EFM_coverage_plywood_2m_fortified_A", 1, "Wood"], 
		["EFM_beam_wood_h_1_5m", 1, "Wood"], 
		["EFM_beam_wood_h_1_5m_railing", 1, "Wood"], 
		["EFM_beam_wood_h_1m", 1, "Wood"], 
		["EFM_beam_wood_h_1m_railing", 1, "Wood"], 
		["EFM_beam_wood_h_2m", 1, "Wood"], 
		["EFM_beam_wood_h_2m_railing", 1, "Wood"], 
		["EFM_beam_wood_h_3m", 1, "Wood"], 
		["EFM_beam_wood_h_3m_railing", 1, "Wood"], 
		["EFM_beam_wood_h_4m", 1, "Wood"], 
		["EFM_beam_wood_h_4m_railing", 1, "Wood"], 
		["EFM_beam_wood_v_0_5m", 1, "Wood"], 
		["EFM_beam_wood_v_1_5m", 1, "Wood"], 
		["beam_wood_v_2_75m", 1, "Wood"], 
		["EFM_beam_wood_v_2m", 1, "Wood"], 
		["EFM_beam_wood_angular_bearer_01", 1, "Wood"], 
		["EFM_rack_wood_big_new", 1, "Wood"], 
		["EFM_stair_wood_1_7m", 1, "Wood"], 
		["EFM_stair_wood_1m", 1, "Wood"], 
		["EFM_stair_wood_2_7m", 1, "Wood"], 
		["EFM_stair_wood_3_5m", 1, "Wood"], 
		["EFM_wood_wall_2m_single_filled", 1, "Wood"], 
		["EFM_wood_wall_2m_half_beam_single", 1, "Wood"], 
		["EFM_wood_wall_2m_half_beam_single_c_blufor", 1, "Wood"], 
		["EFM_wood_wall_2m_half_beam_single_c_opfor", 1, "Wood"], 
		["EFM_wood_wall_2m_half_beam_single_filled", 1, "Wood"], 
		["EFM_wood_wall_2m_half_beam_single_filled_c_blufor", 1, "Wood"], 
		["EFM_wood_wall_2m_half_beam_single_filled_c_opfor", 1, "Wood"], 
		["EFM_wood_wall_2m_half_single", 1, "Wood"], 
		["EFM_wood_wall_2m_half_single_filled", 1, "Wood"], 
		["EFM_wood_wall_2m_support", 1, "Wood"], 
		["EFM_wood_wall_2m_single", 1, "Wood"],
		["Land_BagBunker_01_large_green_F", 1, "H-Barrier"], 
		["Land_BagBunker_01_small_green_F", 1, "H-Barrier"], 
		["UK3CB_Nest_Jun", 1, "H-Barrier"], 
		["Land_BagBunker_Large_F", 1, "H-Barrier"], 
		["UK3CB_Nest", 1, "H-Barrier"], 
		["Land_BagBunker_Small_F", 1, "H-Barrier"]]


] call ace_fortify_fnc_registerObjects; 
 
acex_fortify_locations pushBack [_this, 50, 50, 0, false];

 



My understanding clearly wrong, was that using the 3rd optional value in the array would catagorise the list but it doesn't seem to have done that.
 

Quote

* Classnames must be in the format [<classname>, <cost>, <category(optional)>]

 

Share this post


Link to post
Share on other sites

That "category" parameter defines what you select in the Fortify module (default categories are small, small green, medium, medium green, etc...). This just allows you to add your own category there, so you can enable only the objects you want, or add new ones in a controlled manner.

 

Not sure if it's possible to split the ACE menu tree for this without rewriting the framework. Worth an ask on the ACE Discord:  https://acemod.org/discord

 

It would be a nice feature!

  • Like 1

Share this post


Link to post
Share on other sites

An alternative would be if I could call the fortify items from a dialog like R3F Logistics does, only problem with their script is the limitations on customisation.

Share this post


Link to post
Share on other sites

I dont know the code to be able to create any of the eden fortification objects attached to a player, allow the player to move around (forced walk) rotate the object horizontally and vertically raise up and down and move further away or bring closer in and then place in final position and orientation.

This is basically how the R3F Logistics system works but that does a lot of other things that we don't want and is limited in customisability.

I want a dialog that has a list of items on one side an image of the item on the other and a button to "create" the item which will then create the item as described above.

I think I need to use the attachTo command

ie

_object = createVehicle ["Land_BagFence_Round_F",(_this select 1) attachTO [player], [], 0, "CAN_COLLIDE"];

how would I then enable the player to manipulate and place the item?
I am thinking the following will be useful to help with manipulating the object whilst its attachedto Player

findDisplay 46 displayAddEventHandler ["KeyUp", {}];


another goal would be to be able to pick the item up and reposition it after it had initially been placed

I think I am starting to figure out a script idea in my head. its very rough and I don't know if it will work though.

 

_object = createVehicle ["Land_BagFence_Round_F",(_this select 1) attachTO [player], [], 0, "CAN_COLLIDE"];

findDisplay 46 displayAddEventHandler ["KeyUp", {_object setVectorDirAndUp [0,1,0], [0,0,0]}];  // Moves object away by 1m? how do I set a specific key?

 

Share this post


Link to post
Share on other sites

So, I've created a sandbag wall, attached it to player and figured out how to set it to detach from player. I can't figure out how to manipulate it's vertical or rotational position though which I would like. Ideally I would have liked to be able to attach the object to where the character is looking but can't find how to do that.

Share this post


Link to post
Share on other sites

Hey,

 

you can do something like this:

 

key_rotate = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 16) then {
	spawn_veh setDir ((direction spawn_veh) + 10);
}"];

This is part from a code I use to spawn vehicles. In this case "16" stands for the key Q but it should give you a general idea how to do this.
See https://community.bistudio.com/wiki/DIK_KeyCodes if you want to change the key.

  • Like 2

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

×