SDL中文论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 6340|回复: 4
打印 上一主题 下一主题

[MOD] 如何制作对战剧本

[复制链接]

149

主题

331

帖子

2445

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2445
跳转到指定楼层
楼主
发表于 2020-11-29 10:38:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
要制作剧本,须下载开发包中的资源包。

对战剧本用于联机对战(包括互联网、局域网)和随机地图。

二楼:剧本实例:2p—蛇怪之穴
三楼:FAQ
四楼:单机剧本改为对战剧本
回复

使用道具 举报

149

主题

331

帖子

2445

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2445
沙发
 楼主| 发表于 2020-11-29 10:38:53 | 只看该作者

剧本实例:2p—蛇怪之穴

制作联机对战剧本分两个步骤
  • 绘制地图。
  • 编写剧本脚本。

绘制地图
打开地图编辑器绘制地图。2p—蛇怪之穴的地图已在资源包中,具体是<data>/multiplayer/maps/2p_Caves_of_the_Basilisk.map。
作为一种习惯,多人对战时地图集中放在<data>/multiplayer/maps目录下。

编写剧本脚本
联机对战脚本一般只需要一个*.cfg。2p—蛇怪之穴的脚本已在资源包中,具体是<data>/multiplayer/scenarios/2p_Caves_of_the_Basilisk.cfg。
多人对战时剧本必须集中放在<data>/multiplayer/scenarios目录下。为什么“必须”?——打开<data>/_main.cfg,它当中有这么几行:
  1. .....................
  2. {core/}

  3. #ifdef MULTIPLAYER
  4. {multiplayer/}
  5. #endif

  6. {campaigns/}
  7. ....................
复制代码
{multiplayer/}指就是<data>/multiplayer/,也就是说编辑器形成multiplayer.bin时它默认收集<data>/multiplayer/下的[multiplayer]块。

[multiplayer]对应的bin文件是multiplayer.bin。

