Jump to content
Larrow

Eden Composition Spawning

Recommended Posts

Eden Composition Spawning

 
Been working my way through this problem every time i have 5 mins between other stuff.
Looking for testers willing to test out compositions. I have put it through some simple testing and the test mission comes with some examples as player actions.
 

DOWNLOAD


Save a composition in Eden and then in your profiles folder (usually MyDocuments\Arma 3\) in the compositions folder find its composition.sqe. Copy its .sqe and place it in your mission folder in a folder called Compositions and rename it to something remember-able.
Copy the LARs folder to your mission.
Add to your description.ext..

class CfgFunctions {
	#include "LARs\spawnComp\functions\functions.cpp"
};

#include "compositions\compositions.cfg"

Create a file called compositions.cfg in your missions composition folder that you created above and add a class for your composition. e.g

//LARs_spawnComp_debug = 1; //1 = RPT output, 2 = RPT output and ingame visual positioning info

class CfgCompositions {
    class Walk { //Name that the composition is spawned by
        #include "walk.sqe" //Renamed composition.sqe
    };
};

 
Then when you want to spawn a composition..

_compReference = [ COMP_NAME, POS_ATL, OFFSET, DIR, ALIGN_TERRAIN, ALIGN_WATER, IGNORE_ATLOFFSET ] call LARs_fnc_spawnComp;

Where..

  • COMP_NAME - Classname given to composition in CfgCompositions
  • POS_ATL( optional, default compositions saved position ) - Position to spawn composition
    • If not given or empty array passed then original saved composition position is used
    • Also accepts OBJECT, MARKER, LOCATION
  • OFFSET( optional, default none ) - ARRAY [ x, y, z ] ammount to offset composition, as a compositions base pos can vary from what you want when its saved
  • DIR( optional, deafault 0 ) - Direction to face composition in, If POS_ATL is of type OBJECT, MARKER, LOCATION passing TRUE for direction will use objects direction
  • ALIGN_TERRAIN( optional, default True ) - BOOL, Whether composition objects should align themselves to their positions surface normal
  • ALIGN_WATER( optional, default True ) - BOOL, If a composition objects position is over water should they align themselves to sea level
  • IGNORE_ATLOFFSET( optional, default False ) - BOOL, If True each item in the composition will ignore its ATLOffset that usually gets added to its Z(height)

 

!FUCNTIONALITY CHANGED!
The function call will also return a reference string for the composition. Which can be used with some of the provided utility functions.

 

[ _compReference ] call LARs_fnc_deleteComp;

Will delete the composition.

 

[ _compReference ] call LARs_fnc_getCompObjects

Will return an array of all the compositions items.

 

[ _compReference, _item ] call Lars_fnc_getCompItem

Passing an Object will return its composition ID or -1 if not found.
Passing an ID will return the object or objNull if not found.

 

[ _item ] call LARs_fnc_getItemComp

Will return a the reference to the composition the item belongs to or "".

Checking the RPT with LARs_spawnComp_debug = 1 set in the composition.cfg when spawning a composition will display info on the objects spawned. e.g

 

12:29:04 "spawning - Object B_Soldier_A_F - ID: 51, VarName target1"

Where it displays..
Type being Group, Object, Trigger, Logic, Marker or Waypoint
Classname of object ie B_Soldier_A_F
Composition ID 51
For Object, Trigger, Logic it will show its VehcileVarName if it was spawned with one.
For Group it will display the groupID
For Marker its given name
and Waypoints their waypointName ('identified' option in Eden)

 

Priority order of which composition items are spawned in.

Spoiler
  1. "Markers"
  2. "Objects" non unit that are not in deferred objects (see below)
  3. "Triggers" not in deferred triggers (see below)
  4. "Logics"
  5. "Groups" its units and waypoints that are not in deferred groups (see below)
  6. "Deferred Objects"
    1. waypoint that is synced to another waypoint
    2. objects that have a random start position
    3. object that is synced to another object ( only one object is deferred, the one with lowest priority according to this list )
  7. "Deferred Groups" its units and waypoints
    1. groups that have any unit in a vehicle position
    2. groups that have a random start position
  8. "Deferred Triggers"
    1. triggers that are synced to a waypoint
    2. triggers that have a trigger owner
  9. "Init Codes" init codes of everything spawned are run


