LUA_ヘルプドキュメント

Last-modified: 2020-10-17 (土) 13:40:37

編集時Ver2.4.4.11

 

FromTheDepthsのLua_Helpドキュメントをまとめたもの

 

The Basics

LuaBoxを設置しQキーを押すとLuaEditor画面が開きます
初期の状態では下記の状態になっていて,基本的には-- put your code hereのところにコードを書いていくことになります。

function Update(I)

-- put your code here

end

ココで簡単にプログラムの処理の順番について説明すると,プログラムはコードを上から順番に処理し,(自身で定義した関数は飛ぶ)一番下までいった後function Update(I)の中を繰り返し上から処理していきます。
その処理速度はゲーム内時間で1秒間に40回,つまり1ループを約25msで処理することになります。

 

function Update(I)についている"I"はFTDとLuaがデータをやり取りするのに必要な引数なので自身で関数を定義する場合には必ず入れることをオススメします。(一応,FTDとデータのやり取りが無い場合は省略しても問題ない)
関数とは何ぞや,って人は後述するのでちょっと待ってて

 

LUA Syntax

 

Libraries

FTDのLuaは下記のリンクにある基本的な数学関数などの一部の標準ライブラリとUnityのMathf,Vector3,Quaternionのスクリプトリファレンスを使用する事ができます。
Lua5.2 リファレンスマニュアル http://milkpot.sakura.ne.jp/lua/lua52_manual_ja.html
Unity_Mathf https://docs.unity3d.com/ja/540/ScriptReference/Mathf.html
Unity_Vector3 https://docs.unity3d.com/jp/540/ScriptReference/Vector3.html
Unity_Quaternion https://docs.unity3d.com/ja/540/ScriptReference/Quaternion.html

 

Logging/Debugging

関数in/outデータ型 or 参照説明
I:Log(message)string' .. Int .. float / string「' '」or「" "」の中に文字を入れるとログに表示される。変数や関数はそのまま入れるとその結果が表示される。連結は「..」で行う
I:ClearLogs()ログをクリアする。これが無いとI:Log()の中身が永遠と流れる
I:LogToHud(message)string' .. Int .. float / string「' '」or「" "」の中に文字を入れるとFTD上に表示される。変数や関数はそのまま入れるとその結果が表示される。最大表示は6つまで。LuaEditorを開いていると重くなっていくので注意
 

Fleet Awareness

関数in/outデータ型 or 参照説明
I.FleetIndex/ intFleet内の自身のIndexが返ってくる?初期は0
I.Fleet. FleetInfoFleetInfoで指定した値が返ってくる。指定するときは「.」を間に挟む (例)I.Fleet.ID
I.IsFlagship/ bool自身が旗艦の場合Trueが返ってくる
I.Waypoint/ Vector3自身が旗艦のとき非実体化時の座標.それ以外では旗艦の位置で非実体化した時の自身の座標位置…?艦隊を組むのに使えるかも…?waypointの次の座標が示される?
I.IdealFleetPosition/ Vector3非実体化時の旗艦から見た座標.ローカル座標系.
I.IdealFleetRotation/ Quarternion非実体化時の旗艦からみた姿勢?ローカル座標系?

FleetInfo

クラスin/outデータ型 or 参照説明
ID/ intFleetのIDが返ってくる
Name/ stringFleetの名前が返ってくる
Flagship. FriendlyInfoFleet内の旗艦のFriendlyInfoで指定した値が返ってくる
Members. FriendlyInfoFleet内の旗艦以外のメンバーのFriendlyInfoで指定した値が返ってくる。メンバーは配列([ ])で指定する。(例) I.Fleet.Members[1].Position
 

Resources

関数in/outデータ型 or 参照説明
I.ResourceZones. ResourceZoneInfoフィールドにあるリソースゾーンの中から配列で指定したリソースゾーンのResourceZoneInfoで指定した値が返ってくる。(例)I.ResourceZones[1].Name
I.Resources. ResourceInfoその機体のResourceInfoで指定した値が返ってくる

ResourceZoneInfo

クラスin/outデータ型 or 参照説明
Id/ intリソースゾーンのID
Name/ stringリソースゾーンの名前
Position/ Vector3ワールド座標でのリソースゾーンの位置
Radius/ floatリソースゾーンの半径
Resources. ResourceInfoリソースゾーン内のResourceInfoで指定した値が返ってくる

ResourceInfo

クラスin/outデータ型 or 参照説明
CrystalTotal/ floatクリスタルの現在の保有量だったもの
CrystalMax/ floatクリスタルの最大の保有量だったもの
MetalTotal/ floatメタルの現在の保有量だったもの
MetalMax/ floatメタルの最大の保有量だったもの
NaturalTotal/ floatナチュラルの現在の保有量だったもの。現在ではこれがマテリアルに相当する
NaturalMax/ floatナチュラルの最大の保有量だったもの。現在ではこれがマテリアルに相当する
OilTotal/ floatオイルの現在の保有量だったもの
OilMax/ floatオイルの最大の保有量だったもの
ScrapTotal/ floatスクラップの現在の保有量だったもの
ScrapMax/ floatスクラップの最大の保有量だったもの
 

AI

関数in/outデータ型 or 参照説明
I.AIMode/ string現在のAIの状態が返ってくる。on/off/combatなど v2.4のAI変更でOff/Manual/Fleet/Automaticになった on/off のみ。 v2.4.3.5にて変更
I:GetAIMovementMode(mainframeIndex)/ string現在の移動モードを返す。 Off/Manual/Fleet/Automatic v2.4.3.5にて追加
I:GetAIFiringMode(mainframeIndex)/ string現在の射撃モードを返す。 On/Off v2.4.3.5にて追加
I.ConstructType/ stringAIのタイプが返ってくる。Naval/aerial/fortressなど。v2.4以降ではnoneが返る
I.BlueprintSpawners. BlueprintSpawnerInfoVehicleBlueprintSpawnerのBlueprintSpawnerInfoで指定した値を返す。(例)I.BlueprintSpawners[1].IsSpawning

BlueprintSpawnerInfo

