VoidExpanse/scope-ship: Difference between revisions
Atomic-admin (talk | contribs) No edit summary |
Ai enabled (talk | contribs) |
||
Line 17: | Line 17: | ||
* int: quantity - amount added | * int: quantity - amount added | ||
* string: type - "item" or "resource"| | * string: type - "item" or "resource"| | ||
<pre style="margin:0px;">var obj = ship. | <pre style="margin:0px;">var obj = ship.AddItem(24556, "SomeItem2", 5);</pre> | | ||
Adds item to ship's inventory. | Adds item to ship's inventory. | ||
}} | }} |
Latest revision as of 09:22, 20 April 2015
Scope ship
Used to get info and manipulate objects if type "ship".
Visibility: Global.
List of functions
AddItem | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = ship.AddItem(24556, "SomeItem2", 5); |
Description | ||
Adds item to ship's inventory. |
AddItemToStorage | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var obj = ship.AddItemToStorage(24556, "BFG", 0); |
Description | ||
Adds item to ship's storage, not inventory (only works on a base). Useful when you need to add new hull through scripts, but it cannot be added to inventory, only to storage. |
RemoveItem | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.RemoveItem(24556, 5562); |
Description | ||
Removes item from ship's inventory. |
RemoveItemByType | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.RemoveItemByType(24556, "SomeItem2"); |
Description | ||
Removes item from PLAYER's inventory by type. If there's no item of specified type in ship's inventory, nothing will happen. |
RemoveItemByTypeCount | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.RemoveItemByTypeCount(24556, "SomeItem2", 5); |
Description | ||
Removes item from PLAYER's inventory by type. If there's no item of specified type in ship's inventory, nothing will happen. |
RemoveCargoByType | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.RemoveCargoByType(24556, "SomeCargo"); |
Description | ||
Removes cargo from PLAYER's inventory by type. If there's no cargo of specified type in ship's inventory, nothing will happen. |
AddSkillPointsToPlayer | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.AddSkillPointsToPlayer("DLirry", 20); |
Description | ||
Adds skill points to specified player. |
AddSkillPointsToShip | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.AddSkillPointsToShip(12335, 20); |
Description | ||
Adds skill points to specified ship (works only on player's ships, non-npc). |
GetCargoAmount | ||
---|---|---|
Arguments | Returns | Example |
|
int: amount |
var left = ship.GetCargoAmount(24556, "SomeCargo"); |
Description | ||
Returns amount of specified cargo in player's inventory. |
GetCoordinates | ||
---|---|---|
Arguments | Returns | Example |
|
vector2: coordinates |
var coords = ship.GetCoordinates(24556); |
Description | ||
Returns current coordinates of specified ship. Alias of GetPosition. |
GetShipsInScope | ||
---|---|---|
Arguments | Returns | Example |
|
array of int: ids |
var ships = ship.GetShipsInScope(24556); |
Description | ||
Returns IDs of all ships, that are currently in specified ship's scope. |
GetProjectilesInScope | ||
---|---|---|
Arguments | Returns | Example |
|
array of int: ids |
var bullets = ship.GetProjectilesInScope(24556); |
Description | ||
Returns IDs of all projectiles, that are currently in specified ship's scope. |
GetDistanceToObj | ||
---|---|---|
Arguments | Returns | Example |
|
double: distance |
var dist = ship.GetDistanceToObj(24556, 25225); |
Description | ||
Returns distance from specified ship to specified object. |
GetFreeInventorySlots | ||
---|---|---|
Arguments | Returns | Example |
|
int: number of free slots |
var slotsNum= ship.GetFreeInventorySlots(24556); |
Description | ||
Returns number of empty inventory slots in ship's inventory. |
HasCargoAmount | ||
---|---|---|
Arguments | Returns | Example |
|
bool |
var hasCargo = ship.HasCargoAmount(24556, "SomeCargo", 14); |
Description | ||
Checks if player has specified amount of cargo. |
HasItemOfType | ||
---|---|---|
Arguments | Returns | Example |
|
bool: if player's ship has item of specified type |
var hasItem = ship.HasItemOfType(24556, "SomeItem1"); |
Description | ||
Useful in quests. |
HasItemOfTypeEquipped | ||
---|---|---|
Arguments | Returns | Example |
|
bool: if player's ship has item of specified type equipped |
var hasItem = ship.HasItemOfTypeEquipped(24556, "SomeItem1"); |
Description | ||
Useful in quests. |
CountItemOfType | ||
---|---|---|
Arguments | Returns | Example |
|
int: count |
var quantity = ship.CountItemOfType(24556, "SomeItem1"); |
Description | ||
Useful in quests. |
CountItemOfType | ||
---|---|---|
Arguments | Returns | Example |
|
int: count |
var quantity = ship.CountItemOfType(24556, "SomeItem1"); |
Description | ||
Useful in quests. |
GetBuffs | ||
---|---|---|
Arguments | Returns | Example |
|
array of objects:
|
var effects = ship.GetBuffs(24556); |
Description | ||
Returns all specified ship's active effects. Active effects are temporary effects, which are usually effects of consumables or devices. |
GetBuffsCache | ||
---|---|---|
Arguments | Returns | Example |
|
array: key - value |
var cache = ship.GetBuffsCache(24556); |
Description | ||
Returns current buffs cache. Used in FinalCacheCalculations. |
GetCurrentValue | ||
---|---|---|
Arguments | Returns | Example |
|
double: current value with specified key |
var val = ship.GetCurrentValue(24556, "structure"); |
Description | ||
Returns current value of ship. |
GetCurrentValuesList | ||
---|---|---|
Arguments | Returns | Example |
|
array: key -> value |
var values = ship.GetCurrentValuesList(24556); |
Description | ||
Returns all current values of ship. |
GetEquipment | ||
---|---|---|
Arguments | Returns | Example |
|
array: unique IDs (int) of equipped items |
var equipment = ship.GetEquipment(24556); |
Description | ||
Returns current equipment of player's ship. Npc ship has no equipment, so it cannot be retreieved this way. |
GetWeapons | ||
---|---|---|
Arguments | Returns | Example |
|
array: unique IDs (int) of equipped weapons |
var weapons = ship.GetWeapons(24556); |
Description | ||
Returns currently equipped weapons of a ship. Npc ship has no equipment, so it cannot be retireved this way. |
GetWeaponsOfType | ||
---|---|---|
Arguments | Returns | Example |
|
array: unique IDs (int) of equipped weapons |
var weapons = ship.GetWeapons(24556); |
Description | ||
Returns currently equipped weapons of a ship of a specified type. Npc ship has no equipment, so it cannot be retireved this way. |
RefillAmmoForWeapon | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.RefillAmmoForWeapon(24556, 15252); |
Description | ||
Refills ammo for weapon with specified unique in-game id (GID). |
GetHullXmlID | ||
---|---|---|
Arguments | Returns | Example |
|
string: current ship's hull's xml type |
var hull = ship.GetHullXmlID(24556); |
Description | ||
Returns currently equipped hull's xml_id. |
GetEquipmentCache | ||
---|---|---|
Arguments | Returns | Example |
|
array: key-value |
var cache = ship.GetEquipmentCache(24556); |
Description | ||
Returns current equipment cache of ship. |
GetFinalCache | ||
---|---|---|
Arguments | Returns | Example |
|
array: key-value |
var cache = ship.GetFinalCache(24556); |
Description | ||
Returns current final cache of ship. |
GetFinalCacheValue | ||
---|---|---|
Arguments | Returns | Example |
|
double: specified cache value |
var val = ship.GetFinalCacheValue(24556, "structure"); |
Description | ||
Returns final cache value. |
GetSkills | ||
---|---|---|
Arguments | Returns | Example |
|
array of objects:
|
var skills = ship.GetSkills(24556); |
Description | ||
Returns all current skills of ship. |
GetSkill | ||
---|---|---|
Arguments | Returns | Example |
|
|
var skill = ship.GetSkill(24556,"some_skill_1"); |
Description | ||
Returns level of specified skill, or 0 if the ship doesn't have that skill. |
GetSkillsCache | ||
---|---|---|
Arguments | Returns | Example |
|
array: key-value |
var cache = ship.GetSkillsCache(24556); |
Description | ||
Returns current skills cache. |
GetLevel | ||
---|---|---|
Arguments | Returns | Example |
|
int: current level of ship |
var level = ship.GetLevel(24556); |
Description | ||
GetTag | ||
---|---|---|
Arguments | Returns | Example |
|
string: value of a tag or null |
var value = ship.GetTag(24556,"qwe"); |
Description | ||
GetSystemID | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of ship's current system |
var sys_id = ship.GetSystemID(24556); |
Description | ||
IsDocked | ||
---|---|---|
Arguments | Returns | Example |
|
bool: returns whether ship is currently docked |
var docked = ship.IsDocked(24556); |
Description | ||
EnteringJumpgate | ||
---|---|---|
Arguments | Returns | Example |
|
int: returns ID of jumpgate ship is entering (or 0 if none) |
var current_jumpgate = ship.EnteringJumpgate(24556); |
Description | ||
GetCurrentBase | ||
---|---|---|
Arguments | Returns | Example |
|
int: returns ID of base to which ship is docked (or -1 if none) |
var current_base = ship.GetCurrentBase(24556); |
Description | ||
GetTimeSinceLastHit | ||
---|---|---|
Arguments | Returns | Example |
|
double: time since ship last time dealt damage to someone |
var time = ship.GetTimeSinceLastHit(24556); |
Description | ||
Used in AI |
GetTimeSinceLastHitted | ||
---|---|---|
Arguments | Returns | Example |
|
double: time since ship last time took damage from someone |
var time = ship.GetTimeSinceLastHitted(24556); |
Description | ||
Used in ship's shield reestablishment calculations. |
IsShieldUp | ||
---|---|---|
Arguments | Returns | Example |
|
bool: returns whether ship's shield is up |
var shield_up = ship.IsShieldUp(24556); |
Description | ||
IsNpc | ||
---|---|---|
Arguments | Returns | Example |
|
bool: returns whether ship is npc-controlled |
var is_npc = ship.IsNpc(24556); |
Description | ||
IsEngineOn | ||
---|---|---|
Arguments | Returns | Example |
|
bool: returns whether ship's engine is working |
var is_engine_on = ship.IsEngineOn(24556); |
Description | ||
RegenerateWeapons | ||
---|---|---|
Arguments | Returns | Example |
|
double: amount of energy spent on weapons regeneration |
var energy_spent = ship.RegenerateWeapons(24556); |
Description | ||
Hardcoded part - trying to regenerate weapons with energy. Only usable on PLAYER's ships. Returns amount of energy spent on weapons regeneration. |
ReleaseGrappler | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.ReleaseGrappler(24556); |
Description | ||
Release all current grappled objects. |
GetGrappledCount | ||
---|---|---|
Arguments | Returns | Example |
|
int: number of grappled objects |
var grappled = ship.GetGrappledCount(24556); |
Description | ||
Get number of grappled objects. Useful in caluclation of grappler energy consumption. |
SetBuffsCacheValue | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetBuffsCacheValue(24556, "structure", 2); |
Description | ||
Sets buff cache value. |
ClearBuffsCache | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.ClearBuffsCache(24556); |
Description | ||
Clears all current buffs cache values. |
SetCurrentValue | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetCurrentValue(24556, "structure", 59); |
Description | ||
Sets current value of ship |
SetCurrentValueDelta | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetCurrentValueDelta(24556, "structure", -10); |
Description | ||
Alters current value to specified value. Value will be clamped automatically between 0 and it's max value (which is governed by ship params.) |
SetCurrentArea | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetCurrentArea(24556, "command_deck"); |
Description | ||
Sets current area of a player to specified one. Area determines in which section on a station NPC or player is. |
GetCurrentArea | ||
---|---|---|
Arguments | Returns | Example |
|
string: area_id |
var area = ship.GetCurrentArea(24556); |
Description | ||
Gets current area of the ship. |
SetDrift | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetDrift(24556, 5000); |
Description | ||
Enables driftmode of ship - in this mode ship cannot be controlled and can gain torque (which is always 0 when driftmode is off). Useful in explosion effects. |
SetEquipmentCacheValue | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetEquipmentCacheValue(24556, "structure", 5000); |
Description | ||
Sets equipment cache value. |
ClearEquipmentCache | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.ClearEquipmentCache(24556); |
Description | ||
Clears equipment cache. |
SetFinalCacheValue | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetFinalCacheValue(24556, "structure", 5000); |
Description | ||
Sets final cache value. Final cache is the one used in all in-game caluclations. |
SetShieldUp | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetShieldUp(24556, true); |
Description | ||
Sets shield up/down status. Affects collision and damage models. Does not applies visual effects (see more in VisualScope). |
SetSkillsCacheValue | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetSkillsCacheValue(24556, "structure", 5000); |
Description | ||
Sets skill cache value. |
ClearSkillsCache | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.ClearSkillsCache(24556); |
Description | ||
Clear skills cache. |
SetShipAsArrivedFromJumpgate | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetShipAsArrivedFromJumpgate(24556, 15); |
Description | ||
Set visual and physical effects, that looks like ship just arrived from specified jumpgate. |
SetDamageByShip | ||
---|---|---|
Arguments | Returns | Example |
|
void |
ship.SetDamageByShip(24556, 15, 44535); |
Description | ||
Sets damage from ship. Useful in AI - you can count damage from player ship and decide, whether to attack or not. |
SetDamageByShip | ||
---|---|---|
Arguments | Returns | Example |
|
void |
var dmg = ship.SetDamageByShip(24556, 44535); |
Description | ||
Gets damage by ship, which was set by ship.SetDamageByShip method. |
GetTotalCargoAmount | ||
---|---|---|
Arguments | Returns | Example |
|
int: amount |
var value = ship.GetTotalCargoAmount(24556); |
Description | ||
Returns total current amount of cargo stored in a ship. |