<data>/multiplayer/scenarios/2p_Caves_of_the_Basilisk.cfg

  1. # 要没意外,对战剧本翻译统一使用wesnoth-multiplayer.mo
  2. #textdomain wesnoth-multiplayer

  3. # multiplayer是关卡块标签,它的作用类似单机关卡中的[scenario]标签
  4. # [multiplayer]和[scenario]块中内容也是几乎一样的。
  5. [multiplayer]
  6. # 定义一宏,该宏实现功能是在(X, Y)坐标处放置一只HP=1石化部队
  7. #define UNIT_PETRIFY TYPE NAME_STRING X Y
  8.         [unit]
  9.                 # cityno=0指示是流浪部队
  10.                 cityno=0
  11.                 type={TYPE}
  12.                 name={NAME_STRING}
  13.                 heros_army=203
  14.                 x={X}
  15.                 y={Y}
  16.                 unrenamable=yes
  17.                 random_traits=no

  18.                 [status]
  19.                         petrified=yes
  20.                 [/status]

  21.                 [modifications]
  22.                         [trait]
  23.                                 id=remove_hp
  24.                                 name=_ "statue"
  25.                                 [effect]
  26.                                         # 总HP比平常小100%,但它会确何HP至少是1,因而会被置为1
  27.                                         apply_to=hitpoints
  28.                                         increase_total=-100%
  29.                                 [/effect]
  30.                                 [effect]
  31.                                         # 该部队移动力置0
  32.                                         apply_to=movement
  33.                                         set=0
  34.                                 [/effect]
  35.                         [/trait]
  36.                 [/modifications]
  37.         [/unit]
  38. #enddef

  39.         id=multiplayer_Basilisk
  40.         name= _ "2p — Caves of the Basilisk"
  41.         map_data="{multiplayer/maps/2p_Caves_of_the_Basilisk.map}"
  42.         description= _ "These caves were once the lair of Chak’kso Ney’yks, a legendary Elder Basilisk. The petrified forms of his victims remain as monuments to his savage power."
  43.         random_start_time="no"

  44.         {DEFAULT_SCHEDULE}
  45.         {DEFAULT_MUSIC_PLAYLIST}

  46.         [side]
  47.                 [ai]
  48.                         villages_per_scout=8
  49.                 [/ai]
  50.                 # 势力编号。它必须从1始,逐1增
  51.                 side=1
  52.                 controller=human
  53.                 # 强制指定集团,意味着游戏大厅中不能更改担当该势力的集团
  54.                 leader=3
  55.                 user_team_name= _ "teamname^North"
  56.                 fog=yes
  57.                
  58.                 # 在(21,4)坐标处放置一个城市,该城市属于side=1,城市编号1,城市序号127(它和武将被统一编号)
  59.                 {ANONYMITY_LOYAL_MERITORIOUS_CITY 1 1 21 4 127 0}
  60.                 [+artifical]
  61.                         # 城市一开始“空闲武将”
  62.                         service_heros=3,7,8,9,13,15,16,35,36,37,39,45,46,47,63,83,86,87,88,94,97,99,101,102,107,108,118,120,122
  63.                         # 属于该城市的经济区
  64.                         economy_area=(16,4),(16,5)
  65.                         # 该城市辖区(左上角x坐标,左上角y坐标,宽度,高度)
  66.                         district=(14,1,15,11)
  67.                 [/artifical]
  68.         [/side]

  69.         [side]
  70.                 [ai]
  71.                         villages_per_scout=8
  72.                 [/ai]
  73.                 side=2
  74.                 controller=human
  75.                 # 强制指定集团,意味着游戏大厅中不能更改担当该势力的集团
  76.                 leader=139
  77.                 user_team_name= _ "teamname^South"
  78.                 fog=yes
  79.                 [village]
  80.                         x=11
  81.                         y=19
  82.                 [/village]
  83.         
  84.                 {ANONYMITY_LOYAL_MERITORIOUS_CITY 2 2 21 21 130 0}
  85.                 [+artifical]
  86.                         service_heros=6,14,20,21,22,23,24,25,26,27,28,29,30,41,100,115,116,139,156,182,183,187,188,191,193
  87.                         economy_area=(26,19),(26,20)
  88.                         district=(14,14,15,11)
  89.                 [/artifical]
  90.         [/side]

  91.         [side]
  92.                 side=3
  93.                 color=black
  94.                 # 存在这个势力目的是为显示那些石化部队
  95.                 # controller=null使得这个势力被置空
  96.                 controller=null
  97.                 leader=203
  98.                 # allow_player=no使得游戏大厅II中不会显示这个势力信息
  99.                 allow_player=no
  100.                 no_leader=yes
  101.                 hidden=yes

  102.                 # 以下放置四只石化部队
  103.                 # wmllint: local spelling Turin
  104.                 {UNIT_PETRIFY "horseman1" "" 22 12}
  105.                 [+unit]
  106.                         facing=sw
  107.                         description=_ "He had lived there for ages upon ages, in the depths of the water, preying upon the various fish and frogs and merfolk that entered his domain. It was his lake, no other's, and though it was not large, he was its master. Then, the Basilisk came, and looked into the Serpent's eyes. And the Serpent had not died, but it was no longer alive. Thus the new lord of the lake had arrived.
  108. (inscribed by Turin)"
  109.                 [/unit]

  110.                 # wmllint: local spelling Fynmiir
  111.                 {UNIT_PETRIFY "footman1" "" 25 14}
  112.                 [+unit]
  113.                         facing=sw
  114.                         description=_ "A brave hero of Wesnoth's Golden Age, this great rider and commander of men came to this evil place while on a raid against the orcs. Caught unaware by the foul creatures, many of his fellows were killed, but he fought valiantly, slaying many a foe. But alas! The foul Basilisk turned him to stone even as he slew the last orc. Now all that is left is a stark reminder of his once great bearing and strength.
  115. (inscribed by Fynmiir)"
  116.                 [/unit]

  117.                 # wmllint: local spelling Rilhon Eloralduil Paterson
  118.                 {UNIT_PETRIFY "bowman1" _"Rilhon" 20 12}
  119.                 [+unit]
  120.                         description=_ "This brave warrior, known as Rilhon among the Naga, heard tell of a fabulous treasure that had been lost in these watery caves- a spear whose head was said to have been fashioned from the tooth of Chak'kso Ney'yks, an Elder Basilisk slain long ago by the Elvish hero, Eloralduil. According to the legend, the weapon rested somewhere on the bottom of this very lake (Ruaskkolin Lake, named for a well-known Sea Serpent who made it his home). Having prepared himself for battle with the Serpent, Rilhon met with two rather large surprises. The first was the petrified form of Ruaskkolin the Serpent. The second was the very-much-alive Chak'kso Ney'yks, who was, oddly enough, in possession of all of his teeth.
  121. (inscribed by Paterson)"
  122.                 [/unit]

  123.                 # wmllint: local spelling MJQ
  124.                 {UNIT_PETRIFY "mage1" "" 17 11}
  125.                 [+unit]
  126.                 facing=sw
  127.                         description=_ "Through waves and rocky channels
  128. blue and white
  129. she pulled and pushed the tides
  130. and taught the fishes how to speak to planets
  131. silver green
  132. with magic
  133. running from her spirit into skins of kelp and shells of snails
  134. a twisting of her tail and hands
  135. she sent her songs to run on pin-tipped legs about the sands
  136. and now
  137. and now the strangest pause
  138. for years and years
  139. she hasn't moved her eyes

  140. (inscribed by MJQ)"
  141.                 [/unit]
  142.         [/side]

  143. # 此个cfg中自定义了UNIT_PETRIFY宏,别的cfg不会用上该宏。
  144. # 作为一种习惯,退出这cfg前最好删掉本文件定义且别的文件不会用的宏
  145. #undef UNIT_PETRIFY
  146. [/multiplayer]
