VoidExpanse/scope-ship: Difference between revisions
No edit summary |
No edit summary |
||
Line 96: | Line 96: | ||
{{Scripting_api|GetBuffsCache| | {{Scripting_api|GetBuffsCache| | ||
* int: ship_id | | * int: ship_id | | ||
array: key - | array: key - value | | ||
<pre style="margin:0px;">var cache = ship.GetBuffsCache(24556);</pre> | | <pre style="margin:0px;">var cache = ship.GetBuffsCache(24556);</pre> | | ||
Returns current buffs cache. Used in FinalCacheCalculations. | Returns current buffs cache. Used in FinalCacheCalculations. | ||
Line 137: | Line 137: | ||
{{Scripting_api|GetEquipmentCache| | {{Scripting_api|GetEquipmentCache| | ||
* int: ship_id| | * int: ship_id| | ||
array: key | array: key-value| | ||
<pre style="margin:0px;">var cache = ship.GetEquipmentCache(24556);</pre> | | <pre style="margin:0px;">var cache = ship.GetEquipmentCache(24556);</pre> | | ||
Returns current equipment cache of ship. | Returns current equipment cache of ship. | ||
Line 144: | Line 144: | ||
{{Scripting_api|GetFinalCache| | {{Scripting_api|GetFinalCache| | ||
* int: ship_id| | * int: ship_id| | ||
array: key | array: key-value| | ||
<pre style="margin:0px;">var cache = ship.GetFinalCache(24556);</pre> | | <pre style="margin:0px;">var cache = ship.GetFinalCache(24556);</pre> | | ||
Returns current final cache of ship. | Returns current final cache of ship. | ||
Line 170: | Line 170: | ||
{{Scripting_api|GetSkillsCache| | {{Scripting_api|GetSkillsCache| | ||
* int: ship_id| | * int: ship_id| | ||
array: key | array: key-value| | ||
<pre style="margin:0px;">var cache = ship.GetSkillsCache(24556);</pre> | | <pre style="margin:0px;">var cache = ship.GetSkillsCache(24556);</pre> | | ||
Returns current skills cache. | Returns current skills cache. |
Revision as of 04:23, 14 February 2014
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.Add(24556, "SomeItem2", 5); |
Description | ||
Adds item to ship's inventory. |
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. |
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. |
GetCargoAmount | ||
---|---|---|
Arguments | Returns | Example |
|
int: amount |
var left = ship.GetCargoAmount(24556, "SomeCargo"); |
Description | ||
Returns amount of specified cargo in player'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. |
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. |
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. |
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 | ||
GetTags | ||
---|---|---|
Arguments | Returns | Example |
|
object: tags of a ship |
var tags = ship.GetTags(24556); |
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.) |
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. |