logoHourGlass
Battle.ActionSelect

Battle.ActionSelect

Battle.ActionSelect(CharIndex, com1, com2, com3)

函數功能

讓對象執行指定的戰鬥操作,必須在對象Battle.IsWaitingCommand(index)返回值爲1時纔可以有效使用。

參數說明

返回值

0 失敗, 1 成功

com1 參數說明

通常表示戰鬥的動作,可選以下參數使用:

  • %戰鬥指令_無% 什麼也不做
  • %戰鬥指令_防禦% 防禦
  • %戰鬥指令_攻擊% 攻擊
  • %戰鬥指令_位置% 切換位置
  • %戰鬥指令_逃跑% 逃跑
  • %戰鬥指令_精靈變身% 精靈變身
  • 戰鬥技能參數,如 %TECH_SpiracleShot% 表示施放亂射,所有戰鬥可用技能的參數都可以使用

com2 參數說明

要指定目標的動作,如攻擊,則使用Battle.GetEntryPosition獲取到目標的位置後當做此參數。

對自身或無需指定,使用-1

com3 參數說明

當前支持的指令都使用-1作爲參數即可。 當com1使用戰鬥技能參數時,com3參數應爲對應技能的tech.txt中的tech id。

範例

if( Battle.IsWaitingCommand(index) == 1) then
    Battle.ActionSelect(index, %戰鬥指令_攻擊%, 11, -1);
    print("offline player attack");
end

if( Battle.IsWaitingCommand(index) == 1) then
    Battle.ActionSelect(index, %TECH_Assassin%, 11, 9609); -- 施放10級暗殺
    print("施放10級暗殺");
end