复制代码
回复 支持 反对

使用道具 举报

149

主题

331

帖子

2445

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2445
板凳
 楼主| 发表于 2020-11-29 10:39:46 | 只看该作者

FAQ

  • 继承:使用默认设置。
  • 自定义:使用此个cfg中写的自定义设置。

[side]下的allow_player、controller
对战剧本区别于单机剧本的一个特点是它可为其它势力设定玩家类型,可以指定玩家类型是网络玩家,本地玩家,电脑玩家(AI),甚至空。

[side]下的allow_player、controller就用于设置该势力玩家类型。
  • human_ai、network_ai、ai是同一值,都归为ai。
  • allow_player指示在游戏大厅II中是否可更改玩家类型。no:不可更改;yes:可更改,默认是可更改。allow_player=no时,游戏大厅II中就不会出现该势力的信息,而且此时玩家类型只能是null或ai,即即使写的是controller=human,它也会被归为ai。
  • 一旦allow_player=yes时,controller字段是什么值已是次要了,它只是一进入游戏大厅II那一刻首先显示什么类型。
  • 本地玩家。本地玩家指的是在本PC上登录的玩家,如果你登录时用的id是ancientcc,那本地玩家和ancientcc就是同一个。
  • 当[side]下不存在controller字段时,如果allow_player=yes,那可在游戏大厅II更改玩家类型;allow_player=no时则强制为ai。

如何为势力指定集团
集团指的是曹操、刘备等。剧本可继承游戏预定的集团设置,也可在此个cfg自定义集团。
预定的集团设置,指的是游戏为方便编写对战剧本,它预先定义了几个集团。具体在<data>/multiplayer/factions.cfg。例如以下定义的是袁绍集团。
  1. [faction]
  2.         id=yuanshao
  3.         leader=136
  4.         {ANONYMITY_LOYAL_MERITORIOUS_CITY 0 0 1 1 126 0}
  5.         [+artifical]
  6.                 service_heros=44,87,119,136,141,142,144,155,161,163,180,202,204
  7.                 wander_heros=185
  8.         [/artifical]
  9. [/faction]
复制代码
区分是继承还是自定义看[side]块中是否存在leader。
  • 存在leader时使用自定义。一旦自定义,游戏大厅II中将不能更改担当该势力集团。
  • 不存在leader时使用继承。一旦继承,游戏大厅II中可以更改担当该势力集团、及势力特技。

如何指定势力的可征兵种
剧本可有两种方法设定可征兵种,继承和自定义。区分是继承还是自定义看[side]块中是否存在recruit。