You may need to get funky with object names, especially markers as they cannot exist twice and things like task names in modules.
Although you can use the utility functions to get a reference to objects and link out side resources yourself as another possible solution.

Again has been put through very limited testing.
As you can see by the examples I have a...
Camp Ant spawning with added foot patrol and a vehicle that executes a waypoint synced to one of the patrols waypoints.
A man that will cycle his route.
A working sector.
A simple task using modules.
A simple mission using modules, a random vehicle spawning at grouped markers with a unit init to moveIn and blowing it up via a trigger when it reaches a waypoint to complete task.
Set up Roadblock, if near a road will spawn a checkpoint aligned with the roads direction.
There are several others that i have written short description for in the CfgCompositions.

Most likely missed loads of stuff 😕 and I know I have not test trigger and waypoint effects.
So if you feel like testing it out and supplying feedback of what is/isnt working(a small example .sqe would be handy for tracking problems down) ... DOWNLOAD as I just do not have the time to test every conceivable permutation myself.
 
Updates:

Spoiler

24/06/2016 - Added unit loadouts saved from VA in Eden  :rolleyes:  oops
26/06/2016 - Fixed rotations : Thank you Persian for the feedback
29/06/2016 - Further improvements to object positions and rotations. Some utility functions.
01/07/2016 - Tried to improve large objects surface up when aliging to uneven terrain. Added new argument for what to do if a position is water.

14/05/2017 - Fixed unit loadout, magazines ammo/count and bad vehicle error.

21/07/2017 - Fixed an error in LARs_fnc_deleteComp. Added support for SimpleObjects, DynamicSimulation and group GarbageCollection. Hopefully have not broken to much 😉 as I have pushed over changes from a current re-factor I'm doing, into the old code for now.

30/10/2018 - All new refactor of code...

  • Some changes to positional calculations
  • Added missing unit attribute for stance
  • Added AI Radar use
  • Added remote sensor attributes
  • Fixed errors from BI enumeration changes
  • Fixed trigger and waypoint effect errors in console
  • Added missing trigger isServer attribute

Previous version can still be found HERE

01/11/2018

    Added new parameter to LARs_fnc_spawnComp to allow ignoring of compositions items ATLOffset to enable spawning of building decors.
    See included example map test_houseFurniture.VR for setup

04/12/2018 - Fixed spawning of modules due to changes in module framework for A3 1.86

26/08/2022 - Fixed spawning of objects with CustomAttributes due to changes in A3 2.10

  • Like 32

Share this post


Link to post
Share on other sites

I could give you a big sloppy kiss!

God, I hope this works. It's near the top of my list of things I wanted to tackle this weekend. Excited to get home and try out your voodoo. Lol.

  • Like 2

Share this post


Link to post
Share on other sites

Darn it larrow, you beat me to it. :p Good to see a working parser though. Will test this out ASAP.

Share this post


Link to post
Share on other sites

24/06/2016 - Added unit loadouts saved from VA in Eden  :rolleyes:  oops

Share this post


Link to post
Share on other sites

when spawn objects/units after saved, things spawning upper then that place i put them so most times things just roll over and mess up .any solution?

Share this post


Link to post
Share on other sites

Hi Persian, Can you explain further? or upload a small example of what is not working for you.

What do you mean by 'after saved'? Like after you save a scenario's progress?

TBH the positioning was the hardest stuff to get correct and it may well have problems although im not seeing any in my test compositions. So if you could explain further or provide an example of what is not working for you it would be appreciated.

Share this post


Link to post
Share on other sites

