回到
顶部
意见
反馈
首页 > Mod工坊 > 全面战争 > 修改教程 > 罗马全战 > 罗马全面战争入门脚本教程

罗马全面战争入门脚本教程

2016-08-20 14:22:15| 来源: 佚名 |   已有[ ]人前来看过    | 已有[ ]人评论

打开data\export_descr_advice.txt 这个文件。

 

要想要脚本工作,首先要添加一个线程。

要添加如下代码:

 

;------------------------------------------

AdviceThread BackgroundScriptThread

GameArea Campaign

 

Item BackgroundScriptItem1

Uninhibitable

Verbosity 0

Threshold 1

MaxRepeats 0

RepeatInterval 1

Attitude Normal

Presentation Default

Title BackgroundScriptTitle1

On_display scripts\show_me\background_script.txt

Text BackgroundScriptText1

 

就是这样一段代码。注意,那条横线也是要的。

同样是在export_descr_advice.txt文件,在尾端添加以下代码:

 

Trigger background_script_trigger_1

WhenToTest ButtonPressed

 

Condition ButtonPressed faction_button

 

AdviceThread BackgroundScriptThread 1

 

;------------------------------------------

Trigger background_script_trigger_2

WhenToTest ButtonPressed

 

Condition ButtonPressed construction_button

 

AdviceThread BackgroundScriptThread 1

 

;------------------------------------------

Trigger background_script_trigger_3

WhenToTest ButtonPressed

 

Condition ButtonPressed recruitment_button

 

AdviceThread BackgroundScriptThread 1

 

;------------------------------------------

Trigger background_script_trigger_4

WhenToTest SettlementSelected

 

AdviceThread BackgroundScriptThread 1

 

4楼的代码 我做简单的讲解:

 

Trigger background_script_trigger_1

WhenToTest ButtonPressed

 

Condition ButtonPressed faction_button //按下派系的那个按钮 触发这个脚本

 

AdviceThread BackgroundScriptThread 1

 

;------------------------------------------

Trigger background_script_trigger_2

WhenToTest ButtonPressed

 

Condition ButtonPressed construction_button //这个是建设按钮

 

AdviceThread BackgroundScriptThread 1

 

;------------------------------------------

Trigger background_script_trigger_3

WhenToTest ButtonPressed

 

Condition ButtonPressed recruitment_button //这个是招募单位按钮

 

AdviceThread BackgroundScriptThread 1

 

;------------------------------------------

Trigger background_script_trigger_4

WhenToTest SettlementSelected //这个是选择城市

 

AdviceThread BackgroundScriptThread 1

 

准备工作完成,然后找data\scripts\show_me文件夹里面

新建一个记事本,名字叫background_script.txt

 

然后把以下代码复制进去:

 

script

 

; Anything following a semicolon is a comment.

 

; Remove the adviser portrait from screen.

select_ui_element advisor_dismiss_button

simulate_mouse_click lclick_up

 

; Wait for it to go away.

while I_AdvisorVisible

end_while

 

suspend_unscripted_advice true

 

; Open the adviser message bubble automatically whenever advance_advice_thread is called.

; I recommend using this method instead of the select_ui_element + simulate_mouse_click approach.

; Do NOT mix both methods, though, or the advisor will show and then immediately close before

; you get a chance to read the text.

declare_show_me

 

; Very useful for debugging - uncomment to use

;console_command toggle_perfect_spy

 

;;;

;;; --- Forced shutdown ---

;;;

;;; Press 'Esc' on the campaign map, then click on the '?' button in the

;;; menu scroll to terminate the script.

;;;

;;; When would this be useful? -- When you are already in a game and

;;; exit back to the main menu to restart the campaign, or reload a saved

;;; game, RTW does not automatically terminate the script, so you have

;;; to do it yourself. If you leave the old script running, you'll have all

;;; sorts of weird problems with the script in the new game.

;;;

monitor_event ScrollAdviceRequested ScrollAdviceRequested end_game_scroll

terminate_script

end_monitor

 

; Handle saved game reloads

monitor_event GameReloaded TrueCondition

terminate_script

end_monitor

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; This is where to put your own code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

; For example, this will give you 1 gold at the beginning of every turn

monitor_event FactionTurnStart FactionIsLocal

console_command add_money 1

end_monitor

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; End of your code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

; Spin forever - Do not let the script terminate or any monitors you have set up will immediately get thrown away.

; In M2TW scripts, this loop is replaced by the wait_monitors command. Unfortunately, this command is not available in RTW.

while I_TurnNumber < 99999

suspend_unscripted_advice true

end_while

 

end_script

 

script

 

; Anything following a semicolon is a comment.

 

; Remove the adviser portrait from screen.

select_ui_element advisor_dismiss_button

simulate_mouse_click lclick_up

 