クラスin/outデータ型 or 参照説明
IsSpawning/ boolVehicleBlueprintSpawnerが作動中にtrueを返す
SpawnName/ stringDefaultBlueprintNameに書かれている値が返ってくる
HoldTime/ floatHold for this timeの値が返ってくる.NO limitは1
MaxAllowedActive/ intSpawns to preserveの値が返ってくる
MaxAllowedLifetime/ intMax lifetimes spawnsの値が返ってくる
Spawn()実行するとVehicleBlueprintSpawnerが起動する.(例)I.BlueprintSpawners[1]:Spawn()
 

Propulsion

関数in/outデータ型 or 参照説明
I:TellAiThatWeAreTakingControl()AIによる制御が無効化される。これがない場合AIが指定した値とLua内で指定した全ての値の合計値になる
I:RequestControl(mode,type,drive)int , int , float /指定した各AIモードによる一般的な機動を行う。出力は-1~1の間で調整する
mode : Water=0, Land=1, Air=2.
type : YawLeft=0, YawRight=1, RollLeft=2, RollRight=3, NoseUp=4, NoseDown=5, Increase=6, Decrease=7, MainPropulsion=8
I:RequestThrustControl(type)int /xyz軸方向と回転方向の動きを行う
type : forwards=0, backwards=1, right=2, left=3, up=4, down=5, rollright=6, rollleft=7, yawright=8, yawleft=9, noseup=10, nosedown=11
I:RequestThrustControl(type, scale)int , float /xyz軸方向と回転方向の動きを行う。Sacaleで出力を0~1の間で調整できる
type : forwards=0, backwards=1, right=2, left=3, up=4, down=5, rollright=6, rollleft=7, yawright=8, yawleft=9, noseup=10, nosedown=11
I:RequestWaterForwards(drive)float /プロペラの全後進の出力を-5~5の間で調整できる
I:RequestComplexControllerStimulus(stim)int /指定した値のcomplex controlerを実行する。ACBとの連携などに使える
stim: none=0, T=1, G=2, Y=3, H=4, U=5, J=6, I=7, K=8, O=9, L=10, up=11, down=12, left=13, right=14
I:GetDrive(mode)int / floatWater DriveやAir Driveなどの値を返す
mode : Water=0, Air=1, Primary=2, Secondary=3, Tertiary=4
I:GetInput(mode, type)int , int / float指定したDrive fractionの値を返す
mode : Water=0, Land=1, Air=2
type : YawLeft=0, YawRight=1, RollLeft=2, RollRight=3, NoseUp=4, NoseDown=5, Increase=6, Decrease=7, MainPropulsion=8
I:MoveFortress(Vector3)Vector3 /指定したベクトル方向にフォートレスを動かす
 

TargetInfo

関数in/outデータ型 or 参照説明
I:GetNumberOfMainframes()/ intmainframeの個数を表示
I:GetNumberOfTargets(mainframeIndex)int / int指定したmainframeが認識しているターゲットの数
I:GetTargetInfo(mainframeIndex, targetIndex)int , int /. TargetInfomainframeが認識している指定したターゲットのTargetInfoで指定した値が返ってくる。
TargetPrioritisationCardがある場合は最も優先度が高いターゲットのIndexは0となる
I:GetTargetPositionInfo(mainframeIndex, targetIndex)int , int /. TargetPositionInfomainframeが認識している指定したターゲットのTargetPositionInfoで指定した値が返ってくる。
TargetPrioritisationCardがある場合は最も優先度が高いターゲットのIndexは0となる
I:GetTargetPositionInfoForPosition(mainframeIndex, x,y,z)int , float*3 /. TargetPositionInfo自身と指定した座標のTargetPositionInfoで指定した値が返ってくる

TargetInfo

クラスin/outデータ型 or 参照説明
Valid/ boolターゲットが存在していればTrueが返ってくる
Priority/ int0が一番優先度が高い?
Score/ floatターゲットのTargetPrioritisationCardのスコアが返ってくる
AimPointPosition/ Vector3AIが狙いをつけている座標(索敵依存)
Team/ int敵の所属している勢力のID
Protected/ bool敵のmainframeが存在している場合はTrue?
Position/ Vector3敵のワールド座標での位置
Velocity/ Vector3敵の速度(索敵依存)
PlayerTargetChoice/ boolマップ上でプレイヤーが攻撃するターゲットを選択するとTrueが返ってくる
Id/ int敵のID

TargetPositionInfo

クラスin/outデータ型 or 参照説明
Valid/ boolターゲットが存在していればTrueが返ってくる
Azimuth/ float自分の正面から見たターゲットの水平方向の角度。機体を上から見て反時計回りが正。180~0~-180で示す
Elevation/ float自分の正面から見たターゲットの垂直方向の角度。(ローカル座標のx軸周りでしか見ていないので注意)上向きが正。-180~0~180で示す
ElevationForAltitudeComponentOnly/ floatおそらく2倍すれば自分から見たターゲットの垂直方向の角度を表す関数。上向きが正。-45~0~45で示す
Range/ float自分とターゲットの距離
Direction/ Vector3自分とターゲットの距離。自身の重心から相手のローカル座標の原点までの距離。ワールド座標系
GroundDistance/ float自分とターゲットの距離(高さを考慮しない)
AltitudeAboveSeaLevel/ floatターゲットの海面からの高さ
Position/ Vector3敵のワールド座標での位置
Velocity/ Vector3敵の速度(索敵依存)
 

Misc

関数in/outデータ型 or 参照説明
I:GetTerrainAltitudeForPosition(x,y,z)
I:GetTerrainAltitudeForPosition(Vector3)
float*3 or Vector3 / float指定したワールド座標の地表の高さを示す。海面が0
I:GetTerrainAltitudeForLocalPosition(x,y,z)
I:GetTerrainAltitudeForLocalPosition(Vector3)
float*3 or Vector3 / float自身の座標の地表の高さを示す。x,y,zでオフセット値を指定できる。ローカル座標系
I:GetGravityForAltitude(alt)float / Vector3指定した高度の重力
I:GetTime()/ floatゲームを起動してからの時間。時間の進みは微妙にI:GetGameTime()と異なる。どちらの時間が正確かは不明
I:GetTimeSinceSpawn()/ float機体がスポーンしてからの時間。時間の進みはI:GetTime()と一緒
I:GetGameTime()/ floatゲームを起動してからの時間。メニュー画面を開いた状態でマウスを右画面端に持っていくと出てくるバーに書いてあるGameTimeと同じ
I:GetWindDirectionAndMagnitude()/ Vector3風向きと風速を返す
 

