JUNKYARD

A junkyard is an area filled with individual pieces of junk that can be destroyed and looted. A junkyard works in a very similar way to an asteroid field, but the key difference is an asteroid field is a global object (world.ics), but a junkyard is saved in local space (Sector_# .ics)

The junkyard assembly file slightly different from a standard assembly file. Each model used in the junkyard has to have its OWN *.asb file. Hereís a copy/paste example:

ASSEMBLY FILE (SINGLE JUNK PIECE)

	txt
	StaticMesh:
	{
		MeshName:	Spg2\Models\Junkyards\Junkyard\1.mdl
		Position:	0	0	0
		Rotation: 	0	0	0
		Scale:		1	1	1
	}
	StaticMesh:
	{
		MeshName:	Spg2\Models\Junkyards\Junkyard\1.mdl
		Position:	0	0	0
		Rotation: 	0	0	0
		Scale:		1	1	1
	}
	StaticMesh:
	{
		MeshName:	Spg2\Models\Junkyards\Junkyard\1.mdl
		Position:	0	0	0
		Rotation: 	0	0	0
		Scale:		1	1	1
	}
	StaticMesh:
	{
		MeshName:	Spg2\Models\Junkyards\Junkyard\1.mdl
		Position:	0	0	0
		Rotation: 	0	0	0
		Scale:		1	1	1
	}
	CollisionMesh:	
	{	
		MeshName:	Spg2\Models\Junkyards\Junkyard\1c.mdl
	}	
	ConvexCollisionMeshes:	
	{	
		MeshName:	Spg2\Models\Junkyards\Junkyard\c1.mdl
	} 
	

Notice the 3 StaticMesh *.mdl files linked. These 4 represent the 4 level of detail models in this order: close, medium range, far, very far. And the last two are of course Collision meshes. The first for shooting, and the second for object-to-object collision.

The best practice is to keep ALL individual StaticMesh models at size of 1 unit. The game and the World Editor handle the scaling.


JUNKYARD FILE (*.jnk)

Itís always good to look at an example, so hereís one:

	Junk:
	{
		ModelName:	Spg2\Models\Junkyards\Junkyard\junk1.asb
	}
	Junk:
	{
		ModelName:	Spg2\Models\Junkyards\Junkyard\junk2.asb
	}
	Junk:
	{
		ModelName:	Spg2\Models\Junkyards\Junkyard\junk3.asb
	}
	...
	

Once you\íve got all your individual junk pieces (*.asb) ready, you can compiles the junkyard file (*.jnk). The *.jnk file contains links to all assembly files (individual junk pieces) the junkyard will use in-game. Simply list all of them and thatís it!

SCRIPT EVENTS

OnDestroySmall Triggered when smaller junk pieces are destroyed
OnDestroyBig Triggered when the larger junk pieces are destroyed

MAP FILE PARAMETERS

	Junkyard:	
	{	
		ModelId:	0
		Position:	27006.95	0.00	66105.45
		NamePosition:	0.00	0.00	0.00
		Rotation:	0.00	0.00	0.00
		KeyName:	jnk22
		Name:	Junkyard
		Small:	500	3.00	10.00
		Midium:	400	10.00	20.00
		Big:	150	40.00	50.00
		Blobs:	10
		-306.27	7.72	56.44	1000.00
		FoundCommodities:	56
		46	0	0.0
		Junk:	1050
		...
		Events:	
		{	
			OnDestroySmall:	Spg2\Scripts\JunkyardOnDestroy01.sal
			OnDestroyBig:	Spg2\Scripts\JunkyardOnDestroy01.sal
		}	
	}
	
ModelId Specific junkyard file ([ Base\EditorJunkyards.wdt ]) used by this object type instance
Position Object global position. Positions of blobs and individual junk pieces are then saved as offsets to this central position, making it possible to move an entire junkyard around.
NamePosition XYZ coordinates to place the junkyard name on the Starchart in-game. Y axis is ignored, so you can leave it at 0.00
Rotation DEPRECATED
KeyName Object keyname used for accessing via scripts
Name Specific name of this object instance
Small Minimum and maximum size, and number of small junk pieces
Midium Minimum and maximum size, and number of medium-size junk pieces
Big Minimum and maximum size, and number of large junk pieces
Blobs Junkyards are placed on the map as blobs (spheres) inside which the individual junk pieces are generated. Set these via the World Editor!
FoundCommodities A list of all commodities that can be dropped as loot when destroying junk. The series of parameters below this line is compiled in this form: CommodityId | Quantity | ChanceToDrop. Set these via the World Editor!
Junk Position of each generated junk piece is saved in this series of parameters. Generate junkyards via the World Editor!
Events { } Set of events with linked scripts