; Wait for it to go away.

while I_AdvisorVisible

end_while

 

suspend_unscripted_advice true

 

; Open the adviser message bubble automatically whenever advance_advice_thread is called.

; I recommend using this method instead of the select_ui_element + simulate_mouse_click approach.

; Do NOT mix both methods, though, or the advisor will show and then immediately close before

; you get a chance to read the text.

declare_show_me

 

; Very useful for debugging - uncomment to use

;console_command toggle_perfect_spy

 

;;;

;;; --- Forced shutdown ---

;;;

;;; Press 'Esc' on the campaign map, then click on the '?' button in the

;;; menu scroll to terminate the script.

;;;

;;; When would this be useful? -- When you are already in a game and

;;; exit back to the main menu to restart the campaign, or reload a saved

;;; game, RTW does not automatically terminate the script, so you have

;;; to do it yourself. If you leave the old script running, you'll have all

;;; sorts of weird problems with the script in the new game.

;;;

monitor_event ScrollAdviceRequested ScrollAdviceRequested end_game_scroll

terminate_script

end_monitor

 

; Handle saved game reloads

monitor_event GameReloaded TrueCondition

terminate_script

end_monitor

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; This is where to put your own code 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

; For example, this will give you 1 gold at the beginning of every turn

;举个例子 这个代码 在每回合初 将给你的派系一块钱

 

monitor_event FactionTurnStart FactionIsLocal //这行开始

console_command add_money 1 //这个就是传说中的秘籍了。

end_monitor //到这边,这三行就是脚本的主要内容了。脚本代码都将放在这边。

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; End of your code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

; Spin forever - Do not let the script terminate or any monitors you have set up will immediately get thrown away.

; In M2TW scripts, this loop is replaced by the wait_monitors command. Unfortunately, this command is not available in RTW.

 

//在游戏中 第10万回合之前,脚本有效。

while I_TurnNumber < 99999

suspend_unscripted_advice true

end_while

 

end_script

 

在data\text\export_advice.txt 这个文件底部加以下代码:

 

{BackgroundScriptTitle1}魔戒脚本//名字随便起

{BackgroundScriptText1}脚本启动

 

简单的暴兵脚本

 

 

monitor_event FactionTurnStart FactionType carthage

and I_TurnNumber = 1

 

spawn_army

faction carthage

 

character Hannibal Barca, named character, age 16, , x 80, y 45

unit carthaginian general's cavalry, 10 exp 3 armour 3 weapon_lvl 3

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

 

end

 

terminate_monitor

end_monitor

 

做简单的说明:

 

monitor_event FactionTurnStart FactionType carthage //派系是迦太基,可以改别的

and I_TurnNumber = 1 //游戏开始之后的回合数

 

spawn_army

faction carthage //迦太基派系

 

character Hannibal Barca, named character, age 16, , x 80, y 45 //将军名字叫汉尼拔巴卡,16岁,会在80,45这个坐标出现。

unit carthaginian general's cavalry, 10 exp 3 armour 3 weapon_lvl 3 //迦太基后期将军卫队,人数,经验,金防,金攻。

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3 //圣团骑兵。

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

unit carthaginian sacred band infantry, 10 exp 3 armour 3 weapon_lvl 3

 

end

 

terminate_monitor

end_monitor

 

还有个脚本,更改派系关系的,偶还没测试,但是魔戒mod也是这样的格式,应该是没有问题的。

 

 

monitor_event FactionTurnStart FactionIsLocal 

and FactionType germans 

console_command diplomatic_stance germans carthage allied 

end_monitor

 

以上的意思是日耳曼跟迦太基同盟

 

强制同盟脚本有效果。以下放代码

 

monitor_event FactionTurnStart FactionIsLocal

and FactionType carthage

and I_TurnNumber < 100

 

console_command diplomatic_stance carthage gauls allied

end_monitor

 

100回合内,迦太基跟高卢强制同盟

 

强制外交关系:同盟、中立、战争。

 

monitor_event FactionTurnStart FactionIsLocal

and I_TurnNumber < 100

 

console_command diplomatic_stance romans_julii gauls allied

console_command diplomatic_stance romans_julii romans_brutii neutral

console_command diplomatic_stance britons numidia war

end_monitor

 

 

给钱脚本, 实际上只有n-1个回合加了钱 并且不使用红罗的时候才加钱。

 

monitor_event FactionTurnStart FactionIsLocal

and not I_LocalFaction romans_julii

and I_TurnNumber < 3

 

console_command add_money romans_julii, 40000

end_monitor

 

脚本的分类:

 

一、战役脚本,这种脚本是添加在descr_strat.txt文件最末尾的地方,这种脚本的特点是,只运行一次,在你新开始帝国会战的时候,运行一次,仅此一次,以后不管是保存还是读取游戏,都不会再触发这个脚本。典型代表就是罗马的游戏教学战役。

 

