- 声望
- 点
- 金币
- 枚
- 银币
- 枚
- 铜币
- 枚
- 注册时间
- 2011-1-21
- 最后登录
- 1970-1-1
|
我还是没搞明白怎么弄成像妖都那样根据子模块来生产资源,勉强只能做到整条船上。虽然我还另加了3门和运输舰一样的高射炮上去,但那和本文无关。
-----这部分是替换sp_tanker.ship中的相应内容,出现在辅助船面板,选用超空间进入,和战斗机一样的装甲,采矿船人口
NewShipType.MinimalFamilyToFindPathAround = "MotherShip"
NewShipType.BuildFamily = "Shipyard_Hgn"
NewShipType.AttackFamily = "BigCapitalShip"
NewShipType.DockFamily = "Shipyard"
NewShipType.AvoidanceFamily = "MotherShip"
NewShipType.DisplayFamily = "Utility"
NewShipType.AutoFormationFamily = "SuperCap"
NewShipType.CollisionFamily = "Big"
NewShipType.ArmourFamily = "Unarmoured"
NewShipType.UnitCapsFamily = "Utility"
NewShipType.UnitCapsShipType = "ResourceCollector"
-----ps:建造时间和资源,以及添加武器和模块之类的请看置顶贴教程总目
-----下面这部分加入到build.lua里面
{
Type = Ship,
ThingToBuild = "sp_tanker",
RequiredResearch = "",
RequiredShipSubSystems = "",
DisplayPriority = 0,
DisplayedName = "工业舰",
Description = "通过生产民用产品获取利润",
},
-----以下是deathmatch.lua的全文,备份下然后直接替换掉好了,喜欢研究的只需要看我注释的部分
GUID =
{
110,
91,
157,
190,
18,
23,
250,
78,
144,
20,
41,
246,
181,
128,
214,
12,
}
GameRulesName = "我的模式"
Description = "我的模式"
GameSetupOptions =
{
{
name = "resources",
locName = "$3240",
tooltip = "$3239",
default = 1,
visible = 1,
choices =
{
"$3241",
"0.5",
"$3242",
"1",
"$3243",
"2",
},
},
{
name = "unitcaps",
locName = "$3214",
tooltip = "$3234",
default = 1,
visible = 1,
choices =
{
"$3215",
"Small",
"$3216",
"Normal",
"$3217",
"Large",
},
},
{
name = "resstart",
locName = "$3205",
tooltip = "$3232",
default = 0,
visible = 1,
choices =
{
"$3206",
"1000",
"$3207",
"3000",
"$3208",
"10000",
"$3209",
"0",
},
},
{
name = "lockteams",
locName = "$3220",
tooltip = "$3235",
default = 0,
visible = 1,
choices =
{
"$3221",
"yes",
"$3222",
"no",
},
},
{
name = "startlocation",
locName = "$3225",
tooltip = "$3237",
default = 0,
visible = 1,
choices =
{
"$3226",
"random",
"$3227",
"fixed",
},
},
}
dofilepath("data:scripts/scar/restrict.lua")
function OnInit()
MPRestrict()
Rule_Add("MainRule")
SobGroup_Create("gyj")
---插入上面这句,用来建立一个数组,用来存放工业舰的数量
Rule_AddInterval("gy",100)
---插入上面这句,用来把名叫gy的子程序放进计时器定时重复
Rule_Add("gy")
---插入上面这句,用来运行这个名叫gy的子程序
end
function MainRule()
local playerIndex = 0
local playerCount = Universe_PlayerCount()
while (playerIndex < playerCount) do
if (Player_IsAlive(playerIndex) == 1) then
if (Player_HasShipWithBuildQueue(playerIndex) == 0) then
Player_Kill(playerIndex)
end
end
playerIndex = (playerIndex + 1)
end
local numAlive = 0
local numEnemies = 0
local gameOver = 1
playerIndex = 0
while (playerIndex < playerCount) do
if (Player_IsAlive(playerIndex) == 1) then
local otherPlayerIndex = 0
while (otherPlayerIndex < playerCount) do
if (AreAllied(playerIndex, otherPlayerIndex) == 0) then
if (Player_IsAlive(otherPlayerIndex) == 1) then
gameOver = 0
else
numEnemies = (numEnemies + 1)
end
end
otherPlayerIndex = (otherPlayerIndex + 1)
end
numAlive = (numAlive + 1)
end
playerIndex = (playerIndex + 1)
end
if (numEnemies ~= 0) or(numAlive > 0) then
gameOver = 0
end
if (gameOver == 1) then
Rule_Add("waitForEnd")
Event_Start("endGame")
Rule_Remove("MainRule")
end
end
function waitForEnd()
if (Event_IsDone("endGame")) then
setGameOver()
Rule_Remove("waitForEnd")
end
end
Events = {}
Events["endGame"] =
{
{
{
"wID = Wait_Start(5)",
"Wait_End(wID)",
},
},
}
---插入下面的全部
function gy()
---子程序的开头
local rs = 0
---上面这个是用来定义当前这个人的编号的变量
while (rs < Universe_PlayerCount()) do
---上面这句意思是如果当前这个人的编号小与总人数(即不是最后1人之后的那个天外来客)那么执行下面3句
if (Player_IsAlive(rs) == 1) then
---上面这个如果:如果这个编号的人还活着,意思是死了就跳过
Player_FillShipsByType("gyj", 0, "sp_tanker")
---把这个人所拥有的sp_tanker(原版任务的运输舰)的数量放进gyj数组
Player_SetRU(rs, (Player_GetRU(rs) + SobGroup_Count("gyj")*5))
---设置拥有资源(这个人的编号,(获取拥有的资源(这个人的编号)+数组的大小(数组)*5))
---上面的意思是:首先提取这个人拥有的工业舰的数量并且乘5,然后和他现有的资源数量相加,最后把得出的数值设置成他拥有的资源总数
end
---结束上面说的如果范围,就是说如果那个如果的条件不成立,这句上面和那句如果下面都不会运行
rs = rs + 1
---下一个人
end
---最上面那个如果,注意2个如果的指令并不相同,因为要执行的效果不同,外面这个是循环,里面的是1次,当然外面的循环会带动里面的
end
---最后的end结束的是整个子程序,没有个专业的编程工具,用记事本看这个东西真会累死人
---插入上面的全部 |
|