Self awareness

関数in/outデータ型 or 参照説明
I:GetConstructPosition()/ Vector3自分自身のワールド座標。ここで言う座標はブロックを最初に置いた地点を示す。つまりcキーを押したときに出る視点から機体までの距離が0mになるところを示している。ローカル座標の原点
I:GetConstructForwardVector()/ Vector3自身の前方向の成分を長さ1のベクトルで得る。つまり自分の正面がどっち向いてるかを示せる。X:東 Y:真上 Z:北
I:GetConstructRightVector()/ Vector3自身の右方向の成分を長さ1のベクトルで得る
I:GetConstructUpVector()/ Vector3自身の上方向の成分を長さ1のベクトルで得る
I:GetConstructMaxDimensions()/ Vector3ローカル座標上の原点からの自身の正方向の長さ
I:GetConstructMinDimensions()/ Vector3ローカル座標上の原点からの自身の負方向の長さ
I:GetConstructRoll()/ float自身のロール角を示す。反時計回り。0~360で示す
I:GetConstructPitch()/ float自身のピッチ角を示す。下回り。0~360で示す。
I:GetConstructYaw()/ float自身のヨー角を示す。機体を上から見て時計回り。0~360で示す
I:GetConstructCenterOfMass()/ Vector3自身の重心位置をワールド座標で示す
I:GetAiPosition(mainframeIndex)/ Vector3指定したmainframeの位置をワールド座標で示す
I:GetVelocityMagnitude()/ float自身の速度
I:GetForwardsVelocityMagnitude()/ float自身の正面方向の速度
I:GetVelocityVector()/ Vector3自身の速度をベクトル成分で表したもの
I:GetVelocityVectorNormalized()/ Vector3自身の速度を正規化された成分で表したもの
I:GetAngularVelocity()/ Vector3自身のワールド座標上での角速度が分かる。X:東西軸回り Y:上下方軸回り Z:北南軸回り 軸の正の方向から負の方向を見て時計回りが正
I:GetLocalAngularVelocity()/ Vector3自身のローカル座標上での角速度が分かる。X:pitch下が正 Y:yaw機体上方から見て時計が正 Z:roll反時計が正
I:GetAmmoFraction()/ float弾薬の残量を示す。範囲は1~0
I:GetFuelFraction()/ float燃料の残量を示す。範囲は1~0
I:GetSparesFraction()/ floatスペアの残量を示す。今はもう使えない。範囲は1~0
I:GetEnergyFraction()/ floatバッテリーの残量を示す。範囲は1~0
I:GetPowerFraction()/ float出力の残量を示す。範囲は1~0
I:GetElectricPowerFraction()/ float電気エンジンの出力の残量を示す。範囲は1~0
I:GetHealthFraction()/ float自身の残り体力を示す。範囲は1~0
I:IsDocked()/ boolドッキングしている場合Trueを返す
I:GetHealthFractionDifference(time)/ float指定した時間内に体力がどれほど変化したかを示す。ただ動きが怪しい
I:GetBlueprintName()/ stringブループリントの名前を返す
I:GetUniqueId()/ intユニークIDを返す
 

Components