二、background script 这种脚本,是在advice文件里面添加线程实现的。它有两个优点,第一:当脚本运行起来,它允许你保存或者读取游戏存档,第二,在你读取存档之后,你可以重新让脚本运行起来。这种脚本,常常涉及到左上角的建议按钮,点击'Show me how' 按钮激活脚本。mod大多数都是这样的脚本,相信玩mod的筒子们对这种脚本应该是很熟悉的。

 

三、on-demand script 这种是按需求的脚本,比如一年四回合脚本,按F1,再按问号,再按一下“告诉我怎么做”激活脚本,这是需要手动来激活脚本。

 

来简单说说export_descr_advice.txt这个文件,它跟以下两个文件相似。

export_descr_ancillaries.txt 这个是修改随从的文件。

export_descr_character_traits.txt 这个是修改将军技能的文件。

 

当你增加新随从的时候,比如我加一个超级阿基米德,你得写它的属性,比如三围加10,然后在文件后面写trigger,你得写什么条件获得这个随从。

这个脚本也一样的道理,只不过,你要先添加一个线程(把线程想象成一个随从,这样肯定更加好理解),当你新增加了一个线程,接下来要写的就是这个线程的触发,也就是说这个线程什么条件才启动(你可以理解成,什么条件获得“随从”)

 

Data\text\export_advice.txt 这个文件,其实是翻译的说明,跟建筑说明不一样的是,这个必须要有,不然就会跳出游戏。--!后果很严重,如果增加新兵种,不给文字说明不要紧,但是这个advice必须要给文字说明

这个步骤是可选的,如何让你的background script在进入战役的时候,自动运行。

 

在Data\world\maps\campaign\imperial_campaign\descr_strat.txt 这个文件

打开它,最末尾,你可以看到这样一行 

 

; >>>> start of regions section <<<<

 

 

在这个文件的最最最后面添加 以下两行

script

campaign_script.txt 

 

在Data\world\maps\campaign\imperial_campaign这个文件夹,就是跟start同一文件夹下面,新建一个campaign_script.txt 记事本

添加以下内容:

 

script

 

wait 1

advance_advice_thread BackgroundScriptThread

wait 1

select_ui_element advisor_portrait_button

simulate_mouse_click lclick_up

 

end_script

 

这样,你的脚本在进入游戏的时候,就会自动运行

 

正确有效的写法如下:

 

 

monitor_event FactionTurnStart FactionIsLocal

and I_TurnNumber <= 20

 

if I_SettlementOwner Thermon = greek_cities

and FactionBesieged greek_cities

 

console_command create_unit Thermon "greek hoplite spartan" 1

 

end_if

end_monitor

 

当色蒙被围城,然后就在色蒙刷一队SBD。。。

 

暴兵脚本(复制的时候,把//后面都删掉)

 

monitor_event FactionTurnStart FactionIsLocal

and I_TurnNumber =2 //第二回合起效果

and not I_LocalFaction seleucid //玩家不是选的小塞

 

//这边开始是暴兵脚本

spawn_army

faction seleucid

//将军的名字,年龄,坐标

//后面几行是单位,经验,防御,攻击,

character Achaeus, named character, age 22, x 201, y 45

unit greek general's guard cavalry early, exp 2 armour 2 weapon_lvl 2

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

end

//给将军特技

console_command give_trait Achaeus GoodCommander 4

//给将军随从

console_command give_ancillary Achaeus bodyguard

 

end_monitor

 

两类刷兵脚本:

 

 

暴兵脚本(只能特定某个回合刷兵)

 

第二回合 不是选小塞进行游戏,刷一将军 4队铁甲罐头

 

monitor_event FactionTurnStart FactionIsLocal

and I_TurnNumber =2

and not I_LocalFaction seleucid

 

spawn_army

faction seleucid

character Achaeus, named character, age 22, x 201, y 47

unit greek general's guard cavalry early, exp 2 armour 2 weapon_lvl 2

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

unit east heavy cataphract, exp 2 armour 1 weapon_lvl 1

end

 

console_command give_trait Achaeus GoodCommander 4

console_command give_ancillary Achaeus bodyguard

 

end_monitor

 

 

 

刷兵脚本(在城市里面刷兵,可以多回合刷)

 

monitor_event FactionTurnStart FactionIsLocal

and I_TurnNumber < 2

and I_SettlementOwner Corinth = Macedon

 

console_command create_unit Corinth "merc vandal raiders" 1

 

 

end_monitor

 

spawn_army 如果用and I_TurnNumber <3 会出现每回合都刷兵,而且不停的刷。。。陷入死循环一样。。。

 





  • |
  • |

热门排行榜