VoidExpanse/scope-npc: Difference between revisions
(Created page with "<noinclude> Category:VoidExpanse/api_scopes </noinclude> = Scope npc = Manages NPC bahavior, interactions and parameters. '''Visibility:''' Global. == List of functions...") |
No edit summary |
||
Line 49: | Line 49: | ||
object: | object: | ||
* string: name - name of objective, specified in AddObjective | * string: name - name of objective, specified in AddObjective | ||
* string: | * string: key - value - other parameters, specified in AddObjective| | ||
<pre style="margin:0px;">var objective = npc.GetCurrentObjective(25334);</pre> | | <pre style="margin:0px;">var objective = npc.GetCurrentObjective(25334);</pre> | | ||
Gets current npc's objective (or null if none) | Gets current npc's objective (or null if none) | ||
Line 59: | Line 59: | ||
double: time - how long npc is doing his current objective| | double: time - how long npc is doing his current objective| | ||
<pre style="margin:0px;">var time = npc.GetCurrentObjectiveTimer(25334);</pre> | | <pre style="margin:0px;">var time = npc.GetCurrentObjectiveTimer(25334);</pre> | | ||
}} | |||
== NODES == | |||
{{Scripting_api|AddNode| | |||
* int: npc_ship_id | |||
* double: coord_x | |||
* double: coord_y| | |||
void| | |||
<pre style="margin:0px;">npc.AddNode(25334, 100, 100);</pre> | | |||
Adds a node to npc. NPC can use nodes for patrolling, or for any other reason. | |||
}} | |||
{{Scripting_api|ClearNodes| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.ClearNodes(25334);</pre> | | |||
Removes all nodes from npc. | |||
}} | |||
{{Scripting_api|GetDistanceToNode| | |||
* int: npc_ship_id | |||
* int: node_id - number of node| | |||
double: distance_to_node| | |||
<pre style="margin:0px;">var dist = npc.GetDistanceToNode(25334, 1);</pre> | | |||
}} | |||
{{Scripting_api|GetNodes| | |||
* int: npc_ship_id| | |||
array of objects: | |||
* double: CoordX | |||
* double: CoordY| | |||
<pre style="margin:0px;">var nodes = npc.GetNodes(25334);</pre> | | |||
}} | |||
{{Scripting_api|RemoveNode| | |||
* int: npc_ship_id | |||
* int: node_id| | |||
void| | |||
<pre style="margin:0px;">npc.RemoveNode(25334, 1);</pre> | | |||
Removes node from npc nodes. | |||
}} | |||
{{Scripting_api|FollowRouteToObject| | |||
* int: npc_ship_id | |||
* int: object_id| | |||
void| | |||
<pre style="margin:0px;">npc.FollowRouteToObject(25334, 2535);</pre> | | |||
Creates route to object and follow it. | |||
}} | |||
{{Scripting_api|FollowRouteToBase| | |||
* int: npc_ship_id | |||
* int: base_id| | |||
void| | |||
<pre style="margin:0px;">npc.FollowRouteToBase(25334, 2535);</pre> | | |||
Creates route to base and follow it. | |||
}} | |||
{{Scripting_api|StopFollowingRoute| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.StopFollowingRoute(25334);</pre> | | |||
Stops following current route. | |||
}} | |||
{{Scripting_api|IsNodeReached| | |||
* int: npc_ship_id | |||
* int: is_node_reached| | |||
void| | |||
<pre style="margin:0px;">var res = npc.IsNodeReached(25334, 0);</pre> | | |||
Checks if node is reached. | |||
}} | |||
{{Scripting_api|IsNodeReached| | |||
* int: npc_ship_id | |||
* int: is_node_reached| | |||
void| | |||
<pre style="margin:0px;">var res = npc.IsNodeReached(25334, 0);</pre> | | |||
Checks if node is reached. | |||
}} | |||
== Battle == | |||
{{Scripting_api|Fire| | |||
* int: npc_ship_id | |||
* int: slot| | |||
void| | |||
<pre style="margin:0px;">npc.Fire(25334, 0);</pre> | | |||
Fires from specified slot. | |||
}} | |||
{{Scripting_api|SetWeaponUsage| | |||
* int: npc_ship_id | |||
* string: projectile_type - "Ray","DirectHit","BulletOrMissile" | |||
* double: min_dist | |||
* double: max_dist | |||
* double: delay| | |||
void| | |||
<pre style="margin:0px;">npc.SetWeaponUsage(25334, "Ray", 2,10, 200);</pre> | | |||
Sets weapon usage. It means npc will try to shoot with it's weapons of specified type | |||
only on specified distance and will make specified delays between shots. | |||
}} | |||
== Movement == | |||
{{Scripting_api|CapSpeed| | |||
* int: npc_ship_id | |||
* double: value| | |||
void| | |||
<pre style="margin:0px;">npc.CapSpeed(25334, 2);</pre> | | |||
Caps npc's ship speed. | |||
}} | |||
{{Scripting_api|FaceFromObj| | |||
* int: npc_ship_id | |||
* int: object_id| | |||
void| | |||
<pre style="margin:0px;">npc.FaceFromObj(25334, 235);</pre> | | |||
NPC faces from object. | |||
}} | |||
{{Scripting_api|FaceObj| | |||
* int: npc_ship_id | |||
* int: object_id| | |||
void| | |||
<pre style="margin:0px;">npc.FaceObj(25334, 235);</pre> | | |||
NPC faces to object. | |||
}} | |||
{{Scripting_api|FaceStickPoint| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.FaceStickPoint(25334, 235);</pre> | | |||
NPC faces current stick point. | |||
}} | |||
{{Scripting_api|FaceCoord| | |||
* int: npc_ship_id | |||
* double: coord_x | |||
* double: coord_y| | |||
void| | |||
<pre style="margin:0px;">npc.v(25334, 100, 105);</pre> | | |||
NPC faces specified coordinates. | |||
}} | |||
{{Scripting_api|GoBackward| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.GoBackward(25334);</pre> | | |||
}} | |||
{{Scripting_api|GoForward| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.GoForward(25334);</pre> | | |||
}} | |||
{{Scripting_api|RotLeft| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.RotLeft(25334);</pre> | | |||
}} | |||
{{Scripting_api|RotRight| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.RotRight(25334);</pre> | | |||
}} | |||
{{Scripting_api|Stop| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.Stop(25334);</pre> | | |||
}} | |||
{{Scripting_api|InstantStop| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.InstantStop(25334);</pre> | | |||
}} | |||
{{Scripting_api|StrafeLeft| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.StrafeLeft(25334);</pre> | | |||
}} | |||
{{Scripting_api|StrafeRight| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.StrafeRight(25334);</pre> | | |||
}} | |||
{{Scripting_api|StopEvasion| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.StopEvasion(25334);</pre> | | |||
Turns evasion mode off. Evasion mode is the mode, when npc can avoid attacks with rockets and ballistics by strafing. | |||
}} | |||
{{Scripting_api|StartEvasion| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.StartEvasion(25334);</pre> | | |||
Turns evasion mode on. Evasion mode is the mode, when npc can avoid attacks with rockets and ballistics by strafing. | |||
}} | |||
== Locks == | |||
{{Scripting_api|FriendlyLockOnTarget| | |||
* int: npc_ship_id | |||
* int: target_id | |||
* double: get_away_dist| | |||
void| | |||
<pre style="margin:0px;">npc.FriendlyLockOnTarget(25334, 16);</pre> | | |||
Friendly lock is a type of lock, when npc facing it's target, but do not attack. | |||
}} | |||
{{Scripting_api|GetLockTarget| | |||
* int: npc_ship_id| | |||
int: lock target object ID| | |||
<pre style="margin:0px;">var lockTarget = npc.GetLockTarget(25334);</pre> | | |||
Gets current target, on which npc is locked. | |||
}} | |||
{{Scripting_api|GetStickObject| | |||
* int: npc_ship_id| | |||
int: object_id - current stick object id| | |||
<pre style="margin:0px;">var stickObject = npc.GetStickObject(25334);</pre> | | |||
Get current stick object. | |||
}} | |||
{{Scripting_api|GetFriendlyLockTarget| | |||
* int: npc_ship_id| | |||
int: object_id - current friendly lock target| | |||
<pre style="margin:0px;">var lockTarget = npc.GetFriendlyLockTarget(25334);</pre> | | |||
Get current lock target | |||
}} | |||
{{Scripting_api|IsFriendlyLocked| | |||
* int: npc_ship_id| | |||
bool: is npc friendly locked| | |||
<pre style="margin:0px;">var is_locked = npc.IsFriendlyLocked(25334);</pre> | | |||
Returns whether npc is friendly locked. | |||
}} | |||
{{Scripting_api|IsLocked| | |||
* int: npc_ship_id| | |||
bool: is npc locked on target| | |||
<pre style="margin:0px;">var is_locked = npc.IsLocked(25334);</pre> | | |||
Returns whether npc is locked on target. | |||
}} | |||
{{Scripting_api|Unlock| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.Unlock(25334);</pre> | | |||
Unlocks from target or frienly lock target. | |||
}} | |||
{{Scripting_api|IsStickToPoint| | |||
* int: npc_ship_id| | |||
bool: is_sticked - whether npc is sticked to point| | |||
<pre style="margin:0px;">var res = npc.IsStickToPoint(25334);</pre> | | |||
}} | |||
{{Scripting_api|IsStickToObject| | |||
* int: npc_ship_id| | |||
bool: is_sticked - whether npc is sticked to point| | |||
<pre style="margin:0px;">var res = npc.IsStickToObject(25334);</pre> | | |||
}} | |||
{{Scripting_api|GetDistanceToStickPoint| | |||
* int: npc_ship_id| | |||
double: distance| | |||
<pre style="margin:0px;">var distance = npc.GetDistanceToStickPoint(25334);</pre> | | |||
Returns distance to current stick point. | |||
}} | |||
{{Scripting_api|GetDistanceToStickObject| | |||
* int: npc_ship_id| | |||
double: distance| | |||
<pre style="margin:0px;">var distance = npc.GetDistanceToStickObject(25334);</pre> | | |||
Returns distance to current stick object. | |||
}} | |||
{{Scripting_api|LockOnTarget| | |||
* int: npc_ship_id | |||
* int: target_id | |||
* double: get_away_dist| | |||
void| | |||
<pre style="margin:0px;">npc.LockOnTarget(25334, 25343, 20);</pre> | | |||
Locks on target. Npc will automatically unlock, when distance to target object will be more then get_away_dist. | |||
}} | |||
{{Scripting_api|StickToObject| | |||
* int: npc_ship_id | |||
* int: target_object | |||
* ''(optional) double: get_away_dist''| | |||
void| | |||
<pre style="margin:0px;">npc.StickToObject(25334, 24000, 20);</pre> | | |||
Sticks NPC to object. Npc will try to approach sticked object. Will automatically unstick, when distance to object will exceed get_away_dist parameter. | |||
}} | |||
{{Scripting_api|StickToPoint| | |||
* int: npc_ship_id | |||
* double: coord_x | |||
* double: coord_y | |||
* double: get_back_distance| | |||
void| | |||
<pre style="margin:0px;">npc.StickToPoint(25334, 100, 100, 20);</pre> | | |||
NPC sticks to specified point. If NPC goes further then get_back_distance, npc will try to get back to stick point. | |||
}} | |||
{{Scripting_api|Unstick| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.Unstick(25334);</pre> | | |||
Unsticks NPC from point or object. | |||
}} | |||
{{Scripting_api|GetLockedTime| | |||
* int: npc_ship_id| | |||
double: locked_time| | |||
<pre style="margin:0px;">var time = npc.GetLockedTime(25334);</pre> | | |||
Returns time, during which NPC is locked on it's current target. | |||
}} | |||
== Interaction == | |||
{{Scripting_api|DeviceActivateOnObject| | |||
* int: npc_ship_id | |||
* string: id | |||
* int: target| | |||
void| | |||
<pre style="margin:0px;">npc.DeviceActivateOnObject(25334, "device", 1541);</pre> | | |||
NPC tries to activate device on specified target. | |||
}} | |||
{{Scripting_api|DeviceActivateOnCoords| | |||
* int: npc_ship_id | |||
* string: id | |||
* double: coord_x | |||
* double: coord_y| | |||
void| | |||
<pre style="margin:0px;">npc.DeviceActivateOnCoords(25334, "device", 100, 100);</pre> | | |||
NPC tries to activate device on specified coordinates. | |||
}} | |||
{{Scripting_api|DeviceActivateOnSelf| | |||
* int: npc_ship_id | |||
* string: id| | |||
void| | |||
<pre style="margin:0px;">npc.DeviceActivateOnSelf(25334, "device");</pre> | | |||
NPC tries to activate device on self. | |||
}} | |||
{{Scripting_api|DeviceDeactivate| | |||
* int: npc_ship_id | |||
* string: id| | |||
void| | |||
<pre style="margin:0px;">npc.DeviceDeactivate(25334, "device");</pre> | | |||
Deactivates device. | |||
}} | |||
{{Scripting_api|EnterBase| | |||
* int: npc_ship_id | |||
* int: base_id| | |||
void| | |||
<pre style="margin:0px;">npc.EnterBase(25334, 15);</pre> | | |||
Npc enters base (with animation, routine etc.) | |||
}} | |||
{{Scripting_api|EnterJumpgate| | |||
* int: npc_ship_id | |||
* int: jumpgate_id| | |||
void| | |||
<pre style="margin:0px;">npc.EnterJumpgate(25334, 16);</pre> | | |||
Npc enters jumpgate (with animation, routine etc.) After entering jumpgate, ship will be destroyed. | |||
}} | |||
{{Scripting_api|TravelThroughJumpgate| | |||
* int: npc_ship_id | |||
* int: jumpgate_id| | |||
void| | |||
<pre style="margin:0px;">npc.TravelThroughJumpgate(25334, 16);</pre> | | |||
Npc enters jumpgate (with animation, routine etc.). After travel, ship will actually appear in destination system. | |||
}} | |||
{{Scripting_api|GetDistanceToObj| | |||
* int: npc_ship_id | |||
* int: object_id| | |||
double: distance| | |||
<pre style="margin:0px;">var distance = npc.GetDistanceToObj(25334, 165);</pre> | | |||
Returns distance from npc to specified object. | |||
}} | |||
{{Scripting_api|GetCurrentCoordinates| | |||
* int: npc_ship_id| | |||
vector2: distance| | |||
<pre style="margin:0px;">var coords = npc.GetCurrentCoordinates(25334);</pre> | | |||
Returns current coordinates of NPC. | |||
}} | |||
{{Scripting_api|GetDockedTime| | |||
* int: npc_ship_id| | |||
double: docked_time| | |||
<pre style="margin:0px;">var time = npc.GetDockedTime(25334);</pre> | | |||
}} | |||
{{Scripting_api|GetObstacleOnTheWay| | |||
* int: npc_ship_id | |||
* double: distance| | |||
int: ID of first obstacle on the way of NPC| | |||
<pre style="margin:0px;">var obstacle_id = npc.GetObstacleOnTheWay(25334, 7);</pre> | | |||
}} | |||
{{Scripting_api|GetSystemAsteroidsByDistanceToNPC| | |||
* int: npc_ship_id | |||
* int: limit| | |||
array: IDs of asteroids| | |||
<pre style="margin:0px;">var asteroids = npc.GetSystemAsteroidsByDistanceToNPC(25334, 8);</pre> | | |||
Returns an array of asteroids, which are ordered by distance to NPC (from closest to furthest) | |||
}} | |||
{{Scripting_api|GetShipsInScope| | |||
* int: npc_ship_id| | |||
array: IDs of all ships in scope (int)| | |||
<pre style="margin:0px;">var ships = npc.GetShipsInScope(25334);</pre> | | |||
Returns an array of ships in NPC's scope. | |||
}} | |||
{{Scripting_api|GetCurrentSystemID| | |||
* int: npc_ship_id| | |||
int: current system id| | |||
<pre style="margin:0px;">var sys_id = npc.GetCurrentSystemID(25334);</pre> | | |||
}} | |||
{{Scripting_api|IsOnBase| | |||
* int: npc_ship_id| | |||
bool: whether npc is docked to base right now| | |||
<pre style="margin:0px;">var res = npc.IsOnBase(25334);</pre> | | |||
}} | |||
{{Scripting_api|IsAtBaseEntry| | |||
* int: npc_ship_id | |||
* int: base_id| | |||
bool: whether npc is at base entry point| | |||
<pre style="margin:0px;">var res = npc.IsAtBaseEntry(25334);</pre> | | |||
}} | |||
{{Scripting_api|LeaveBase| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.LeaveBase(25334);</pre> | | |||
NPC undocks from a base. | |||
}} | |||
{{Scripting_api|GetTags| | |||
* int: npc_ship_id| | |||
object: tags - tags of NPC's ship| | |||
<pre style="margin:0px;">var tags = npc.GetTags(25334);</pre> | | |||
}} | |||
{{Scripting_api|SetBehavior| | |||
* int: npc_ship_id | |||
* string: behavior | |||
* objects: parameters| | |||
void| | |||
<pre style="margin:0px;">npc.SetBehavior(25353, "avoid_asteroids", true);</pre> | | |||
Sets behavior of NPC. See more on behaviors in [[VoidExpanse/Behaviors|Behaviors]] section. | |||
}} | |||
{{Scripting_api|SetDecisionsPerSecond| | |||
* int: npc_ship_id | |||
* int: num| | |||
void| | |||
<pre style="margin:0px;">npc.SetDecisionsPerSecond(25444, 15);</pre> | | |||
It affects how often function Decision on AIBehavior will be called. | |||
}} | }} |
Revision as of 08:02, 14 February 2014
Scope npc
Manages NPC bahavior, interactions and parameters.
Visibility: Global.
List of functions
Objectives
CountObjectives | ||
---|---|---|
Arguments | Returns | Example |
|
int: current number of objectives |
var obj = npc.CountObjectives(25334); |
Description | ||
AddObjective | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.AddObjective(25334, "go_to_jumpgate", {jumpgate_id: 15}); |
Description | ||
Adds new objective to npc. All objectives must be implemented in npc's behavior script. NOTE: in object parameters there shouldn't be parameters "name" - it will be overriden by name of objective. |
CleanObjectives | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.CleanObjectives(25334); |
Description | ||
Removes all objectives from npc ship. |
NextObjective | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.NextObjective(25334); |
Description | ||
Moves current objective pointer to next position, removes previous objective. |
GetCurrentObjective | ||
---|---|---|
Arguments | Returns | Example |
|
object:
|
var objective = npc.GetCurrentObjective(25334); |
Description | ||
Gets current npc's objective (or null if none) |
GetCurrentObjectiveTimer | ||
---|---|---|
Arguments | Returns | Example |
|
double: time - how long npc is doing his current objective |
var time = npc.GetCurrentObjectiveTimer(25334); |
Description | ||
NODES
AddNode | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.AddNode(25334, 100, 100); |
Description | ||
Adds a node to npc. NPC can use nodes for patrolling, or for any other reason. |
ClearNodes | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.ClearNodes(25334); |
Description | ||
Removes all nodes from npc. |
GetDistanceToNode | ||
---|---|---|
Arguments | Returns | Example |
|
double: distance_to_node |
var dist = npc.GetDistanceToNode(25334, 1); |
Description | ||
GetNodes | ||
---|---|---|
Arguments | Returns | Example |
|
array of objects:
|
var nodes = npc.GetNodes(25334); |
Description | ||
RemoveNode | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.RemoveNode(25334, 1); |
Description | ||
Removes node from npc nodes. |
FollowRouteToObject | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.FollowRouteToObject(25334, 2535); |
Description | ||
Creates route to object and follow it. |
FollowRouteToBase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.FollowRouteToBase(25334, 2535); |
Description | ||
Creates route to base and follow it. |
StopFollowingRoute | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StopFollowingRoute(25334); |
Description | ||
Stops following current route. |
IsNodeReached | ||
---|---|---|
Arguments | Returns | Example |
|
void |
var res = npc.IsNodeReached(25334, 0); |
Description | ||
Checks if node is reached. |
IsNodeReached | ||
---|---|---|
Arguments | Returns | Example |
|
void |
var res = npc.IsNodeReached(25334, 0); |
Description | ||
Checks if node is reached. |
Battle
Fire | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.Fire(25334, 0); |
Description | ||
Fires from specified slot. |
SetWeaponUsage | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.SetWeaponUsage(25334, "Ray", 2,10, 200); |
Description | ||
Sets weapon usage. It means npc will try to shoot with it's weapons of specified type only on specified distance and will make specified delays between shots. |
Movement
CapSpeed | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.CapSpeed(25334, 2); |
Description | ||
Caps npc's ship speed. |
FaceFromObj | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.FaceFromObj(25334, 235); |
Description | ||
NPC faces from object. |
FaceObj | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.FaceObj(25334, 235); |
Description | ||
NPC faces to object. |
FaceStickPoint | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.FaceStickPoint(25334, 235); |
Description | ||
NPC faces current stick point. |
FaceCoord | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.v(25334, 100, 105); |
Description | ||
NPC faces specified coordinates. |
GoBackward | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.GoBackward(25334); |
Description | ||
GoForward | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.GoForward(25334); |
Description | ||
RotLeft | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.RotLeft(25334); |
Description | ||
RotRight | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.RotRight(25334); |
Description | ||
Stop | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.Stop(25334); |
Description | ||
InstantStop | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.InstantStop(25334); |
Description | ||
StrafeLeft | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StrafeLeft(25334); |
Description | ||
StrafeRight | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StrafeRight(25334); |
Description | ||
StopEvasion | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StopEvasion(25334); |
Description | ||
Turns evasion mode off. Evasion mode is the mode, when npc can avoid attacks with rockets and ballistics by strafing. |
StartEvasion | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StartEvasion(25334); |
Description | ||
Turns evasion mode on. Evasion mode is the mode, when npc can avoid attacks with rockets and ballistics by strafing. |
Locks
FriendlyLockOnTarget | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.FriendlyLockOnTarget(25334, 16); |
Description | ||
Friendly lock is a type of lock, when npc facing it's target, but do not attack. |
GetLockTarget | ||
---|---|---|
Arguments | Returns | Example |
|
int: lock target object ID |
var lockTarget = npc.GetLockTarget(25334); |
Description | ||
Gets current target, on which npc is locked. |
GetStickObject | ||
---|---|---|
Arguments | Returns | Example |
|
int: object_id - current stick object id |
var stickObject = npc.GetStickObject(25334); |
Description | ||
Get current stick object. |
GetFriendlyLockTarget | ||
---|---|---|
Arguments | Returns | Example |
|
int: object_id - current friendly lock target |
var lockTarget = npc.GetFriendlyLockTarget(25334); |
Description | ||
Get current lock target |
IsFriendlyLocked | ||
---|---|---|
Arguments | Returns | Example |
|
bool: is npc friendly locked |
var is_locked = npc.IsFriendlyLocked(25334); |
Description | ||
Returns whether npc is friendly locked. |
IsLocked | ||
---|---|---|
Arguments | Returns | Example |
|
bool: is npc locked on target |
var is_locked = npc.IsLocked(25334); |
Description | ||
Returns whether npc is locked on target. |
Unlock | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.Unlock(25334); |
Description | ||
Unlocks from target or frienly lock target. |
IsStickToPoint | ||
---|---|---|
Arguments | Returns | Example |
|
bool: is_sticked - whether npc is sticked to point |
var res = npc.IsStickToPoint(25334); |
Description | ||
IsStickToObject | ||
---|---|---|
Arguments | Returns | Example |
|
bool: is_sticked - whether npc is sticked to point |
var res = npc.IsStickToObject(25334); |
Description | ||
GetDistanceToStickPoint | ||
---|---|---|
Arguments | Returns | Example |
|
double: distance |
var distance = npc.GetDistanceToStickPoint(25334); |
Description | ||
Returns distance to current stick point. |
GetDistanceToStickObject | ||
---|---|---|
Arguments | Returns | Example |
|
double: distance |
var distance = npc.GetDistanceToStickObject(25334); |
Description | ||
Returns distance to current stick object. |
LockOnTarget | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.LockOnTarget(25334, 25343, 20); |
Description | ||
Locks on target. Npc will automatically unlock, when distance to target object will be more then get_away_dist. |
StickToObject | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StickToObject(25334, 24000, 20); |
Description | ||
Sticks NPC to object. Npc will try to approach sticked object. Will automatically unstick, when distance to object will exceed get_away_dist parameter. |
StickToPoint | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.StickToPoint(25334, 100, 100, 20); |
Description | ||
NPC sticks to specified point. If NPC goes further then get_back_distance, npc will try to get back to stick point. |
Unstick | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.Unstick(25334); |
Description | ||
Unsticks NPC from point or object. |
GetLockedTime | ||
---|---|---|
Arguments | Returns | Example |
|
double: locked_time |
var time = npc.GetLockedTime(25334); |
Description | ||
Returns time, during which NPC is locked on it's current target. |
Interaction
DeviceActivateOnObject | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.DeviceActivateOnObject(25334, "device", 1541); |
Description | ||
NPC tries to activate device on specified target. |
DeviceActivateOnCoords | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.DeviceActivateOnCoords(25334, "device", 100, 100); |
Description | ||
NPC tries to activate device on specified coordinates. |
DeviceActivateOnSelf | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.DeviceActivateOnSelf(25334, "device"); |
Description | ||
NPC tries to activate device on self. |
DeviceDeactivate | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.DeviceDeactivate(25334, "device"); |
Description | ||
Deactivates device. |
EnterBase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.EnterBase(25334, 15); |
Description | ||
Npc enters base (with animation, routine etc.) |
EnterJumpgate | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.EnterJumpgate(25334, 16); |
Description | ||
Npc enters jumpgate (with animation, routine etc.) After entering jumpgate, ship will be destroyed. |
TravelThroughJumpgate | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.TravelThroughJumpgate(25334, 16); |
Description | ||
Npc enters jumpgate (with animation, routine etc.). After travel, ship will actually appear in destination system. |
GetDistanceToObj | ||
---|---|---|
Arguments | Returns | Example |
|
double: distance |
var distance = npc.GetDistanceToObj(25334, 165); |
Description | ||
Returns distance from npc to specified object. |
GetCurrentCoordinates | ||
---|---|---|
Arguments | Returns | Example |
|
vector2: distance |
var coords = npc.GetCurrentCoordinates(25334); |
Description | ||
Returns current coordinates of NPC. |
GetDockedTime | ||
---|---|---|
Arguments | Returns | Example |
|
double: docked_time |
var time = npc.GetDockedTime(25334); |
Description | ||
GetObstacleOnTheWay | ||
---|---|---|
Arguments | Returns | Example |
|
int: ID of first obstacle on the way of NPC |
var obstacle_id = npc.GetObstacleOnTheWay(25334, 7); |
Description | ||
GetSystemAsteroidsByDistanceToNPC | ||
---|---|---|
Arguments | Returns | Example |
|
array: IDs of asteroids |
var asteroids = npc.GetSystemAsteroidsByDistanceToNPC(25334, 8); |
Description | ||
Returns an array of asteroids, which are ordered by distance to NPC (from closest to furthest) |
GetShipsInScope | ||
---|---|---|
Arguments | Returns | Example |
|
array: IDs of all ships in scope (int) |
var ships = npc.GetShipsInScope(25334); |
Description | ||
Returns an array of ships in NPC's scope. |
GetCurrentSystemID | ||
---|---|---|
Arguments | Returns | Example |
|
int: current system id |
var sys_id = npc.GetCurrentSystemID(25334); |
Description | ||
IsOnBase | ||
---|---|---|
Arguments | Returns | Example |
|
bool: whether npc is docked to base right now |
var res = npc.IsOnBase(25334); |
Description | ||
IsAtBaseEntry | ||
---|---|---|
Arguments | Returns | Example |
|
bool: whether npc is at base entry point |
var res = npc.IsAtBaseEntry(25334); |
Description | ||
LeaveBase | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.LeaveBase(25334); |
Description | ||
NPC undocks from a base. |
GetTags | ||
---|---|---|
Arguments | Returns | Example |
|
object: tags - tags of NPC's ship |
var tags = npc.GetTags(25334); |
Description | ||
SetBehavior | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.SetBehavior(25353, "avoid_asteroids", true); |
Description | ||
Sets behavior of NPC. See more on behaviors in Behaviors section. |
SetDecisionsPerSecond | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.SetDecisionsPerSecond(25444, 15); |
Description | ||
It affects how often function Decision on AIBehavior will be called. |