関数in/outデータ型 or 参照説明
I:Component_GetCount(type)int / int指定したパーツがいくつあるか
I:Component_GetLocalPosition(type,index)int , int / Vector3指定したパーツのローカル座標
I:Component_GetBlockInfo(type,index)int , int /. BlockInfo指定したパーツのBlockInfoの値が返ってくる
I:Component_GetBoolLogic(type,index)int , int / bool指定したパーツのboolの値(true/false)が返ってくる
I:Component_GetBoolLogic_1(type, blockIndex, propertyIndex)int , int , int / bool指定したパーツ、属性のboolの値(true/false)が返ってくる
I:Component_SetBoolLogic(type,index,bool)int , int , bool /指定したパーツにtrue/falseの指示を与える
I:Component_SetBoolLogic_1(type, blockIndex, propertyIndex1, bool1)int , int , int , bool /指定したパーツ、属性にtrue/falseの指示を与える
I:Component_SetBoolLogic_2(type, blockIndex, propertyIndex1, bool1, propertyIndex2, bool2)int , int , int , bool , int , bool /指定したパーツ、属性にtrue/falseの指示を与える。二つの属性を同時に設定できる
I:Component_SetBoolLogic_3(type, blockIndex, propertyIndex1, bool1, propertyIndex2, bool2, propertyIndex3, bool3)int , int , int , bool , int , bool , int , bool /指定したパーツ、属性にtrue/falseの指示を与える。三つの属性を同時に設定できる
I:Component_GetFloatLogic(type,index)int , int / float指定したパーツのfloatの値が返ってくる
I:Component_GetFloatLogic_1(type, blockIndex, propertyIndex)int , int , int / float指定したパーツ、属性のfloatの値が返ってくる
I:Component_SetFloatLogic(type,index,float)int , int , float /指定したパーツにfloatの値を指定する
I:Component_SetFloatLogic_1(type, blockIndex, propertyIndex1, float1)int , int , int , float /指定したパーツ、属性にfloatの値を指定する
I:Component_SetFloatLogic_2(type, blockIndex, propertyIndex1, float1, propertyIndex2, float2)int , int , int , float , int , float /指定したパーツ、属性にfloatの値を指定する。二つの属性を同時に設定できる
I:Component_SetFloatLogic_3(type, blockIndex, propertyIndex1, float1, propertyIndex2, float2, propertyIndex3, float3)int , int , int , float , int , float , int , float /指定したパーツ、属性にfloatの値を指定する。三つの属性を同時に設定できる
I:Component_GetIntLogic(type,index)int , int / int指定したパーツのintの値が返ってくる
I:Component_GetIntLogic_1(type, blockIndex, propertyIndex)int , int , int / int指定したパーツ、属性のintの値が返ってくる
I:Component_SetIntLogic(type,index,integer)int , int , int /指定したパーツにintの値を指定する
I:Component_SetIntLogic_1(type, blockIndex, propertyIndex1, int1)int , int , int , int /指定したパーツ、属性にintの値を指定する
I:Component_SetIntLogic_2(type, blockIndex, propertyIndex1, int1, propertyIndex2, int2)int , int , int , int , int , int /指定したパーツ、属性にintの値を指定する。二つの属性を同時に設定できる
I:Component_SetIntLogic_3(type, blockIndex, propertyIndex1, int1, propertyIndex2, int2, propertyIndex3, int3)int , int , int , int , int , int , int , int /指定したパーツ、属性にintの値を指定する。三つの属性を同時に設定できる
I:Component_SetBoolLogicAll(type, bool)int , bool /指定した種類のパーツ全てにtrue/falseを指定する
I:Component_SetBoolLogicAll_1(type, propertyIndex1, bool1)int , int , bool /指定した種類のパーツ、属性全てにtrue/falseを指定する
I:Component_SetBoolLogicAll_2(type, propertyIndex1, bool1, propertyIndex2, bool2)int , int , bool , int , bool /指定した種類のパーツ、属性全てにtrue/falseを指定する。二つの属性を同時に設定できる
I:Component_SetBoolLogicAll_3(type, propertyIndex1, bool1, propertyIndex2, bool2, propertyIndex3, bool3)int , int , bool , int , bool , int , bool /指定した種類のパーツ、属性全てにtrue/falseを指定する。三つの属性を同時に設定できる
I:Component_SetFloatLogicAll(type, float)int , float /指定した種類のパーツ全てにfloatの値を指定する
I:Component_SetFloatLogicAll_1(type, propertyIndex1, float1)int , int , float /指定した種類のパーツ、属性全てにfloatの値を指定する
I:Component_SetFloatLogicAll_2(type, propertyIndex1, float1, propertyIndex2, float2)int , int , float , int , float /指定した種類のパーツ、属性全てにfloatの値を指定する。二つの属性を同時に設定できる
I:Component_SetFloatLogicAll_3(type, propertyIndex1, float1, propertyIndex2, float2, propertyIndex3, float3)int , int , float , int , float , int , float /指定した種類のパーツ、属性全てにfloatの値を指定する。三つの属性を同時に設定できる
I:Component_SetIntLogicAll(type, int)int , int /指定した種類のパーツ全てにintの値を指定する
I:Component_SetIntLogicAll_1(type, propertyIndex1, int1)int , int , int /指定した種類のパーツ、属性全てにintの値を指定する
I:Component_SetIntLogicAll_2(type, propertyIndex1, int1, propertyIndex2, int2)int , int , int , int , int /指定した種類のパーツ、属性全てにintの値を指定する。二つの属性を同時に設定できる
I:Component_SetIntLogicAll_3(type, propertyIndex1, int1, propertyIndex2, int2, propertyIndex3, int3)int , int , int , int , int , int , int /指定した種類のパーツ、属性全てにintの値を指定する。三つの属性を同時に設定できる
I:SetHologramProjectorURL(index, url)int , string /指定したプロジェクターのURLを設定する
I:SetPosterHolderURL(index, url)int , string /指定したポスターホルダーのURLを設定する
I:DeployAllBalloons()全てのバルーン展開
I:SeverAllBalloons()全てのバルーンを開放

components type and their logic

