Jump to content
Lorenz94

Grabbing Waypoints

Recommended Posts

Hello guys,

I'm back with a question a can't answer on my own: how can I collect all waypoints placed in the editor to later spawn them with the rest of the stuff? I managed to grab all objects, but when I spawn the "composition" all the units are still and do absolutely nothing, even with an enemy in front (enableSimulation is not involved in the script), so I need to add waypoints.

 

I'm not asking for a complete script, but for some information to start with! My idea was to grab waypoint type, owner, position, settings etc by running a forEach loop, but how do I detect waypoints? Do they belong to the "Logic" entities?

 

Thank you!!

Share this post


Link to post
Share on other sites
6 hours ago, Lorenz94 said:

but when I spawn the "composition"

As @Harzach says how exactly are you spawning your compositions? (he says quietly hoping the answer isn't LARs_fnc_spawnComp that I know too well is broken and I have never got around to fixing :whistle: )

A composition should by default save any waypoints you have selected.

 

6 hours ago, Lorenz94 said:

but how do I detect waypoints? Do they belong to the "Logic" entities?

Waypoints in Arma are their own data type, type Waypoint. The type is basically an Array of [ Group, Index ]. A waypoint of index 0 is automatically created at the position you place the group in the editor(and at where it spawns during the mission) and is not one of the waypoints you can edit.

You can use...

get3DENSelected "waypoint"

...to retrieve a list of waypoints that you have selected in Eden. You will then need to query Eden attributes to get their settings, using waypoint script commands will not work inside the editor. e.g

get3DENSelected "waypoint" select 0 get3DENAttribute "position"

Would return the position of the first waypoint you have selected in the editor.

 

  • Like 1

Share this post


Link to post
Share on other sites

Not sure to understand...

If you copy/paste a whole area, you will catch waypoints also.

If I'm right, the composition is fine to reproduce a camp or a base, with units... somewhere else. So your waypoints need to be relative, not absolute. Right? The best way to do this remains a script adding waypoints once the composition is spawned. You can even randomize a patrol.

Share this post


Link to post
Share on other sites

Thanks for your replies!

@Harzach I use a custom script I'm currently developing that catches all missionObjects in a particular way, so my output is an array of objects to be created (I get classname, position and direction, and then I use the alternative syntax of createVehicle to spawn objects, example: "B_soldier_F" createVehicle _position;). Simulation is absolutely NOT involved in the process (by means that I don't use enableSimulation command).

 

@Larrow I tried your code a while ago, but since the problems it has, I thought it would be best for me to write something by myself other than trying to fix someone' else work (mostly because you are a lot more experienced than me and I'm not sure of having understood what exactly your script does; anyway, I find this kind of scripts challenging and I really would like to put together something starting from nothing!)

 

@pierremgi You're right, but I haven't explained well the situation, so:

The aim is to "grab" a list of objects in a particular area, then I would like to spawn back this list of objects in a new position (and I already can do this, in a really basic way at the moment, but it works). What I don't know, is how to include in this list all the waypoints, so that all the units can have their WP once spawned back. @Larrow I read about the commands you posted, and here's another question: when I grab a list of objects in the editor I should use those command, right? And then when I need to spawn the list of object I would use "normal" wp commands such as setWPPos?

Thank you for the partecipation!

Share this post


Link to post
Share on other sites
2 hours ago, Lorenz94 said:

And then when I need to spawn the list of object I would use "normal" wp commands such as setWPPos?

Yes use the normal script commands if you are spawning them back in during a running mission.

Share this post


Link to post
Share on other sites

Isn't this the perfect example for the newly added BIS_fnc_3DENExportSQF ? Put this stuff into a new mission, export it all and later import it into the mission whenever and wherever you want to?

  • Like 1

Share this post


Link to post
Share on other sites

@Larrow I tried as you suggested, all fine except for "get3DENAttribute 'type'" that always returns "[<null>]". What am I doing wrong?

@lexx Hi Lexx, thank you for the hint, anyway, I can't find information googling about that function! My idea is to have a bunch of assets and to spawn dynamically them whenever I want and wherever I want, so if the new BIS fnc works like the mod Achilles (that grabs all the stuff, but position is not relative to something), I don't find it useful.

 

Thank you all!

Share this post


Link to post
Share on other sites

Well, it is quite "new". Can't find its first appearance right now, but it does have a relative function since 26th september on the dev-branch.

Added: BIS_fnc_3DENExportSQF now supports exports with positions relative to a given center

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

@lexx I see! Well, that's exactly what I need.. and I think a really big ton of other guys :down:

 

buuuuut............................. no documentationnnnnn

Share this post


Link to post
Share on other sites

At least the export is easy. Scenario -> Export -> Export to SQF. No idea how to load the data, though.

Share this post


Link to post
Share on other sites
6 minutes ago, lexx said:

At least the export is easy. Scenario -> Export -> Export to SQF. No idea how to load the data, though.

Just tried, at a first look, positions are not relative! Positions are exactly the same in the editor!

Share this post


Link to post
Share on other sites
4 hours ago, Lorenz94 said:

all fine except for "get3DENAttribute 'type'" that always returns "[<null>]". What am I doing wrong?

You access an attribute via its property name as per the list I linked in a previous post. So Type is itemClass and Map Visibility is show2D etc.

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

×