So i've been toying with random side mission generators over the last while, and i'm fairly bad at scripting - I've managed to get a very basic one working in a test environment but i obviously want to add more details and make teh missions more complicated. Big thanks to all those who help us newbs with scripting. 

 

Just to confirm, is what's being discussed in this thread of help to me? e.g. will i be able to output to a sqf file the entire composition including triggers, task generator etc etc and then paste them into my Mission.sqf file that is called by my mission generator/randomiser script?

 

just clearing things up in my head - cause if so that would be great. Between this and Jshock/Greywolf's discussion in the other thread here i've learned a lot. Also big thanks to Zenophon/Fen's F3 framework/SHK and anyone who's worked on side mission scripts, between them it's helped me plenty

Thanks guys.

 

Gav

  • Like 1

Share this post


Link to post
Share on other sites

I tested more and looks like script is fine with vanilla version.

Before i tried cup islands and rhs and somethings happen like this, most times

Thank you for feedback Persian. Updated download with fixed rotations.

I also notice in your composition that you have placed the units in the air above their positions. There is no need to compensate for this as the script already does this to make sure things are not spawned in the ground.

Share this post


Link to post
Share on other sites

Just to confirm, is what's being discussed in this thread of help to me? e.g. will i be able to output to a sqf file the entire composition including triggers, task generator etc etc and then paste them into my Mission.sqf file that is called by my mission generator/randomiser script?

Yes it could possibly be of help to you once I'm happy that everything is working 100%.

When you save a composition in Eden it is saved in the same format as the new .sqm (mission file).

My script does not output anything for you to add to any of your sqf files. What it does is reads this information from a composition file (.sqe) and spawns all the stuff it contains on the fly.

Think of it as loading a mini mission within your running mission.

Share this post


Link to post
Share on other sites

29/06/2016 - Further improvements to object positions and rotations. Some utility functions.

01/07/2016 - Tried to improve large objects surface up when aligning to uneven terrain. Added new argument for what to do if a position is water.

See OP for details.

Share this post


Link to post
Share on other sites

Looking good brother! I took a look through your code, and its fantastic! There is no way I could have gotten that close. My hats off.

 

Did some small minor testing with my own project, and it seemed to work on 99% of it. Objects only. Did not test things like WPs, etc.

 

The only thing I noticed that didn't quite work was the angles (pitch, bank, yaw) of only a few objects. Some worked and some didn't. Not sure why some would and other didn't line up well.

 

Yeah, I'm pretty blown away actually. You always do amazing work. ;)

Share this post


Link to post
Share on other sites

Thanks Von Quest.

The only thing I noticed that didn't quite work was the angles (pitch, bank, yaw) of only a few objects. Some worked and some didn't. Not sure why some would and other didn't line up well.
Do you mind sharing some of your .sqe's that have bad positions/rotations so i can debug them and see whats going wrong.

Share this post


Link to post
Share on other sites

Here ya go bud - Download.

 

I setup a quick test example. My original project (Tactical Ops Center) is a bazzilion objects and requires other Addons in the Composition, but this test example was still the same result.

 

Take a look. When you start, you are facing due NORTH. What you see is the TEST TEMPLATE. That's what I'm spawning-in to test your LARs System. So you can see what its supposed to look like BEFORE its spawned in.

 

After 10 seconds the Comp Spawns - also North right-in-view (1 meter high) behind the already template sitting there. You can therefore compare in real-time the two templates. The preset original and your spawn function test template.

 

What you'll see is the Template has 4 Marker Boards. Each facing North, East, South, West. Then EACH is Angled up off the BACK LEG so the Board-Part is (near) flat Vertical.

 

When the Comp Spawns in, you can see ONLY the NORTH Board retains its original orientation. If you set your Call DIR to 180 the SAME Board (now South) is still the only one with its correct orientation.

 

I tried both Named and Un-Named Varibles for the Objects with the same result.

Share this post


Link to post
Share on other sites

How can I clean up the composition? Example, task start comp spawned, task completed comp deleted.

 