タイプデータ型 属性番号get/set説明
0:balloon deployerbool 0getバルーンが展開されているかどうか
settrueでバルーンの展開、falseで切り離し
1:drive maintainerint 0get/setdrive maintainerのチャンネル
0 = Primary, 1=Secondary, 2=Tertiary
float 0get/set出力の調整ができる。範囲は-1~1。drive maintainerブロックが必要
2:air pumpbool 0get浮力が0ならばfalse、0より大きければtrueを返す
setfalseで浮力を0に、trueで浮力を1に設定する
float 0get/set浮力の調整を0~1の範囲で行える
float 1get浸水の度合いを返す。範囲は0~1
3:resource gatherer
(現:material gatherer)
bool 0get/settrueでon/falseでoff
4:oil drillbool 0get/settrueでon/falseでoff
5:ammo processorbool 0get/settrueでon/falseでoff
6:oil refinerybool 0get/settrueでon/falseでoff
float 0get危険ガスの度合いを返す。範囲は0~100
float 1get精製効率を返す
float 2get精製時間を返す
7:tractor beamsbool 0get/settrueでon/falseでoff。tractor beamsとはdocking stationのこと
int 0get選択されているビークルのユニークIDを返す。何も選択されていない場合は-1を返す
set当該ユニークIDのビークルを選択する
float 0get/setビークルを固定する距離
float 1get/setビークルを固定する水平方向の角度。範囲は-90~90
float 2get/setビークルを固定する垂直方向の角度。範囲は-90~90
8:hydrofoilsfloat 0get/set角度を調整できる。範囲は-45~45
9:propulsionfloat 0get/setスラスター類のdrive fractionを調整ができる。範囲は0~1
float 1get現在のフレームのpropulsion requestの値を返す
setpropulsion requestに値を加算する
float 2get前回のフレームのpropulsion requestの値を返す
float 3get最大の出力(force)を返す
10:shield projectorbool 0getシールドが機能しているかどうか
int 0get/setシールドのタイプを変更できる。
off=0, disrupt=1, reflect=2, laser absorb=3
float 0get/set強度
float 1get/set水平方向の角度
float 2get/set垂直方向の角度
float 3get/set距離
float 4get/set
float 5get/set高さ
float 6get/set色の設定:透明度
float 7get/set色の設定:赤
float 8get/set色の設定:緑
float 9get/set色の設定:青
11:helium pumpbool 0get浮力が0ならばfalse、0より大きければtrueを返す
setfalseで浮力を0に、trueで浮力を1に設定する
float 0get/set浮力の調整を0~1の範囲で行える
float 1get漏出の度合いを返す。範囲は0~1
12:spotlightfloat 0get/set光の広がる角度
float 1get/set水平方向の角度
float 2get/set垂直方向の角度
float 3get/set光の強さ
float 4get/set距離
float 5get/set色の設定:赤
float 6get/set色の設定:緑
float 7get/set色の設定:青
13:advanced cannon laser targetterint 0get装着されているadvanced cannonのweapon indexを返す。装着されてない場合は-1を返す
float 0get/set時限信管の時間
float 1get高度信管の最低高度を返す
set高度信管の高度を設定
float 2get高度信管の最高高度
14:CRAM cannon laser targetterint 0get装着されているCRAM cannonのweapon indexを返す。装着されてない場合は-1を返す
float 0get/set時限信管の時間
float 1get高度信管の最低高度を返す
set高度信管の高度を設定
float 2get高度信管の最高高度
15:warp drivebool 0getチャージ中かどうか
int 0setワープドライブの状態
0=チャージを開始, 1=ワープする
float 0get右方向ワープ距離
float 1get上方向ワープ距離
float 2get前方向ワープ距離
float 3getビークルサイズとwarp rodの長さに基づく、右方向ワープ係数
float 4get上方向ワープ係数
float 5get前方向ワープ係数
float 6getwarp chargerの長さ
float 7getチャージ時間
16:particle cannon lensint 0get装着されているparticle cannonのweapon indexを返す。装着されてない場合は-1を返す
17:steam boiler controllerfloat 0get/set燃焼率の設定。範囲は0~1
float 1get接続されているボイラーの体積
float 2get接続されているボイラーの圧力
18:fuel engine generatorfloat 0get/set最大出力の設定。範囲は0~1
float 1get/setバッテリー充填度合いの設定。範囲は0~1
float 2get現在の出力度合い。範囲は0~1
float 3get推測最大エンジンパワー
float 4get1秒あたりの燃料消費量
19:sail main blockint 0get帆の種類を返す。0=三角帆, 1=四角帆
float 0get/set垂直方向(マスト)のウィンチの設定
float 1get/set水平方向(ブーム)のウィンチの設定
float 2get垂直方向(マスト)の高さ
float 3get水平方向(ブーム)の長さ
20:advanced cannon ammo intakeint 0get関連付けられたAmmo ControllerのユニークIDを返す。関連付けられてない場合は-1を返す
setユニークIDでAmmo Controllerを選択する
int 1get関連付けられたAmmo Controllerのcomponent indexを返す。関連付けられてない場合は-1を返す
setcomponent indexでAmmo Controllerを選択する
int 2get装着されているadvanced cannonのweapon indexを返す。装着されてない場合は-1を返す
21:advanced cannon ammo controllerint 0getユニークIDを返す
22:AI wireless transmitterint 0get/setチャンネルの設定
23:AI wireless receiverint 0get/setチャンネルの設定
24:AI aimpoint selection cardint 0get/set照準目標の設定。0=ランダム, 1=AIメインフレームと弾薬
float 0get/set照準目標の再設定時間
25:detection componentbool 0get/settrueでon/falseでoff
26:AI mainframeint 0get/setAIモードの設定
0=off, 1=on, 2=combat, 4=patrol, 5=fleetmove
27:laser colorerfloat 0get/set色の設定:赤
float 1get/set色の設定:緑
float 2get/set色の設定:青
28:laser missile defencefloat 0get/set色の設定:赤
float 1get/set色の設定:緑
float 2get/set色の設定:青
29:particle cannonfloat 0get/set色の設定:赤
float 1get/set色の設定:緑
float 2get/set色の設定:青
30:light fittingfloat 0get/set光の強さ
float 1get/set距離
float 2get/set色の設定:赤
float 3get/set色の設定:緑
float 4get/set色の設定:青
31:simple laserfloat 0get/set色の設定:赤
float 1get/set色の設定:緑
float 2get/set色の設定:青
32:smoke generatorfloat 0get/set粒子の放出速度
float 1get/set粒子の大きさ
float 2get/set色の設定:赤
float 3get/set色の設定:緑
float 4get/set色の設定:青
33:hologram projectorbool 0get/settrueでon/falseでoff
bool 1get/set画像を反転させるかどうか
float 0get/set
float 1get/set高さ
float 2get/set距離
float 3get/set水平方向のずれ
float 4get/set垂直方向のずれ
float 5get/set水平方向の角度
float 6get/set垂直方向の角度
float 7get/set回転角
34:poster holderfloat 0get/set
float 1get/set高さ
35:electric enginefloat 0get/set出力の設定。範囲は0~1

BlockInfo

クラスin/outデータ型 or 参照説明
Valid/ bool存在している場合trueが返ってくる
Position/ Vector3ブロックのワールド座標での位置
LocalPosition/ Vector3ブロックのローカル座標での位置
LocalPositionRelativeToCom/ Vector3重心を原点としたローカル座標での位置
Forwards/ Vector3ブロックの正面方向がワールド座標でどこを向いているか
LocalForwards/ Vector3ブロックの正面方向がローカル座標でどこを向いているか
Rotation/ Quaternionワールド座標におけるブロックの姿勢
LocalRotation/ Quaternionローカル座標におけるブロックの姿勢
SubConstructIdentifier/ intブロックが所属するサブオブジェクトのIDを返す
CustomName/ stringブロックに命名された名前を返す
 

Weapons

※旧式と書かれている命令は古いバージョンで書かれたコードの互換性維持のために残されているもので、多重サブオブジェクトに対応していません。

