VoidExpanse/scope-generator: Difference between revisions
No edit summary |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 49: | Line 49: | ||
only to those, which have it, such as ships, space stations, containers. | only to those, which have it, such as ships, space stations, containers. | ||
}} | }} | ||
{{Scripting_api|AddItemToSpecifiedContainer| | |||
* int: container_id | |||
* string: item_xml_id | |||
* int: quantity | | |||
object: | |||
* quantity - quantity was actually added | |||
* type - can be "item" or "resource"| | |||
<pre style="margin:0px;">var obj = generator.AddItemToSpecifiedContainer(1525, "SomeItem", 5);</pre> | | |||
Important notice: container_id - is a special, unique in-game identifier for containers, which cannot be obtained by any way through API. Container id can only be obtained as a function parameter in events. | |||
Currently used in OnInstancedContainerGeneration event. | |||
}} | |||
{{Scripting_api|GenerateItemsWithItemlist| | |||
* int: item_list_xml_id| | |||
array of objects: | |||
* quantity - quantity was actually added | |||
* id - xml-id of item| | |||
<pre style="margin:0px;">var items = generator.GenerateItemsWithItemlist(1, "SomeItem", 5); | |||
for(var i = 0; i < items.length; i++) | |||
{ | |||
generator.AddItemToSpecifiedContainer( | |||
args.container_id, | |||
items[i].id, | |||
items[i].quantity ); | |||
}</pre> | | |||
Generates set of items with itemlist. After generation, items can be added to any container. | |||
}} | |||
{{Scripting_api|AddContainer| | {{Scripting_api|AddContainer| | ||
Line 152: | Line 183: | ||
}} | }} | ||
{{Scripting_api| | {{Scripting_api|AddLever| | ||
* int: system_id | * int: system_id | ||
* double: coord_x | * double: coord_x | ||
* double: coord_y | * double: coord_y | ||
* string: xml_type_id | * string: xml_type_id | ||
* int: visible_to | |||
* object: tags | | * object: tags | | ||
int: ID of created object| | int: ID of created object| | ||
<pre style="margin:0px;">var id = generator. | <pre style="margin:0px;">var id = generator.AddLever(1, 0, 0, "Debris01", 0, {class: "mine"})</pre> | | ||
Adds a | Adds a lever object to world. Lever - is a special object, which can be activated. Parameter "visible_to" specifies, to whom lever is visible. If 0, it's visible to all, else - only to specified ship. Useful when you need to create a special object only to a man, who took the quest. | ||
}} | |||
{{Scripting_api|AddStar| | |||
* int: system_id | |||
* double: coord_x | |||
* double: coord_y | |||
* int: seed | |||
* int: heat - how much damage star deals, when ship approaches | |||
* ''(optional) string: typeID'' | |||
| | |||
int: ID of created object| | |||
<pre style="margin:0px;">var id = generator.AddStar(1, 0, 0, 234, 0)</pre> | | |||
Adds a star. Conventionally, you shouldn't add more then 1 star to a system. | |||
If typeID is not specified, type will be picked by random, based on seed parameter. | |||
}} | |||
{{Scripting_api|AddSystem| | |||
* double: coord_x | |||
* double: coord_y | |||
* string: name | |||
* int: seed| | |||
int: ID of created system| | |||
<pre style="margin:0px;">var id = generator.AddSystem(0, 0, "Hawkins Eta", 123)</pre> | | |||
Adds a star system. Star system can be added anywhere, and by default it won't be connected to any other systems. See tutorial to see, how systems generation works. | |||
}} | |||
{{Scripting_api|SetSystemTags| | |||
* int: system_id | |||
* object: tags| | |||
void| | |||
<pre style="margin:0px;">generator.SetSystemTags(1, {"show_clouds": "yes"})</pre> | | |||
Sets tags of specified star system. Can be expanded with generator.AddSystemTag and retrieved by | |||
generator.GetSystemTags. | |||
}} | |||
{{Scripting_api|AddSystemTag| | |||
* int: system_id | |||
* string: name | |||
* object: value| | |||
void| | |||
<pre style="margin:0px;">generator.AddSystemTag(1, "show_clouds", "yes")</pre> | | |||
Adds tag to star system tags (or overwrites existing one with the same name). | |||
}} | |||
{{Scripting_api|GetSystemTags| | |||
* int: system_id| | |||
object: tags set by methods above| | |||
<pre style="margin:0px;">var tags = generator.GetSystemTags(1); | |||
if(tags != null && tags["show_clouds"] == "yes") | |||
{ | |||
console.Print("System 1 was told to show clouds"); | |||
}</pre> | | |||
Retrieves tags of star system, which were set by SetSystemTags and AddSystemTag. | |||
}} | |||
{{Scripting_api|AddAnomaly| | |||
* int: system_id | |||
* string: anomaly_id | |||
* object: args | | |||
void| | |||
<pre style="margin:0px;">generator.AddAnomaly(args.sys_id, "radar_disable", {});</pre> | | |||
Adds anomaly to star system. There are few predefined anomalies (see more in the article [[VoidExpanse/anomalies|Anomalies]]), but you can specify and implement your own anomalies. | |||
}} | |||
{{Scripting_api|SystemClose| | |||
* int: system_id| | |||
void| | |||
<pre style="margin:0px;">generator.SystemClose(20);</pre> | | |||
Sets system status to closed. Can be used anywhere, has no hardcoded implementation. For example, now | |||
it's being used to prevent player to travel to alien systems. System can be opened with generator.SystemOpen. | |||
All systems are opened by default. | |||
}} | |||
{{Scripting_api|SystemOpen| | |||
* int: system_id| | |||
void| | |||
<pre style="margin:0px;">generator.SystemOpen(20);</pre> | | |||
Sets system status to opened. Can be used anywhere, has no hardcoded implementation. For example, now | |||
it's being used to prevent player to travel to alien systems. System can be closed with generator.SystemClose. | |||
All systems are opened by default. | |||
}} | |||
{{Scripting_api|IsSystemClosed| | |||
* int: system_id| | |||
bool| | |||
<pre style="margin:0px;">var closed = generator.IsSystemClosed(20);</pre> | | |||
Check whether system is closed or not. | |||
}} | |||
{{Scripting_api|CountNpcInSystemByTags| | |||
* int: system_id | |||
* object: tags| | |||
int| | |||
<pre style="margin:0px;">var numOfPirates= generator.CountNpcInSystemByTags(20, {class: "pirate"});</pre> | | |||
Counts npcs with specified tags in specified system. | |||
}} | |||
{{Scripting_api|ClearDropList| | |||
* int: ship_id| | |||
void| | |||
<pre style="margin:0px;">generator.ClearDropList(20025);</pre> | | |||
Clears droplist of a specified NPC. | |||
}} | |||
{{Scripting_api|SetSystemPlaylists| | |||
* int: system_id | |||
* object: key->value object| | |||
void| | |||
<pre style="margin:0px;">generator.SetSystemPlaylists(args.sys_id, | |||
{ | |||
"explore": "playlist_generic_explore", | |||
"combat": "playlist_generic_combat" | |||
} | |||
);</pre> | | |||
Sets system music playlists. There are few possible keys, see more in [[VoidExpanse/MusicPlaylists|MusicPlaylists]]. | |||
}} | |||
{{Scripting_api|AddSystemsLink| | |||
* int: system_id | |||
* int: system_2_id| | |||
void| | |||
<pre style="margin:0px;">generator.AddSystemsLink(1,2);</pre> | | |||
This function creates a link between two systems. This links are simply logical, but there are | |||
few hardcoded rules about them. There are some specific rules, that are applied to every link: | |||
* Duplication - cannot create a link between already linked systems | |||
* Future Linking - cannot create a link between systems, that aren't exist yet | |||
* Proximity - link cannot pass closer then 2 units to a star | |||
* Intersections - link cannot intersect any other link | |||
Links created this way are displayed on galaxy map. By this links jumpgates are created (though, there is no hard rule about that - you can create jumpgate without link between two star systems, but this connection won't be displayed on galaxy map). | |||
}} | |||
{{Scripting_api|FixConnectivity| | |||
void| | |||
void| | |||
<pre style="margin:0px;">generator.FixConnectivity();</pre> | | |||
Should be called after all stars and links were created. It checks, if all stars are reachable from one another, and, if not, it creates missing star systems links. | |||
}} | |||
{{Scripting_api|DockShipToBase| | |||
* int: ship_id | |||
* int: base_id| | |||
void| | |||
<pre style="margin:0px;">generator.DockShipToBase(12253,2);</pre> | | |||
Immediately, without any animations, checkups and routines, docks ship to a space station. It's better not to use it on players, because it'll have unpredictable behavior. | |||
}} | |||
{{Scripting_api|ExpandArea| | |||
* array: array of stars IDs | | |||
void| | |||
<pre style="margin:0px;">var stars = [3]; | |||
while(true) | |||
{ | |||
stars = generator.ExpandArea(stars); | |||
if(newstars.length >= 10) break; | |||
} | |||
console.Print("Now we have an area of 10 or more stars around star with id 3"); | |||
</pre> | | |||
Function, which returns the same array, as input + all stars, which are linked to input ones by 1 link. In other words, it returns an area, expanded by 1 link. Very useful during generation of zones in galaxy, such as faction territories. | |||
}} | |||
{{Scripting_api|GetAllSystems| | |||
void| | |||
array: IDs of all systems| | |||
<pre style="margin:0px;">var arr = generator.GetAllSystems();</pre> | | |||
}} | |||
{{Scripting_api|GetAsteroidTypes| | |||
void| | |||
array: xml_ids (strings) of all asteroids| | |||
<pre style="margin:0px;">var arr = generator.GetAsteroidTypes();</pre> | | |||
}} | |||
{{Scripting_api|GetClosestSystemToPoint| | |||
* double: coord_x | |||
* double: coord_y| | |||
int: ID of picked system of 0, if none| | |||
<pre style="margin:0px;">var sys_id = generator.GetClosestSystemToPoint(0,0);</pre> | | |||
Useful during generation process. | |||
}} | |||
{{Scripting_api|GetDebrisTypes| | |||
void| | |||
array: xml_ids (strings) of all space objects| | |||
<pre style="margin:0px;">var arr = generator.GetDebrisTypes();</pre> | | |||
Useful during generation process. Alias of generator.GetSpaceObjectsTypes. | |||
}} | |||
{{Scripting_api|GetSpaceObjectsTypes| | |||
void| | |||
array: xml_ids (strings) of all space objects| | |||
<pre style="margin:0px;">var arr = generator.GetSpaceObjectsTypes();</pre> | | |||
Useful during generation process. The same as generator.GetDebrisTypes. | |||
}} | |||
{{Scripting_api|GetIntersection| | |||
* int: system_id | |||
* double: coord_x | |||
* double: coord_y | | |||
string: intersection in format "coord_x;coord_y" or empty string| | |||
<pre style="margin:0px;">var intersection = generator.GetIntersection(0, 15, 15); | |||
if(intersection.length > 0) | |||
{ | |||
var arr = intersection.split(';'); | |||
console.Print("Intersection was found: point X:" + arr[0] +", Y:" + arr[1]); | |||
}</pre> | | |||
The function answers the question: if a put a link between system with specified id and point with | |||
coordinates coord_x;coord_y, will it intersect any other links? Useful during galaxy generation process. | |||
}} | |||
{{Scripting_api|GetJumpsBetweenSystems| | |||
* int: system_id | |||
* int: system_2_id| | |||
int: number of jumps| | |||
<pre style="margin:0px;">var jumps = generator.GetJumpsBetweenSystems(1,1000);</pre> | | |||
Returns length (number of links) of the minimal way between two systems. | |||
}} | |||
{{Scripting_api|GetLinkedSystems| | |||
* int: sys_id| | |||
array: IDs of systems| | |||
<pre style="margin:0px;">var arr = generator.GetLinkedSystems(1);</pre> | | |||
Returns an array with IDs of all systems linked to the specified one. | |||
}} | |||
{{Scripting_api|GetRoute| | |||
* int: sys_id_from | |||
* int: sys_id_to| | |||
array: IDs of systems| | |||
<pre style="margin:0px;">var route = generator.GetRoute(1,5);</pre> | | |||
Returns an array with IDs of all systems, which makes the shortes route between two points. | |||
}} | |||
{{Scripting_api|GetItemPrice| | |||
* string: item| | |||
int: price| | |||
<pre style="margin:0px;">var price = generator.GetItemPrice("object_alien_relic_01");</pre> | | |||
Returns a price of item by it's xml id. | |||
}} | |||
{{Scripting_api|GetItemTitle| | |||
* string: item| | |||
string: title| | |||
<pre style="margin:0px;">var title = generator.GetItemTitle("object_alien_relic_01");</pre> | | |||
Returns a name of item by it's xml id. | |||
}} | |||
{{Scripting_api|GetMinDistanceToSystem| | |||
* double: coord_x | |||
* double: coord_y| | |||
double: distance to the closest system (or maximum double value if none)| | |||
<pre style="margin:0px;">var dist = generator.GetLinkedSystems(1);</pre> | | |||
Return distance to the closest system to a specified point. | |||
}} | |||
{{Scripting_api|GetNumberOfLinks| | |||
* int: system_id| | |||
int: number of links to specified system| | |||
<pre style="margin:0px;">var links = generator.GetNumberOfLinks(1);</pre> | | |||
}} | |||
{{Scripting_api|GetPlanetCoordinates| | |||
* int: planet_id| | |||
vector2: coordinates of a planet| | |||
<pre style="margin:0px;">var coords = generator.GetPlanetCoordinates(242); | |||
console.Print("Planet coordinates: X:" + coords.x + ", Y:" + coords.y);</pre> | | |||
Returns coordinates of specified planet. | |||
}} | |||
{{Scripting_api|GetRandomPlanetInSystem| | |||
* int: system_id| | |||
int: ID of a planet| | |||
<pre style="margin:0px;">var id = generator.GetRandomPlanetInSystem(1);</pre> | | |||
Returns ID of random planet in system (or 0 if there are no planets). | |||
}} | |||
{{Scripting_api|GetSystemPlanets| | |||
* int: system_id| | |||
array: IDs of planets| | |||
<pre style="margin:0px;">var arr = generator.GetSystemPlanets(1);</pre> | | |||
Returns an array with IDs of all planets in system. | |||
}} | |||
{{Scripting_api|GetSystemByID| | |||
* int: system_id| | |||
object: | |||
* double: coord_x | |||
* double: coord_y | |||
* int: seed | |||
* string: faction | |||
* int: danger_level | |||
* int: tech_level | |||
* string: name| | |||
<pre style="margin:0px;">var obj = generator.GetSystemByID(1);</pre> | | |||
Returns basic info about specified system. Tags of star system can be gained with generator.GetSystemTags. | |||
}} | |||
{{Scripting_api|GetBaseByID| | |||
* int: base_id| | |||
object: | |||
* string: faction | |||
* int: tech_level | |||
* string: name | |||
* double: coord_x | |||
* double: coord_y| | |||
<pre style="margin:0px;">var obj = generator.GetBaseByID(1);</pre> | | |||
Returns space station basic description. Tags cannot be retrieved with this function - use game.GetTags instead. | |||
}} | |||
{{Scripting_api|GetSystemsByDistanceTo| | |||
* int: system_id| | |||
array: IDs of systems| | |||
<pre style="margin:0px;">var arr = generator.GetSystemsByDistanceTo(1);</pre> | | |||
Returns an array with IDs of systems, which are sorted by distance to specified system. Specified system is included into resulting array. | |||
}} | |||
{{Scripting_api|GetPopulatedSystems| | |||
void| | |||
array: IDs of systems| | |||
<pre style="margin:0px;">var arr = generator.GetPopulatedSystems();</pre> | | |||
Returns an array with IDs of systems in which there are currently players. | |||
}} | |||
{{Scripting_api|GetAllResources| | |||
void| | |||
array: xml_ids (strings) of resources| | |||
<pre style="margin:0px;">var arr = generator.GetAllResources();</pre> | | |||
Returns an array of all resources of VoidExpanse. | |||
}} | |||
{{Scripting_api|GetResourcesWithFlags| | |||
* array of strings: flags| | |||
array: xml_ids (strings) of resources| | |||
<pre style="margin:0px;">var arr = generator.GetResourcesWithFlags(["mineable", "highlevel"]);</pre> | | |||
Returns an array of resources of VoidExpanse, contains all specified flags in it's XML description. | |||
}} | |||
{{Scripting_api|GetResourceByID| | |||
* string: xml_id| | |||
object: | |||
* double: price - standard price of this item | |||
* int: shops_level - level of shops in which this resource should be sold | |||
* string: name - name of resource | |||
* string: id - xml id of resource| | |||
<pre style="margin:0px;">var obj = generator.GetResourceByID("Resource01");</pre> | | |||
Returns a description of a resource by it's xml_id. | |||
}} | |||
{{Scripting_api|GetItemByXmlID| | |||
* string: xml_id| | |||
object: | |||
* double: price - standard price of this item | |||
* int: shops_level - level of shops in which this resource should be sold | |||
* string: name - name of resource | |||
* string: id - xml id of resource| | |||
<pre style="margin:0px;">var obj = generator.GetItemByXmlID("Item01");</pre> | | |||
Returns a description of an item by it's xml_id. | |||
}} | |||
{{Scripting_api|RemoveAsteroid| | |||
* int: asteroid_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveAsteroid(123);</pre> | | |||
Removes asteroid from a game world. | |||
}} | |||
{{Scripting_api|RemoveBase| | |||
* int: base_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveBase(123);</pre> | | |||
Removes base (space station) from a game world. | |||
}} | |||
{{Scripting_api|RemoveDecoration| | |||
* int: decoration_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveDecoration(123);</pre> | | |||
Removes decoration from a game world. | |||
}} | |||
{{Scripting_api|RemoveJumpgate| | |||
* int: jumpgate_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveJumpgate(123);</pre> | | |||
Removes a jumpgate from a game world. | |||
}} | |||
{{Scripting_api|RemovePlanet| | |||
* int: planet_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemovePlanet(123);</pre> | | |||
Removes a planet from a game world. | |||
}} | |||
{{Scripting_api|RemoveSpaceObject| | |||
* int: space_object_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveSpaceObject(123);</pre> | | |||
Removes a space object from a game world. | |||
}} | |||
{{Scripting_api|RemoveLever| | |||
* int: lever_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveLever(123);</pre> | | |||
Removes specified lever from a game world. | |||
}} | |||
{{Scripting_api|RemoveStar| | |||
* int: star_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveStar(123);</pre> | | |||
Removes a star from a game world. | |||
}} | |||
{{Scripting_api|RemoveSystemsLink| | |||
* int: system_id | |||
* int: system_2_id| | |||
void| | |||
<pre style="margin:0px;">generator.RemoveSystemsLink(1,2);</pre> | | |||
Removes a link between two systems. | |||
}} | |||
{{Scripting_api|ReportLoadingPhase| | |||
* string: phase| | |||
void| | |||
<pre style="margin:0px;">generator.ReportLoadingPhase("Loading galaxy");</pre> | | |||
Adds message to singleplayer client with loader (then to alter loader use generator.ReportLoadingProgress). | |||
}} | |||
{{Scripting_api|ReportLoadingPhaseNoLoader| | |||
* string: phase| | |||
void| | |||
<pre style="margin:0px;">generator.ReportLoadingPhaseNoLoader("Loading galaxy");</pre> | | |||
Adds message to singleplayer client. | |||
}} | |||
{{Scripting_api|ReportLoadingProgress| | |||
* double: percent - a value from 0 to 1| | |||
void| | |||
<pre style="margin:0px;">generator.ReportLoadingProgress(0.5);</pre> | | |||
Adds message to singleplayer client. | |||
}} | |||
{{Scripting_api|SetNPCAvatar| | |||
* int: npc_ship_id | |||
* object: avatar parameters| | |||
void| | |||
<pre style="margin:0px;">generator.SetNPCAvatar(12553, [1,2,3,4,5,6]);</pre> | | |||
Sets npc avatar. | |||
}} | |||
{{Scripting_api|SetNPCAvatarImg| | |||
* int: npc_ship_id | |||
* string: path_to_image| | |||
void| | |||
<pre style="margin:0px;">generator.SetNPCAvatarImg(id, "avatars/unique/terminal_01.png");</pre> | | |||
Sets npc avatar image instead of standart avatar system. | |||
}} | |||
{{Scripting_api|SetSystemDangerLevel| | |||
* int: system_id | |||
* int: danger_level - from 0 to 100| | |||
void| | |||
<pre style="margin:0px;">generator.SetSystemDangerLevel(1, 99);</pre> | | |||
Set star system danger level. Danger level usually affects a level of system's npc and many other parameters. | |||
}} | |||
{{Scripting_api|SetSystemTechLevel| | |||
* int: system_id | |||
* int: tech_level - from 0 to 100| | |||
void| | |||
<pre style="margin:0px;">generator.SetSystemTechLevel(1, 99);</pre> | | |||
Set star system tech level. Tech level usually affects shops store items. | |||
}} | |||
{{Scripting_api|ShipExists| | |||
* int: ship_id| | |||
bool: whether ship exists or not| | |||
<pre style="margin:0px;">generator.ShipExists(12552);</pre> | | |||
}} | }} |
Latest revision as of 03:44, 5 July 2014
Scope generator
Used for generation items, objects, systems in game, and also for getting some specific info about them.
Visibility: Global.
List of functions
AddAsteroid | ||
---|---|---|
Arguments | Returns | Example |
|
int: identifier of created object |
var id = generator.AddAsteroid(1,100,100,"Asteroid01",1, 0, {x:0,y:0,z:0}, {x:0,y:0,z:0}); |
Description | ||
Adds asteroid with specified parameters into game world. Asteroid contents (extractable resources), asteroid's look and other parameters can be modified only in .xml file, which is specified in this function by parameter "type". |
AddBase | ||
---|---|---|
Arguments | Returns | Example |
|
int: identifier of created object |
var id = generator.AddBase(1, 100, 100, "Base01", "Station Horizon", {class: "order"}); |
Description | ||
Adds space station to game world. |
AddItem | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = generator.AddItem(1, "SomeItem", 5); |
Description | ||
Adds item to some object's inventory. In VoidExpanse not all objects do have inventory, so this function must be applied only to those, which have it, such as ships, space stations, containers. |
AddItemToSpecifiedContainer | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = generator.AddItemToSpecifiedContainer(1525, "SomeItem", 5); |
Description | ||
Important notice: container_id - is a special, unique in-game identifier for containers, which cannot be obtained by any way through API. Container id can only be obtained as a function parameter in events. Currently used in OnInstancedContainerGeneration event. |
GenerateItemsWithItemlist | ||
---|---|---|
Arguments | Returns | Example |
|
array of objects:
|
var items = generator.GenerateItemsWithItemlist(1, "SomeItem", 5); for(var i = 0; i < items.length; i++) { generator.AddItemToSpecifiedContainer( args.container_id, items[i].id, items[i].quantity ); } |
Description | ||
Generates set of items with itemlist. After generation, items can be added to any container. |
AddContainer | ||
---|---|---|
Arguments | Returns | Example |
|
int: identifier of object created |
var id = generator.AddContainer(1, 0, 0, "Container01", "DropList01"); |
Description | ||
Adds a floating container to game world. By default container is empty. Also containers, which has no contents, are unstable (self-destroyed as soon as someone will look at it's contents), so it's better not to create empty containers. Content can be added with generator.AddItem function. |
AddDecoration | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddDecoration(1, "Decoration01", {x:0,y:0}, 100, {x:5, y:5}, {x:5, y:5}, 2); |
Description | ||
Adds a decoration to game world. Decoration is a non-interactive object, which is used as a... decoration. |
AddJumpgate | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddJumpgate(1, 2, 100, 100, 20, "Jumpgate01", {sometag: "sometag"}); |
Description | ||
Adds a jumpgate - an object, which allows ships to travel between systems. Every jumpgate must be paired with another one, for example, if in system A theres a jumpgate, that leads to system B, then in system B must be a jumpgate, that leads to system A. |
AddNPCShipToSystem | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddNPCShipToSystem("Pirate", "PirateAI", 100, "PirateNpc01", 1, 105, 223, {class: "pirate", uniq_id: "boss"}); |
Description | ||
Adds an npc ship into game. NPC's avatar and faction are set through another functions - generator.SetNPCAvatar and relations.SetShipFaction |
OverrideDropList | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.OverrideDropList(23303, ["DropList01", "DropList02"]); |
Description | ||
Adds specified droplists to npc's droplists list. |
AddPlanet | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddPlanet(1, 0, 0, "Earth", 123); |
Description | ||
Adds planet to game world. Planet's look is driven by seed, based on which planet's look will be defined by random generator. If you want a particular planet, you should either use seed with defined results (by our tool - SeedGenerator), or use another function - AddPlanetWithType. |
AddPlanetWithType | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddPlanetWithType(1, 0, 0, "Earth", 123, "EarthTypePlanet"); |
Description | ||
Adds planet to game world. Planet's look is driven partially be seed, but mostly by the specified type. |
AddSpaceObject | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddSpaceObject(1, 0, 0, "Debris01", {class: "mine"}) |
Description | ||
Adds a space object to game world. Space objects are interactive object. They cannot be destroyed, but they are interactive and collision-enabled. For example, spacemines are created with space objects. |
AddLever | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddLever(1, 0, 0, "Debris01", 0, {class: "mine"}) |
Description | ||
Adds a lever object to world. Lever - is a special object, which can be activated. Parameter "visible_to" specifies, to whom lever is visible. If 0, it's visible to all, else - only to specified ship. Useful when you need to create a special object only to a man, who took the quest. |
AddStar | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created object |
var id = generator.AddStar(1, 0, 0, 234, 0) |
Description | ||
Adds a star. Conventionally, you shouldn't add more then 1 star to a system. If typeID is not specified, type will be picked by random, based on seed parameter. |
AddSystem | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of created system |
var id = generator.AddSystem(0, 0, "Hawkins Eta", 123) |
Description | ||
Adds a star system. Star system can be added anywhere, and by default it won't be connected to any other systems. See tutorial to see, how systems generation works. |
SetSystemTags | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SetSystemTags(1, {"show_clouds": "yes"}) |
Description | ||
Sets tags of specified star system. Can be expanded with generator.AddSystemTag and retrieved by generator.GetSystemTags. |
AddSystemTag | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.AddSystemTag(1, "show_clouds", "yes") |
Description | ||
Adds tag to star system tags (or overwrites existing one with the same name). |
GetSystemTags | ||
---|---|---|
Arguments | Returns | Example |
|
object: tags set by methods above |
var tags = generator.GetSystemTags(1); if(tags != null && tags["show_clouds"] == "yes") { console.Print("System 1 was told to show clouds"); } |
Description | ||
Retrieves tags of star system, which were set by SetSystemTags and AddSystemTag. |
AddAnomaly | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.AddAnomaly(args.sys_id, "radar_disable", {}); |
Description | ||
Adds anomaly to star system. There are few predefined anomalies (see more in the article Anomalies), but you can specify and implement your own anomalies. |
SystemClose | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SystemClose(20); |
Description | ||
Sets system status to closed. Can be used anywhere, has no hardcoded implementation. For example, now it's being used to prevent player to travel to alien systems. System can be opened with generator.SystemOpen. All systems are opened by default. |
SystemOpen | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SystemOpen(20); |
Description | ||
Sets system status to opened. Can be used anywhere, has no hardcoded implementation. For example, now it's being used to prevent player to travel to alien systems. System can be closed with generator.SystemClose. All systems are opened by default. |
IsSystemClosed | ||
---|---|---|
Arguments | Returns | Example |
|
bool |
var closed = generator.IsSystemClosed(20); |
Description | ||
Check whether system is closed or not. |
CountNpcInSystemByTags | ||
---|---|---|
Arguments | Returns | Example |
|
int |
var numOfPirates= generator.CountNpcInSystemByTags(20, {class: "pirate"}); |
Description | ||
Counts npcs with specified tags in specified system. |
ClearDropList | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.ClearDropList(20025); |
Description | ||
Clears droplist of a specified NPC. |
SetSystemPlaylists | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SetSystemPlaylists(args.sys_id, { "explore": "playlist_generic_explore", "combat": "playlist_generic_combat" } ); |
Description | ||
Sets system music playlists. There are few possible keys, see more in MusicPlaylists. |
AddSystemsLink | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.AddSystemsLink(1,2); |
Description | ||
This function creates a link between two systems. This links are simply logical, but there are few hardcoded rules about them. There are some specific rules, that are applied to every link:
Links created this way are displayed on galaxy map. By this links jumpgates are created (though, there is no hard rule about that - you can create jumpgate without link between two star systems, but this connection won't be displayed on galaxy map). |
FixConnectivity | ||
---|---|---|
Arguments | Returns | Example |
void |
void |
generator.FixConnectivity(); |
Description | ||
Should be called after all stars and links were created. It checks, if all stars are reachable from one another, and, if not, it creates missing star systems links. |
DockShipToBase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.DockShipToBase(12253,2); |
Description | ||
Immediately, without any animations, checkups and routines, docks ship to a space station. It's better not to use it on players, because it'll have unpredictable behavior. |
ExpandArea | ||
---|---|---|
Arguments | Returns | Example |
|
void |
var stars = [3]; while(true) { stars = generator.ExpandArea(stars); if(newstars.length >= 10) break; } console.Print("Now we have an area of 10 or more stars around star with id 3"); |
Description | ||
Function, which returns the same array, as input + all stars, which are linked to input ones by 1 link. In other words, it returns an area, expanded by 1 link. Very useful during generation of zones in galaxy, such as faction territories. |
GetAllSystems | ||
---|---|---|
Arguments | Returns | Example |
void |
array: IDs of all systems |
var arr = generator.GetAllSystems(); |
Description | ||
GetAsteroidTypes | ||
---|---|---|
Arguments | Returns | Example |
void |
array: xml_ids (strings) of all asteroids |
var arr = generator.GetAsteroidTypes(); |
Description | ||
GetClosestSystemToPoint | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of picked system of 0, if none |
var sys_id = generator.GetClosestSystemToPoint(0,0); |
Description | ||
Useful during generation process. |
GetDebrisTypes | ||
---|---|---|
Arguments | Returns | Example |
void |
array: xml_ids (strings) of all space objects |
var arr = generator.GetDebrisTypes(); |
Description | ||
Useful during generation process. Alias of generator.GetSpaceObjectsTypes. |
GetSpaceObjectsTypes | ||
---|---|---|
Arguments | Returns | Example |
void |
array: xml_ids (strings) of all space objects |
var arr = generator.GetSpaceObjectsTypes(); |
Description | ||
Useful during generation process. The same as generator.GetDebrisTypes. |
GetIntersection | ||
---|---|---|
Arguments | Returns | Example |
|
string: intersection in format "coord_x;coord_y" or empty string |
var intersection = generator.GetIntersection(0, 15, 15); if(intersection.length > 0) { var arr = intersection.split(';'); console.Print("Intersection was found: point X:" + arr[0] +", Y:" + arr[1]); } |
Description | ||
The function answers the question: if a put a link between system with specified id and point with coordinates coord_x;coord_y, will it intersect any other links? Useful during galaxy generation process. |
GetJumpsBetweenSystems | ||
---|---|---|
Arguments | Returns | Example |
|
int: number of jumps |
var jumps = generator.GetJumpsBetweenSystems(1,1000); |
Description | ||
Returns length (number of links) of the minimal way between two systems. |
GetLinkedSystems | ||
---|---|---|
Arguments | Returns | Example |
|
array: IDs of systems |
var arr = generator.GetLinkedSystems(1); |
Description | ||
Returns an array with IDs of all systems linked to the specified one. |
GetRoute | ||
---|---|---|
Arguments | Returns | Example |
|
array: IDs of systems |
var route = generator.GetRoute(1,5); |
Description | ||
Returns an array with IDs of all systems, which makes the shortes route between two points. |
GetItemPrice | ||
---|---|---|
Arguments | Returns | Example |
|
int: price |
var price = generator.GetItemPrice("object_alien_relic_01"); |
Description | ||
Returns a price of item by it's xml id. |
GetItemTitle | ||
---|---|---|
Arguments | Returns | Example |
|
string: title |
var title = generator.GetItemTitle("object_alien_relic_01"); |
Description | ||
Returns a name of item by it's xml id. |
GetMinDistanceToSystem | ||
---|---|---|
Arguments | Returns | Example |
|
double: distance to the closest system (or maximum double value if none) |
var dist = generator.GetLinkedSystems(1); |
Description | ||
Return distance to the closest system to a specified point. |
GetNumberOfLinks | ||
---|---|---|
Arguments | Returns | Example |
|
int: number of links to specified system |
var links = generator.GetNumberOfLinks(1); |
Description | ||
GetPlanetCoordinates | ||
---|---|---|
Arguments | Returns | Example |
|
vector2: coordinates of a planet |
var coords = generator.GetPlanetCoordinates(242); console.Print("Planet coordinates: X:" + coords.x + ", Y:" + coords.y); |
Description | ||
Returns coordinates of specified planet. |
GetRandomPlanetInSystem | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of a planet |
var id = generator.GetRandomPlanetInSystem(1); |
Description | ||
Returns ID of random planet in system (or 0 if there are no planets). |
GetSystemPlanets | ||
---|---|---|
Arguments | Returns | Example |
|
array: IDs of planets |
var arr = generator.GetSystemPlanets(1); |
Description | ||
Returns an array with IDs of all planets in system. |
GetSystemByID | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = generator.GetSystemByID(1); |
Description | ||
Returns basic info about specified system. Tags of star system can be gained with generator.GetSystemTags. |
GetBaseByID | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = generator.GetBaseByID(1); |
Description | ||
Returns space station basic description. Tags cannot be retrieved with this function - use game.GetTags instead. |
GetSystemsByDistanceTo | ||
---|---|---|
Arguments | Returns | Example |
|
array: IDs of systems |
var arr = generator.GetSystemsByDistanceTo(1); |
Description | ||
Returns an array with IDs of systems, which are sorted by distance to specified system. Specified system is included into resulting array. |
GetPopulatedSystems | ||
---|---|---|
Arguments | Returns | Example |
void |
array: IDs of systems |
var arr = generator.GetPopulatedSystems(); |
Description | ||
Returns an array with IDs of systems in which there are currently players. |
GetAllResources | ||
---|---|---|
Arguments | Returns | Example |
void |
array: xml_ids (strings) of resources |
var arr = generator.GetAllResources(); |
Description | ||
Returns an array of all resources of VoidExpanse. |
GetResourcesWithFlags | ||
---|---|---|
Arguments | Returns | Example |
|
array: xml_ids (strings) of resources |
var arr = generator.GetResourcesWithFlags(["mineable", "highlevel"]); |
Description | ||
Returns an array of resources of VoidExpanse, contains all specified flags in it's XML description. |
GetResourceByID | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = generator.GetResourceByID("Resource01"); |
Description | ||
Returns a description of a resource by it's xml_id. |
GetItemByXmlID | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = generator.GetItemByXmlID("Item01"); |
Description | ||
Returns a description of an item by it's xml_id. |
RemoveAsteroid | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveAsteroid(123); |
Description | ||
Removes asteroid from a game world. |
RemoveBase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveBase(123); |
Description | ||
Removes base (space station) from a game world. |
RemoveDecoration | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveDecoration(123); |
Description | ||
Removes decoration from a game world. |
RemoveJumpgate | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveJumpgate(123); |
Description | ||
Removes a jumpgate from a game world. |
RemovePlanet | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemovePlanet(123); |
Description | ||
Removes a planet from a game world. |
RemoveSpaceObject | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveSpaceObject(123); |
Description | ||
Removes a space object from a game world. |
RemoveLever | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveLever(123); |
Description | ||
Removes specified lever from a game world. |
RemoveStar | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveStar(123); |
Description | ||
Removes a star from a game world. |
RemoveSystemsLink | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.RemoveSystemsLink(1,2); |
Description | ||
Removes a link between two systems. |
ReportLoadingPhase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.ReportLoadingPhase("Loading galaxy"); |
Description | ||
Adds message to singleplayer client with loader (then to alter loader use generator.ReportLoadingProgress). |
ReportLoadingPhaseNoLoader | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.ReportLoadingPhaseNoLoader("Loading galaxy"); |
Description | ||
Adds message to singleplayer client. |
ReportLoadingProgress | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.ReportLoadingProgress(0.5); |
Description | ||
Adds message to singleplayer client. |
SetNPCAvatar | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SetNPCAvatar(12553, [1,2,3,4,5,6]); |
Description | ||
Sets npc avatar. |
SetNPCAvatarImg | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SetNPCAvatarImg(id, "avatars/unique/terminal_01.png"); |
Description | ||
Sets npc avatar image instead of standart avatar system. |
SetSystemDangerLevel | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SetSystemDangerLevel(1, 99); |
Description | ||
Set star system danger level. Danger level usually affects a level of system's npc and many other parameters. |
SetSystemTechLevel | ||
---|---|---|
Arguments | Returns | Example |
|
void |
generator.SetSystemTechLevel(1, 99); |
Description | ||
Set star system tech level. Tech level usually affects shops store items. |
ShipExists | ||
---|---|---|
Arguments | Returns | Example |
|
bool: whether ship exists or not |
generator.ShipExists(12552); |
Description | ||