存在recruit时使用自定义。一旦自定义,该势力可征兵种就是recruit指定那些兵种。
不存在recruit时使用继承。一旦继承,创建游戏时选择的时代(era)决定该势力可征哪些兵种。“时代”是游戏预先定义,具体在<data>/multiplayer/eras.cfg。例如以下定义的是默认时代,它只能征一级兵。
  1. [era]
  2.     id=era_lv1
  3.     name= _ "Default"

  4.     factions=yuanshao,liubei,caocao,sunjian,dongzhuo
  5.     recruit=footman1,horseman1,bowman1,catapult1,commander1,pikeman1,mage1
  6.     terrain_liked=Gg, Ww, Wo
  7.     [ai]
  8.         recruitment_pattern=fighter,fighter,fighter,archer,mixed fighter,scout
  9.     [/ai]

  10.     {QUICK_4MP_LEADERS}
  11.     {TURNS_OVER_ADVANTAGE}
  12. [/era]
复制代码
游戏定义了四种时代,创建游戏时必是它们中的一种。
  • 默认时代:可征1级兵。
  • Age of Level2:可征2级兵。
  • 英雄时代:可征3级兵。
  • Age of Level4:可征4级兵。

如何指定城市、武将
剧本可有两种方法设定城市,继承和自定义。区分是继承还是自定义看[side]块中是否存在[artifical]块。
要使能继承城市,必须先使能继承集团,即[side]块中不能存在leader。
[side]块中不存在[artifical]块时,使用[faction]中的[artifical]块,像HP,至于该城市坐标由内部计算;否则使用关卡中的[artifical]块。

以上城市解释不包括武将。即[artitfical]中的service_heros、wander_heros。

剧本可有两种方法设定武将,继承和自定义。区分是继承还是自定义看[side]下的[artifical]块是否有service_heros。
要使能继承武将,必须先使能继承集团,即[side]块中不能存在leader。但它可以选择不继承城市,即[side]中存在[artifical]块。

存在service_heros时(值是空也是存在)使用自定义。一旦自定义,使用剧本内设定的service_heros、wander_heros。
不存在service_heros时使用继承。一旦继承,使用担当该势力的集团的service_heros、wander_heros。
回复 支持 反对

使用道具 举报

149

主题

331

帖子

2445

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2445
地板
 楼主| 发表于 2020-11-29 10:40:17 | 只看该作者

单机剧本改为对战剧本

假设要改单机剧本的脚本文件是a.cfg,关联的地图文件是a.map。

步骤
1、把a.map复制到<data>/multiplayer/maps目录下。
2、把a.cfg复制到<data>/multiplayer/scenarios目录下。
3、打开a.cfg,对它做几处修改
  • 最多存在9个势力。
  • [scenario]改为[multiplayer]。
  • map_data={multiplayer/maps/a.map}。让指向正确的地图路径。
  • 如果要支持游戏大厅II能选择集团,注释掉相关[side]中的leader属性;如果武将要跟着集团走,注释掉[artifical]中的service_heros。
  • 如果要支持势力可征兵种跟着创建游戏时设置的时代变化,注释掉相关[side]下的recruit。
  • 如果[side]块下存在类似以下语句
    {PLAYER_IF 136}
            shroud=$player.shroud
            fog=$player.fog
            candidate_cards=$player.candidate_cards
            holded_cards=$player.holded_cards
            controller=human
            recruit=footman1,horseman1,bowman1,catapult1,commander1,pikeman1,mage1
            gold=100
            income=0
    {PLAYER_ELSE}
            controller=ai
            recruit=footman3,horseman3,bowman3,catapult3,commander3,pikeman3,whitemage3,redmage3
            gold=200
            income=120
    {PLAYER_ENDIF_ELSE}
    多人对战环境下,player.hero值是0,因而不会满足{PLAYER_IF 136}(只要参数不是0),以上就会执行controller=ai。如果所有势力都是controller=ai,此个游戏没意义,而且还可能导致非法退出。
    如果剧本采用自定义集团,至少要确保一个势力是controller=human。

4、保存a.cfg。编辑器汇编时需要打钩multiplayer.bin。
回复 支持 反对

使用道具 举报

149

主题

331

帖子

2445

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2445
5#
 楼主| 发表于 2020-11-29 10:40:33 | 只看该作者
RPG模式塔防模式
map_datamap_data字段指示地图数据无map_data字段
theme无theme字段theme = tower,塔防皮肤
side.controllerleader是空时强制到EMPTY模式不会存在EMPTY模式
side.leader正常设置AI需设为“黄巾”,玩家可以随意(建议也设为黄巾)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|丽谷软件|libsdl.cn

GMT+8, 2025-5-1 23:19 , Processed in 0.060970 second(s), 19 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表