関数in/outデータ型 or 参照説明
I:GetWeaponCount()int /兵器がいくつあるか。ターレットも兵器の一つとして数えられる(サブオブジェクト上の兵器は数えられない)
I:GetWeaponInfo(weaponIndex)int /. WeaponInfo指定した兵器のWeaponInfoテーブルが返ってくる
I:GetWeaponConstraints(weaponIndex)int /. WeaponConstraints指定した兵器のWeaponConstraintsテーブルが返ってくる
I:GetWeaponBlockInfo(weaponIndex)int /. BlockInfo指定した兵器のBlockInfoテーブルが返ってくる
I:AimWeaponInDirection(weaponIndex, x,y,z, weaponSlot)int , float*3 , int / int指定した兵器を指定した座標に向ける。座標はワールド座標系。ただし、原点は兵器(ターレット)なので注意。狙った先に敵が居る場合1が出力される。Log()内でも兵器が追従するため注意
I:FireWeapon(weaponIndex, weaponSlot)int , int / bool指定した兵器(ターレット)で攻撃する。発射できたかどうかが返ってくる
I:GetTurretSpinnerCount() - 旧式/ intターレットとスピンブロックの数が返ってくる
I:GetWeaponCountOnTurretOrSpinner(turretSpinnerIndex) - 旧式
代替関数:'GetWeaponCountOnSubConstruct'
int / int指定したターレットとスピンブロック上の兵器の数が返ってくる
I:GetWeaponInfoOnTurretOrSpinner(turretSpinnerIndex, weaponIndex) - 旧式
代替関数:'GetWeaponInfoOnSubConstruct'
int , int /. WeaponInfo指定ターレット,スピンブロック上の指定した兵器についてWeaponInfoで指定した値が返ってくる
I:AimWeaponInDirectionOnTurretOrSpinner(turretSpinnerIndex,weaponIndex,x,y,z,weaponSlot) - 旧式
代替関数:'AimWeaponInDirectionOnSubConstruct'
int , int , float*3 , int / int指定ターレット,スピンブロック上の指定した兵器について攻撃する座標を指定する。詳細はAimWeaponInDirection。ただし、ターレットは追従してくれない
I:FireWeaponOnTurretOrSpinner(turretSpinnerIndex,weaponIndex,weaponSlot) - 旧式
代替関数:'FireWeaponOnSubConstruct'
int , int , int / bool指定ターレット,スピンブロック上の指定した兵器で攻撃する。発射できたかどうかが返ってくる
I:GetWeaponCountOnSubConstruct(SubConstructIdentifier)int / int指定したサブオブジェクト上の兵器の数が返ってくる
I:GetWeaponInfoOnSubConstruct(SubConstructIdentifier, weaponIndex)int , int /. WeaponInfo指定サブオブジェクト上の指定した兵器のWeaponInfoテーブルが返ってくる
I:GetWeaponConstraintsOnSubConstruct(SubConstructIdentifier, weaponIndex)int , int /. WeaponConstraints指定サブオブジェクト上の指定した兵器のWeaponConstraintsテーブルが返ってくる
I:GetWeaponBlockInfoOnSubConstruct(SubConstructIdentifier, weaponIndex)int , int /. BlockInfo指定サブオブジェクト上の指定した兵器のBlockInfoテーブルが返ってくる
I:AimWeaponInDirectionOnSubConstruct(SubConstructIdentifier,weaponIndex,x,y,z,weaponSlot)int , int , float*3 , int / int指定サブオブジェクト上の指定した兵器について攻撃する座標を指定する。詳細はAimWeaponInDirection。ただし、ターレットは追従してくれない
I:FireWeaponOnSubConstruct(SubConstructIdentifier,weaponIndex,weaponSlot)int , int , int / bool指定サブオブジェクト上の指定した兵器で攻撃する。発射できたかどうかが返ってくる

WeaponInfo

クラスin/outデータ型 or 参照説明
Valid/ bool兵器が存在していればtrueが返ってくる
LocalPosition/ Vector3兵器のローカル座標を示す(ターレットは返さない模様)
GlobalPosition/ Vector3兵器のワールド座標を示す
LocalFirePoint/ Vector3弾やレーザーの発生位置のローカル座標を示す
GlobalFirePoint/ Vector3弾やレーザーの発生位置のワールド座標を示す
Speed/ float兵器のおおよその弾速
CurrentDirection/ Vector3兵器の向きをワールド座標で示す。正規化されている
WeaponType/ int兵器の種類
WeaponSlot/ int兵器のウェポンスロットで指定した値が変えてくる
PlayerCurrentlyControllingIt/ booltrueならプレイヤーが操作中
 

WeaponConstraints

クラスin/outデータ型 or 参照説明
Valid/ bool兵器が存在していればtrueが返ってくる
MinAzimuth/ floatMinAzimuthの値(水平方向の射角制限)を返す
MaxAzimuth/ floatMaxAzimuthの値(水平方向の射角制限)を返す
MinElevation/ floatMinElevationの値(垂直方向の射角制限)を返す
MaxElevation/ floatMaxElevationの値(垂直方向の射角制限)を返す
FlipAzimuth/ bool'Flip azimuth constraints'(水平方向の射角制限を反転する)ボタンが有効かどうか
IsParentConstructSpace/ bool'Set the restrictions in the parent construct space'(ローカル座標で射角制限する)ボタンが有効かどうか
 

Missile Warning

※旧式と書かれている命令は古いバージョンで書かれたコードの互換性維持のために残されている。

関数in/outデータ型 or 参照説明
I:GetNumberOfWarnings()/int捕捉したミサイルの数
I:GetMissileWarning(missileIndex)int /. MissileWarningInfo指定したミサイルがMissileWarningInfoとして返ってくる
I:GetNumberOfWarnings(mainframeIndex) - 旧式int / int指定したmainframeが捕捉したミサイルの数。v2.9.3以降、捕捉したミサイルはmainframe間で共有されるのでmainframeIndexの指定は無意味となった
I:GetMissileWarning(mainframeIndex, missileIndex) - 旧式int , int /. MissileWarningInfo指定したミサイルがMissileWarningInfoとして返ってくる。v2.9.3以降、捕捉したミサイルはmainframe間で共有されるのでmainframeIndexの指定は無意味となった

MissileWarningInfo

クラスin/outデータ型 or 参照説明
Valid/ boolミサイルが存在しているか
Position/ Vector3ワールド座標でのミサイルの位置
Velocity/ Vector3ミサイルの速度。ワールド座標系
Range/ float自身とミサイルとの距離
Azimuth/ float自分の正面から見たミサイルの水平方向の角度。機体を上からみて時計回りが正。-180~0~180で示す
Elevation/ float自分の正面から見たミサイルの垂直方向の角度。下向きが正。-180~0~180で示す
TimeSinceLaunch/ floatミサイルが発射されてからの時間
Id/ intミサイルのID
 

MissileGuidance

