Jump to content
Sign in to follow this  
TheTranscendentOne

[Help] Using an editor to place, then converting editor data to script.

Recommended Posts

Hello everyone.

For large progressive missions that take you from one city, to the next, then to the next etc. We use scripts, that dynamically create content when and where we need it. One way to do this is, to use the 2D in-game editor to place/rotate/preview, then use the co-ordinates/rotation from the finalised position from the editor in our script, delete editor placed object references and preview again, to see whether the script has placed it in the correct position.

The above method does work but it's the most long-drawn-tedious-workflow I've ever tried to follow. It just doesn't seem viable to create sprawling progressive missions like I&A, Domination, Revolution etc. Like this.

I have a feeling that there's a way of creating, for example: A fortified position - entirely in an editor, saving as a .sqf and using that automatically generated code in our scripts.

I've check the composition of the .sqm file, all the data is there, it's just not in-syntax of a .sqf. Meaning we'd have to do substantial editing to convert the data.

I've tried to use the 3D editor, which seems almost non-existent but cannot place units, because I can't select a group. I have a feeling I'm not giving it the correct launch parameters and the 3D editor isn't pulling all the standard Arma 3 classnames etc.

I haven't looked into MCC Sandbox, maybe this could be a solution?

Any help, would be greatly appreciated, thank you.

Share this post


Link to post
Share on other sites

For my soon-to-be-released Anvil Editor I've built an SQM parser in C# which can read in an SQM file and query it. This could be used to write out SQF from an SQM object pretty easily. Being able to do this would also fit in nicely for some features I have secretly started working on for the next version (4.x) of the editor. :D

What is an example of the type of conversion you want? E.g. can you post the code for a single SQM object and what SQF code you would want generated?

Share this post


Link to post
Share on other sites

Take a look at BIS_fnc_objectgrabber / BIS_fnc_objectmapper in the functions, should do just what you want.

Share this post


Link to post
Share on other sites

Did you create groups first in the 3d editor, or what do you mean that you cannot select them?

You have to create them separately first from a menu different from creating units, like in scripts but unlike the 2d editor.

Edit: I do think it's the best option for static objects, at least, because the mission.sqf it creates works fine when you strip the object creation part into a separate script.

Edited by Magirot

Share this post


Link to post
Share on other sites
For my soon-to-be-released Anvil Editor I've built an SQM parser in C# which can read in an SQM file and query it. This could be used to write out SQF from an SQM object pretty easily. Being able to do this would also fit in nicely for some features I have secretly started working on for the next version (4.x) of the editor. :D

What is an example of the type of conversion you want? E.g. can you post the code for a single SQM object and what SQF code you would want generated?

Wow, Anvil looks like a really neat tool. I'd love to try it out.

A sample of how the .sqm is structured:

version=12;
class Mission
{
~REMOVED CODE~
class Groups
{
	items=1;
	class Item0
	{
		side="WEST";
		class Vehicles
		{
			items=1;
			class Item0
			{
				position[]={8538.8096,113.26131,25034.291};
				azimut=-103.64236;
				id=0;
				side="WEST";
				vehicle="B_Soldier_F";
				player="PLAYER COMMANDER";
				leader=1;
				skill=0.60000002;
			};
		};
	};
};
class Vehicles
{
	items=5;
	class Item0
	{
		position[]={8533.3232,113.72943,25033.018};
		azimut=119.90101;
		id=1;
		side="EMPTY";
		vehicle="Land_BagFence_Round_F";
		skill=0.60000002;
	};
       ~REMOVED CODE~
};
~REMOVED CODE~
};

After reading what Magirot wrote, I decided to try the 3D editor again. Within it, I made a more accurate representation of a mortar fortification than I did with 2D, saved it (it saved as a .sqf file sweet!) and here is a comparison slice of what it spat out.

~CODE REMOVED~

_this = createCenter west;
_center_0 = _this;

_group_0 = createGroup _center_0;

_unit_2 = objNull;
if (true) then
{
_this = _group_0 createUnit ["B_Story_SF_Captain_F", [8535.3389, 25032.992], [], 0, "CAN_COLLIDE"];
_unit_2 = _this;
_this setPos [8535.3389, 25032.992];
_this setDir -111.39275;
_this setUnitAbility 0.60000002;
if (true) then {_group_0 selectLeader _this;};
if (true) then {selectPlayer _this;};
};

_vehicle_1 = objNull;
if (true) then
{
_this = createVehicle ["Land_BagFence_Round_F", [8534.3516, 25032.689, -0.47926819], [], 0, "CAN_COLLIDE"];
_vehicle_1 = _this;
_this setDir -250.80614;
_this setPos [8534.3516, 25032.689, -0.47926819];
};
~REMOVED CODE~

Even this .sqf code doesn't seem ideal, I want unique global variables for every object that gets placed, so I can track, manipulate, delete when tasks complete etc. I'm definitely asking too much of the editor here I know, there needs to be some work left for me. The main thing I wanted was to place things almost perfectly in 3D, then use the co-ordinates/direction in my script. It seems like that has been accomplished.

Take a look at BIS_fnc_objectgrabber / BIS_fnc_objectmapper in the functions, should do just what you want.

I don't see either of those two functions listed in Arma 2 fuctions or Arma 3 functions. A Google search gets no hits too. Where is the documentation for those you speak of?

Did you create groups first in the 3d editor, or what do you mean that you cannot select them?

You have to create them separately first from a menu different from creating units, like in scripts but unlike the 2d editor.

Edit: I do think it's the best option for static objects, at least, because the mission.sqf it creates works fine when you strip the object creation part into a separate script.

Thank's Magirot, yeah I hadn't created a Center for West, then Group of West before I tried to place a unit. One limitation I've found so far is, for small items like headgear and below, once placed you cannot select them on the ground to move them up the Z axis. Only leave them on the floor, delete from 2D or keep and adjust height later in script. I wonder if you've figured out an easier a workaround for that?

Share this post


Link to post
Share on other sites

I don't see either of those two functions listed in Arma 2 fuctions or Arma 3 functions. A Google search gets no hits too. Where is the documentation for those you speak of?

The wiki only holds a fraction of all built in functions for arma 3.

When you're in the editor hit CTRL+F.

Lots of good stuff there.

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  

×