VoidExpanse/scope-npc: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 126: | Line 126: | ||
Stops following current route. | Stops following current route. | ||
}} | }} | ||
{{Scripting_api|IsNodeReached| | {{Scripting_api|IsNodeReached| | ||
Line 543: | Line 534: | ||
Sets behavior of NPC. See more on behaviors in [[VoidExpanse/Behaviors|Behaviors]] section. | Sets behavior of NPC. See more on behaviors in [[VoidExpanse/Behaviors|Behaviors]] section. | ||
}} | }} | ||
{{Scripting_api|RemoveBehavior| | |||
* int: npc_ship_id | |||
* string: behavior| | |||
void| | |||
<pre style="margin:0px;">npc.RemoveBehavior(25353, "avoid_asteroids");</pre> | | |||
Removes behavior of NPC. See more on behaviors in [[VoidExpanse/Behaviors|Behaviors]] section. | |||
}} | |||
{{Scripting_api|ClearBehaviors| | |||
* int: npc_ship_id| | |||
void| | |||
<pre style="margin:0px;">npc.ClearBehaviors(25353);</pre> | | |||
Removes all behaviors from npc. | |||
}} | |||
{{Scripting_api|SetAIScript| | |||
* int: npc_ship_id | |||
* string: AI_script| | |||
void| | |||
<pre style="margin:0px;">npc.SetAIScript(25353, "PirateInWaiting");</pre> | | |||
Sets npc's AI script. | |||
}} | |||
{{Scripting_api|IsInBattleWith| | |||
* int: npc_ship_id | |||
* int: ship_id| | |||
void| | |||
<pre style="margin:0px;">var bEngaged = npc.IsInBattleWith(25353, 52522);</pre> | | |||
Returns whether specified NPC is in battle with specified ship or not. | |||
}} | |||
{{Scripting_api|SetDecisionsPerSecond| | {{Scripting_api|SetDecisionsPerSecond| |
Latest revision as of 08:24, 27 May 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. |
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. |
RemoveBehavior | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.RemoveBehavior(25353, "avoid_asteroids"); |
Description | ||
Removes behavior of NPC. See more on behaviors in Behaviors section. |
ClearBehaviors | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.ClearBehaviors(25353); |
Description | ||
Removes all behaviors from npc. |
SetAIScript | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.SetAIScript(25353, "PirateInWaiting"); |
Description | ||
Sets npc's AI script. |
IsInBattleWith | ||
---|---|---|
Arguments | Returns | Example |
|
void |
var bEngaged = npc.IsInBattleWith(25353, 52522); |
Description | ||
Returns whether specified NPC is in battle with specified ship or not. |
SetDecisionsPerSecond | ||
---|---|---|
Arguments | Returns | Example |
|
void |
npc.SetDecisionsPerSecond(25444, 15); |
Description | ||
It affects how often function Decision on AIBehavior will be called. |