関数in/outデータ型 or 参照説明
I:GetLuaTransceiverCount()/ intLuaTransceiverの数を得る
I:GetLuaControlledMissileCount(luaTransceiverIndex)int / int指定したLuaTransceiverが制御しているミサイルの数を得る
I:GetLuaTransceiverInfo(luaTransceiverIndex)int /. BlockInfo指定したLuaTransceiverが設置されたMissileLauncherのBlockInfoを得る。MissileLauncher以外に設置された場合はLuaTransceiver自体のBlockInfoを得る
I:GetLuaControlledMissileInfo(luaTransceiverIndex,missileIndex)int , int /. MissileWarningInfo指定したLuaTransceiverが制御している指定したミサイルのMissileWarningInfoの情報を得る
I:SetLuaControlledMissileAimPoint(luaTransceiverIndex,missileIndex,x,y,z)int , int , float*3 /ミサイルの誘導位置をワールド座標で指定する。
I:DetonateLuaControlledMissile(luaTransceiverIndex,missileIndex)int , int /指定したLuaTransceiverが制御している指定したミサイルを起爆する
I:IsLuaControlledMissileAnInterceptor(luaTransceiverIndex,missileIndex)int , int / bool指定したLuaTransceiverが制御している指定したミサイルにミサイル迎撃能力がある場合true
I:SetLuaControlledMissileInterceptorTarget(luaTransceiverIndex,missileIndex,mainframeIndex, targetIndex)int , int , int , int /LuaTransceiverで制御しているミサイルにmainframeで補足している指定したミサイルを迎撃させる(missileinterceptorの機能)。自分で誘導する場合はI:SetLuaControlledMissileInterceptorStandardGuidanceOnOffで誘導を切ること
I:SetLuaControlledMissileInterceptorStandardGuidanceOnOff(luaTranceiver,missileIndex, onOff)int , int , bool /ミサイルの標準誘導のON/OFFを切り替える。
 

SpinBlocks and pistons

関数in/outデータ型 or 参照説明
I:SetSpinBlockSpeedFactor(SubConstructIdentifier,speedFactor)int , float /指定したSpinBlockのDrive fractionを調整する。範囲は0~1
I:SetSpinBlockPowerDrive(SubConstructIdentifier,drive)int , float /指定したSpinBlockのMotor Driveを調整する。範囲は0~10
I:SetSpinBlockRotationAngle(SubConstructIdentifier, angle)int , float /指定したSpinBlockの角度を指定する
I:SetSpinBlockContinuousSpeed(SubConstructIdentifier, speed)int , float /指定したSpinBlockの回転速度を指定する。範囲は-30~30
I:SetSpinBlockInstaSpin(SubConstructIdentifier,magnitudeAndDirection)int , float /指定したSpinBlockをInstaSpinさせる。1で正方向、-1で負方向に最高速度で回る
I:GetPistonExtension(SubConstructIdentifier)int / float指定したPistonのExtension(伸長)を返す。存在しない場合は-1を返す
I:GetPistonVelocity(SubConstructIdentifier)int / float指定したPistonのVelocity(速度)を返す。存在しない場合は-1を返す
I:SetPistonExtension(SubConstructIdentifier,ExtensionDistance)int , float /指定したPistonのExtension(伸長)を調整する。単位はメートル(m)
I:SetPistonVelocity(SubConstructIdentifier,ExtensionVelocity)int , float /指定したPistonのVelocity(速度)を調整する。単位はメートル毎秒(m/s)、範囲は0.1~2
 

※ヘリブレードスピナーはサブオブジェクトとは異なるインデックスを持っていることに注意

関数in/outデータ型 or 参照説明
I:GetDedibladeCount()/ intDedibladeの数を得る
I:GetDedibladeInfo(DedibladeIndex)int /. BlockInfo指定したDedibladeのBlockInfoの情報を得る
I:IsDedibladeOnHull(DedibladeIndex)int / bool指定したDedibladeが船体に乗っている場合trueが得られる。サブオブジェクト上に乗っている場合はfalse
I:SetDedibladeSpeedFactor(DedibladeIndex,speedFactor)int , float /指定したDedibladeのDrive fractionを調整する。範囲は0~1
I:SetDedibladePowerDrive(DedibladeIndex,drive)int , float /指定したDedibladeのMotor Driveを調整する。範囲は0~10
I:SetDedibladeContinuousSpeed(DedibladeIndex, speed)int , float /指定したDedibladeの回転速度を指定する。範囲は-30~30
I:SetDedibladeInstaSpin(DedibladeIndex,magnitudeAndDirection)int , float /指定したDedibladeをInstaSpinさせる。1で正方向、-1で負方向に最高速度で回る
I:SetDedibladeUpFraction(DedibladeIndex,upFraction)int , float /指定したDedibladeのAlways up fractionを調整する。範囲は0~1
 

※以下旧式化した命令群

関数in/outデータ型 or 参照説明
I:GetSpinnerCount() - 旧式/ intSpinBlockの数(helispinnerを含む)を得る
I:GetSpinnerInfo(index) - 旧式int /. BlockInfo指定したSpinBlockのBlockInfoの情報を得る
I:SetSpinnerSpeedFactor(index,speedFactor) - 旧式int , float /指定したSpinBlockのDrive fractionを調整する。範囲は0~1
I:SetSpinnerPowerDrive(index,drive) - 旧式int , float /指定したSpinBlockのMotor Driveを調整する。範囲は0~10
I:SetSpinnerRotationAngle(index, angle) - 旧式int , float /指定したSpinBlockの角度を指定する
I:SetSpinnerContinuousSpeed(index, speed) - 旧式int , float /指定したSpinBlockの回転速度を指定する。範囲は-30~30
I:SetSpinnerInstaSpin(index,magnitudeAndDirection) - 旧式int , float /指定したSpinBlockをInstaSpinさせる。1で正方向、-1で負方向に最高速度で回る
I:IsSpinnerDedicatedHelispinner(index) - 旧式int / bool指定したSpinBlockがhelispinnerだった場合trueが得られる
I:IsSpinnerOnHull(index) - 旧式
代替関数:'IsDediBladeOnHull' または 'IsSubConstructOnHull'
int / bool指定したSpinBlock(helispinner)が船体に乗っている場合trueが得られる。SpinBlock上に乗っている場合はfalse
I:SetDedicatedHelispinnerUpFraction(index,upFraction) - 旧式
代替関数:'SetDedibladeUpFraction'
int , float /指定したSpinBlock(helispinner)のAlways up fractionを調整する。範囲は0~1
 

SubConstructs

