VoidExpanse/scope-generator: Difference between revisions

From AtomicTorchWiki
(Created page with "<noinclude> Category:VoidExpanse/api_scopes </noinclude> = Scope generator = Used for generation items, objects, systems in game, and also for getting some specific info ...")
 
No edit summary
Line 89: Line 89:
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.
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.
}}
}}


{{Scripting_api|AddNPCShipToSystem|
{{Scripting_api|AddNPCShipToSystem|
Line 102: Line 103:
<pre style="margin:0px;">var id = generator.AddNPCShipToSystem("Pirate", "PirateAI", 100, "PirateNpc01", 1, 105, 223, {class: "pirate", uniq_id: "boss"});</pre> |
<pre style="margin:0px;">var id = generator.AddNPCShipToSystem("Pirate", "PirateAI", 100, "PirateNpc01", 1, 105, 223, {class: "pirate", uniq_id: "boss"});</pre> |
Adds an npc ship into game. NPC's avatar and faction are set through another functions - generator.SetNPCAvatar and relations.SetShipFaction
Adds an npc ship into game. NPC's avatar and faction are set through another functions - generator.SetNPCAvatar and relations.SetShipFaction
}}
{{Scripting_api|OverrideDropList|
* int: ship_id
* array: droplists - strings array of droplists|
void|
<pre style="margin:0px;">generator.OverrideDropList(23303, ["DropList01", "DropList02"]);</pre> |
Adds specified droplists to npc's droplists list.
}}
{{Scripting_api|AddPlanet|
* int: system_id
* double: coord_x
* double: coord_y
* string: name
* int: seed |
int: ID of created object|
<pre style="margin:0px;">var id = generator.AddPlanet(1, 0, 0, "Earth", 123);</pre> |
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.
}}
{{Scripting_api|AddPlanetWithType|
* int: system_id
* double: coord_x
* double: coord_y
* string: name
* int: seed
* string: planet_config_type |
int: ID of created object|
<pre style="margin:0px;">var id = generator.AddPlanet(1, 0, 0, "Earth", 123);</pre> |
Adds planet to game world. Planet's look is driven partially be seed, but mostly by the specified type.
}}
}}

Revision as of 05:06, 13 February 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: system_id
  • double: coord_x
  • double: coord_y
  • string: type - xml id of asteroid
  • double: scale
  • double: resQ - resouces modifier
  • object: rotation
  • object: rotationSpeed

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: system_id
  • double: coord_x
  • double: coord_y
  • string: type - xml id of base
  • string: name
  • (optional) object: tags

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
  • int: object_id
  • string: item_xml_id
  • int: quantity

object:

  • quantity - quantity was actually added
  • type - can be "item" or "resource"
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.


AddContainer
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: xml_type
  • string: droplist
  • (optional) object: tags

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: system_id
  • string: item_xml_id
  • vector2: position
  • double: depth
  • vector2: rotation
  • vector2: rotation_speed,
  • double: scale

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: system_id
  • int: system_to
  • double: coord_x
  • double: coord_y
  • double: angle
  • string: xml_type
  • (optional) object: tags

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
  • string: npc_name
  • string: behavior - AI-script ("brains")
  • int: level
  • string: xml_type - npc xml type
  • int: system_id
  • double: coord_x
  • double: coord_y
  • (optional) object: tags

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
  • int: ship_id
  • array: droplists - strings array of droplists

void

generator.OverrideDropList(23303, ["DropList01", "DropList02"]);
Description

Adds specified droplists to npc's droplists list.


AddPlanet
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: name
  • int: seed

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: system_id
  • double: coord_x
  • double: coord_y
  • string: name
  • int: seed
  • string: planet_config_type

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 partially be seed, but mostly by the specified type.