UPDATE: I do not want to talk about it... :wacko:

 

dub

Share this post


Link to post
Share on other sites

Sooo...this might be a total noob question. But...im spawning a composition off of a trigger using all defualt position settings . It all works ...except literally every vehichle that spawns is immediately destroyed lol.

Im assuming this is an issue with the saved elevation positions...but im not sure. All the buildings seem to be in the right place and even the vehichle wrecks are in the proper looking positions.

Any halp would be much awesome! =]

UPDATE1: Checked last night after changing the spawn hieght in the compisition. Vehicles definitly spawned above ground, about half a foot in the air. Still exploded (then fell)...lol maybe its trying to spawn 2 or it setting health to zero?

UPDATE2: It looks like i was trying to spawn a crewed vehichle which i think was triggering the problem im going to test it further.

LAST UPDATE: seems to be a hard limit on the mount of vehicles you can spawn at once using this method empty or otherwise. I got it working to my taste but its not perfect. Still it saved my project!!!

Share this post


Link to post
Share on other sites

Hey Revdogma,

There may well be problems with positioning, every time I think I've fixed it someone shows me a composition that does not quite work.

Its close but as of yet not quite right, I'm in two minds ATM whether to take down the script until I can work it out.

I have fixed the problem as described by Von Quest but I am currently trying to fix the other half of the positioning calculation for surfaceNormal to degrees, which I believe is where some of the problems lay.

Its definitely not two spawns unless your calling it twice and there where examples of manned vehicle spawns included with the script which never showed any problems so its unlikely to be that either.

I am working on it(tearing hair from my already balding scalp :) ), so keep an eye out for updates to this thread.

Share this post


Link to post
Share on other sites

ahhhhh! just saw your response today! it got second paged and i never realized lol!

I'm so glad you are working on this...and im sure its a nightmare lol! 

I did discover one thing that i dont know if its on my end or if its just because its a fresh script. but in a co op mission i was calling in the compositions with a radio trigger. it was calling the compositions twice. it seemed like it was calling the composition for every person who had access to the radio trigger lol. I would have to test it further if you need any info on my end just let me know.

and thanks for all the work man ! 

Share this post


Link to post
Share on other sites

Please don't abandon this. At the very least upload the newest progress. Being able to spawn just the Objects Compositions is a huge victory. You're one of the very best, and this is a fantastic project.

I'm also hoping and assuming we have permission to use this in our own public mod/mission projects to spawn comps? I wanted to ask officially so it's clear.

Share this post


Link to post
Share on other sites

Very nice sytem Larrow, as allway you are brilliant! Do you have an idea why some objects get totaly missplaced and other objects are just fine?!

Share this post


Link to post
Share on other sites

I did discover one thing that i dont know if its on my end or if its just because its a fresh script. but in a co op mission i was calling in the compositions with a radio trigger. it was calling the compositions twice. it seemed like it was calling the composition for every person who had access to the radio trigger lol. I would have to test it further if you need any info on my end just let me know.

The nature of Radio triggers Revdogma, anyone with access to the trigger when activated will call the function.

 

Please don't abandon this. At the very least upload the newest progress. Being able to spawn just the Objects Compositions is a huge victory. You're one of the very best, and this is a fantastic project.

I'm also hoping and assuming we have permission to use this in our own public mod/mission projects to spawn comps? I wanted to ask officially so it's clear.

Not abandoned Von Quest just busy with other things, several other Arma projects of my own, projects that i help other people with as well as several Unity projects. Time is sparse.

Of course you are welcome to use it however you like, a mention is always welcome. Now wheres the WTFYL(What The F*** You Like) license i saw some one use the other day,made me laugh. 

 

Very nice sytem Larrow, as allway you are brilliant! Do you have an idea why some objects get totaly missplaced and other objects are just fine?!

As explained in some of the above posts its is noted and being worked on.

Thank you all for the nice comments.

  • Like 3

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

×