関数in/outデータ型 or 参照説明
I:GetAllSubConstructs()/ int[]すべてのサブオブジェクトのインデックスをテーブルで返す
I:GetAllSubConstructChildren(SubConstructIdentifier)int / int[]指定したサブオブジェクト上に直接置かれている子サブオブジェクトのインデックスをテーブルで返す(孫サブオブジェクトは含まれない)
I:GetParent(SubConstructIdentifier)int / int指定したサブオブジェクトの親サブオブジェクトのインデックスを返す(船体の場合0、取得できない場合-1が返る)
I:IsTurret(SubConstructIdentifier)int / bool指定したサブオブジェクトがターレットならTrue、そうでないならFalseを返す
I:IsSpinBlock(SubConstructIdentifier)int / bool指定したサブオブジェクトがスピンブロックならTrue、そうでないならFalseを返す
I:IsPiston(SubConstructIdentifier)int / bool指定したサブオブジェクトがピストンならTrue、そうでないならFalseを返す
I:IsAlive(SubConstructIdentifier)int / bool指定したサブオブジェクトが破壊されていないならTrue、破壊されていればFalseを返す
I:IsSubConstructOnHull(SubConstructIdentifier)int / bool指定したサブオブジェクトが船体に乗っている場合trueが得られる。サブオブジェクト上に乗っている場合はfalse
I:GetSubConstructInfo(SubConstructIdentifier)int /. BlockInfo指定したサブオブジェクトのBlockInfoの情報を得る
I:GetSubConstructIdleRotation(SubConstructIdentifier)int / Quaternion指定したサブオブジェクトの回転度を返す
 

Friendlies

関数in/outデータ型 or 参照説明
I:GetFriendlyCount()/ int友軍の数を得られる
I:GetFriendlyInfo(index)int /. FriendlyInfoIndexで指定した友軍についてFriendlyInfoで指定した値が得られる
I:GetFriendlyInfoById(Id)int /. FriendlyInfoIDで指定した友軍についてFriendlyInfoで指定した値が得られる

FriendlyInfo

クラスin/outデータ型 or 参照説明
Valid/ bool友軍が存在するか
Rotation/ Quaternionワールド座標における友軍の姿勢
ReferencePosition/ Vector3友軍のワールド座標を示す
PositiveSize/ Vector3友軍のローカル座標上の原点からの自身の正方向の長さ
NegativeSize/ Vector3友軍のローカル座標上の原点からの自身の負方向の長さ
CenterOfMass/ Vector3友軍の重心位置のワールド座標
Velocity/ Vector3友軍の速度ベクトル
UpVector/ Vector3友軍の上方向の成分を長さ1のベクトルで得る。つまり友軍の上面がどこを向いているのかワールド座標系で示されている
RightVector/ Vector3友軍の右方向の成分を長さ1のベクトルで得る。
ForwardVector/ Vector3友軍の前方向の成分を長さ1のベクトルで得る。
HealthFraction/ float友軍の残りの体力を示す。範囲は1~0
SparesFraction/ float友軍のスペアを示す。今は無きもの
AmmoFraction/ float友軍の弾薬の残量を示す。範囲は1~0。存在しない場合は1。
FuelFraction/ float友軍の燃料の残量を示す。範囲は1~0。存在しない場合は1。
EnergyFraction/ float友軍のバッテリーの残量を示す。範囲は1~0。存在しない場合は1。
PowerFraction/ float友軍の出力の残量を示す。範囲は1~0。存在しない場合は1。
ElectricPowerFraction/ float友軍の電気エンジンの出力の残量を示す。範囲は1~0。存在しない場合は1。
AxisAlignedBoundingBoxMinimum/ Vector3ワールド座標軸に沿った友軍機の寸法の最小値
AxisAlignedBoundingBoxMaximum/ Vector3ワールド座標軸に沿った友軍機の寸法の最大値
BlueprintName/ string友軍の名前
Id/ int友軍のID
FleetId/ int友軍の所属しているFleetのID
Type/ intVehicleは2,Fortressは1,Structureと存在していない場合は0を返す.
 

Math and Other

関数in/outデータ型 or 参照説明
I:Maths_AngleBetweenVectors(x1,y1,z1,x2,y2,z2)float*3 or Vector3 / float2つのベクトルの角度を表示する(鋭角)
I:QuaternionToEulerAngles(Quaternion)Quaternion / Vector3クウォータニオンからベクトル成分(オイラー角)に変換
I:Maths_CreateQuaternion(forward,up)Vector3 / Quaternion2つのベクトルからクウォータニオンを生成
I:Maths_CreateVector3(x,y,z)float*3 / Vector33つの値からVector3を生成
I:Maths_RotateVector3(Vector3,Quaternion)Vector3 , Quaternion / Vector3クウォータニオンを使用しベクトルを回転させる
I:Crash()任意にLuaを強制終了させる

コメント

  • 取り敢えずExcelからそのまま引っ張ってきた -- カサッカ? 2017-06-16 (金) 02:28:58
    • おお・・・あさずあざす・・・!Luaはさっぱりなので他の方にお願いするしかにぃ0(:3 )~_(:3 」∠ )_ -- 管理人/びんせんとー? 2017-06-23 (金) 19:56:44
  • v2.1devTestで追加された命令を追記しました。安定版の方にはきていないのでとりあえず折りたたみ。 -- 2017-12-07 (木) 16:00:06
    • グッジョブです! ありがとうございます! -- カサッカ? 2018-01-04 (木) 22:04:10
  • PlayerCurrentlyControllinglt は PlayerCurrentlyControllingIt でしょうか?後ろから2文字目が小文字のLなのか、大文字のIなのか -- 2018-02-03 (土) 12:13:05
    • 大文字の"I" ですな。ゲーム内のフォントが区別つきにくいから、読み間違えたのかも -- 2018-02-03 (土) 18:03:55
  • PowerFractionとElectricPowerFractionを追加 -- ? 2019-04-30 (火) 13:30:53
  • GPPIDのFakeSetPointの値を設定する方法を探しているんですけど、現状無理なのでしょうか…?別ブロック経由とかも考えてみたんですが、手段を見つけられない -- FTD素人? 2020-08-16 (日) 23:55:42