找回密码
 点一下
查看: 5310|回复: 13

簡易td製造教程 - 更新 -

[复制链接]
发表于 2010-12-22 08:22:21 | 显示全部楼层 |阅读模式
以下教程將會教大家創造一個全新的TD(包括最基本的生兵,建築等等)
1.隨便扭個地形出來,之後利用PATHING工具(工具列中的一條彎曲的箭頭)中的 add pathing 並選取NO PATHING把附近的高崖都塗上只留下地板。
   SC1.JPG
2.在開始處加入一個新的point,叫Spawn Point 再後末端一樣的x軸上放一個point 叫 destination point。 之後把 兩個point 附近的地方塗上no building。之後把no building的位置用另一種材質填滿讓 玩家能清楚的知道什麼地方不能建造。
SC2.JPG (在圖中我把point的模型轉成了箭頭,要修改其模型只需雙擊指定的point並且切換到model欄即可)

3.用末端位置加上一個region 叫kill zone,用途是把入侵者殺死。
SC3.JPG
地形先到此為止
------------------------------------------分隔線------------------------------------------
接下來打開data editor(數據編輯器)
1. TD豈可少了BUILDER,於是我們來新增一隻全新的建造者。 首先右鍵選擇 ADD OBJECT。
名字就叫BUILDER,ID 點suggest即可,field source 我們直接選用Probe的。
SC4.JPG

2.把probe的收集技能和建造技能刪了。並且把他的mover轉成fly,collide也轉成flying。(不然建塔很不方便,尤其是在進行戰鬥的時候)
SC5.JPG

3.為builder加上actor,一樣我選用probe的。


4.新增一種炮塔,叫photon cannon(我一般都不修改原建築的,當然你也可以直接修改原建築),source 一樣選擇photon cannon。


5.把cost 調整為適當的價錢(一般來說這種堆路塔都是比較便宜的,我通常使用5 晶礦),並且在behavior(行為)中刪除power used
SC6.JPG



6.切換至ability(技能)的資料,新增一種技能叫BUILD,技能種類為build(建造),race選protoss,來源選probe。在PREFIX(前述)加上BUILDER以做區別。


7.打開info,把舊的資料通通刪除。然後,隨便選一欄並且雙擊之,在裡面看圖說故事即可。 info - time為建造時間 我一般設為5-10秒。


8.為builder加上他的建造技能,然後打開command card(就在正下面)跳到第二頁,一樣把舊的全刪了然後,新增一個button選擇photon cannon的圖標(你也可以自定一個)
並且把技能連接到按鈕中。
SC7.JPG

這樣子,就會有一個builder 和一個相應的建築物了
------------------------------------------分隔線------------------------------------------
觸發
A. 一般td圖有數個建造者,我們可以讓玩家挑選一個他們喜歡的建造者(builder)去開始遊戲 方法如下:
1. 新建幾個Variable(變數)
TD:DialogID - 陣列 : (2) - 類型:Dialog
TD:ButtonID - 陣列 : (2)(20) - 類型:Dialog item
SC8.JPG


2.接下來,新建1個觸發叫dialog ini.
event 為 map intialization (就是運行地圖的那個)
    Actions
        ------- Dialog - Select Builder  (此為comment)
        Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
        Variable - Set TD:DialogID[1] = (Last created dialog)
        Dialog - Create a button for dialog TD:DialogID[1] with the dimensions (200, 50) anchored to Center with an offset of (0, -100) setting the tooltip to "" with button text "Builder" and the hover image set to ""
        Variable - Set TD:ButtonID[1][1] = (Last created dialog item)
        Dialog - Show (Last created dialog) for (All players)


3.如此就會有一個dialog,但仍需要配合一些觸發使其能發揮效果。新建一個觸發叫select builder
event 為         Dialog - Any Dialog Item is used by Player Any Player with event type Clicked (對應的是Dialog item used)
SC9.JPG

action:
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == TD:ButtonID[1][1]
            Then
                Unit - Create 1 TD - Builder for player (Triggering player) at Player Spawn Point using default facing (No Options)
                Dialog - Hide TD:DialogID[1] for (Player group((Triggering player)) (這裡要注意,把player 轉換成 player  group)
            Else

SC10.JPG

這樣只要玩家點擊指定的按鈕就會創建一個builder給他,同時把dialog隱藏
------------------------------------------分隔線------------------------------------------
接下來是生怪系統,為了避免大家的肉眼受苦,我會盡量使用action definition多於直接寫trigger [ 編寫和修改起來都比較容易,而且批量增加的時候 也可以省去很多麻煩]
1. 根據下表來製造相應的variable

&#160;&#160; &#160; &#160; &#160;Spawner:CreepID = 15 <Integer (Constant)> [控制怪物的電腦]
&#160;&#160; &#160; &#160; &#160;Spawner:MaximumWaves = 20 <Integer> [最大波數]
&#160;&#160; &#160; &#160; &#160;Spawner:CurrentWaves = 0 <Integer> [當前波數]
&#160;&#160; &#160; &#160; &#160;Spawner:SpawnUnitType = No Game Link <Game Link - Unit[20][5]> [每波的怪物種類]
&#160;&#160; &#160; &#160; &#160;Spawner:SpawnDelay = 0.0 <Real[20][5]> [產怪間隔
&#160;&#160; &#160; &#160; &#160;Spawner:SpawnAmount = 0 <Integer[20][5]> [產怪量]
&#160;&#160; &#160; &#160; &#160;Spawner:MaximumUnitTypePerWave = 5 <Integer> [每波最多的怪物種類]
&#160;&#160; &#160; &#160; &#160;Spawner:SpawningInProgress = true <Boolean> [是否正在產怪]
&#160;&#160; &#160; &#160; &#160;Spawner:SpawnerTimer = (New timer) <Timer> [用途之後再說]
&#160;&#160; &#160; &#160; &#160;Spawner:TimerBetweenWaves = 5.0 <Real> [之後再說]
&#160;&#160; &#160; &#160; &#160;Spawner:LifeForEachPlayer = 10 <Integer[2]> [玩家的生命值]

&#160;&#160; &#160; &#160; &#160;Spawner:CreepUnitGroup = (Empty unit group) <Unit Group> [怪物群組,日後有用]

SC11.JPG



注: [20] [5] 這些是陣列,也就是array,例如 上面&#160;&#160; &#160; &#160; &#160;Spawner:SpawnDelay = 0.0 <Real[20][5]>中的[20]指的是有20波 [5]是指有5種怪


2.新弄一個action 叫 Spawner:AddUnitToWave
&#160;&#160; &#160;Parameters [這個東西的作用可以參照的我之前發的觸發教程]
&#160;&#160; &#160; &#160; &#160;Unit Amount = 1 <Integer> &#160;[生產數量,可以設置最少數值,這裡我的最少數值為1]
&#160;&#160; &#160; &#160; &#160;Unit Type = No Game Link <Game Link - Unit>
&#160;&#160; &#160; &#160; &#160;Unit ID = 1 <Integer>&#160;[怪物的個人編號,可以設置最少數值,這裡我的最少數值為1]
&#160;&#160; &#160; &#160; &#160;Spawn Delay = 0.02 <Real>&#160;[生產間隔,可以設置最少數值,這裡我的最少數值為0.02]
&#160;&#160; &#160; &#160; &#160;Wave Number = 1 <Integer>&#160;[當屬的波數,可以設置最少數值,這裡我的最少數值為1]



&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;Variable - Set Spawner:SpawnUnitType[Wave Number][Unit ID] = Unit Type [ 設置variable 為指定的項目,留待日後使用]
&#160;&#160; &#160; &#160; &#160;Variable - Set Spawner:SpawnAmount[Wave Number][Unit ID] = Unit Amount
&#160;&#160; &#160; &#160; &#160;Variable - Set Spawner:SpawnDelay[Wave Number][Unit ID] = Spawn Delay



SC12.JPG


3.新的action definition->Spawner:SpawnUnit,這裡請在option9處勾選create thread(第一個)變成Options: Action, Create Thread
&#160;&#160; &#160;Parameters
&#160;&#160; &#160; &#160; &#160;Wave Number = 0 <Integer> [波數]
&#160;&#160; &#160; &#160; &#160;Unit ID = 0 <Integer> [怪物的編號]


&#160;&#160; &#160;Local Variables
&#160;&#160; &#160; &#160; &#160;TempInt = 0 <Integer>



&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;Variable - Set Spawner:SpawningInProgress = true [設定為正在產兵]
&#160;&#160; &#160; &#160; &#160;General - For each integer TempInt from 1 to Spawner:SpawnAmount[Wave Number][Unit ID] with increment 1, do (Actions) [類似vb的for y = xx to xx,就是會產行多少次。]
&#160;&#160; &#160; &#160; &#160; &#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Unit - Create 1 Spawner:SpawnUnitType[Wave Number][Unit ID] for player Spawner:CreepID at Spawn Point using point facing (No Options) [創造指定的怪物,這個在上面的AddUnitToWaves已經指定了]
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Unit - Order (Last created unit) to ( Move targeting Destination Point) (Replace Existing Orders) [命令其移動去目的地]
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Unit Group - Add (Last created unit) to Spawner:CreepUnitGroup [加創造的單位去一個單位群組,以後有用]

&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;General - Wait Spawner:SpawnDelay[Wave Number][Unit ID] Game Time seconds [等待幾秒之後再執行]
&#160;&#160; &#160; &#160; &#160;Variable - Set Spawner:SpawningInProgress = false [生完所有兵之後就設為未在產兵,日後有完]



4.新增一個action definition 叫Spawner:CallWave,用黎呼叫上面弄的SpawnUnit
&#160;&#160; &#160;Local Variables
&#160;&#160; &#160; &#160; &#160;Tempint = 0 <Integer> [一於用黎儲數而已]
&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;Variable - Modify Spawner:CurrentWaves: + 1 [把現時波數 + 1,一開始建議為0]
&#160;&#160; &#160; &#160; &#160;General - For each integer Tempint from 1 to Spawner:MaximumUnitTypePerWave with increment 1, do (Actions)
&#160;&#160; &#160; &#160; &#160; &#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;General - If (Conditions) then do (Actions) else do (Actions)
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;If
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Spawner:SpawnUnitType[Spawner:CurrentWaves][Tempint] != No Game Link [如果上面沒有設置種類的話就不理會,反之如果有設置的話執行以下行動]
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Then
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Spawner:SpawnUnit(Spawner:CurrentWaves, Tempint) [呼應上面的SpawnUnit]
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Else



5.新trigger 叫&#160;Spawner:Spawner Ini.
event - map initialization [ 地圖初始化 ]


&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;------- Add Unit To Waves
&#160;&#160; &#160; &#160; &#160;Add 20 Zergling to Wave 1 with a spawn delay of 0.2 . The Id of the Unit will be 1 [ 上面弄的新action,如此你就不必弄一大堆set variable,不單使你肉眼不那麼疲倦,又方便不用不斷按只需看圖說故事而已]
&#160;&#160; &#160; &#160; &#160;------- Spawner Timer
&#160;&#160; &#160; &#160; &#160;Timer - Start Spawner:SpawnerTimer as a Repeating timer that will expire in Spawner:TimerBetweenWaves Game Time seconds [開一個新的timer,你可以為其弄一個timer window來讓玩家得知下一波的時間]



6.新trigger 叫Spawner:SpawnUnitInWaves
&#160;&#160; &#160;Events
&#160;&#160; &#160; &#160; &#160;Timer - Spawner:SpawnerTimer expires [只要上面的timer到時就會執行行動]
&#160;&#160; &#160;Local Variables

&#160;&#160; &#160;Conditions
&#160;&#160; &#160; &#160; &#160;Spawner:CurrentWaves < Spawner:MaximumWaves [不然他會一直刷新…]
&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;Spawner:CallWave() [呼叫此行動,相當於叫系統產兵]



7.新trigger 叫&#160;Spawner:KillUnit
&#160;&#160; &#160;Events
&#160;&#160; &#160; &#160; &#160;Unit - Any Unit Enters Kill Zone [有單位進入到了我們的目的地]
&#160;&#160; &#160;Local Variables
&#160;&#160; &#160;Conditions
&#160;&#160; &#160; &#160; &#160;(Owner of (Triggering unit)) == Spawner:CreepID [控制者時hostile]
&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;Unit - Kill (Triggering unit) [殺死該單位]
&#160;&#160; &#160; &#160; &#160;Variable - Modify Spawner:LifeForEachPlayer[1]: - 1 [把玩家的血扣一滴]
&#160;&#160; &#160; &#160; &#160;General - If (Conditions) then do (Actions) else do (Actions)
&#160;&#160; &#160; &#160; &#160; &#160; &#160;If
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Spawner:LifeForEachPlayer[1] == 0 [如果他的血是0的話]
&#160;&#160; &#160; &#160; &#160; &#160; &#160;Then
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Game - End game in Defeat for player 1 (Show dialogs, Show score screen) [把他定為輸了]
&#160;&#160; &#160; &#160; &#160; &#160; &#160;Else



8.新的trigger Spawner:Victory


&#160;&#160; &#160;Events
&#160;&#160; &#160; &#160; &#160;Unit - Any Unit dies &#160;[任何單位死亡]
&#160;&#160; &#160;Local Variables
&#160;&#160; &#160;Conditions
&#160;&#160; &#160; &#160; &#160;(Owner of (Triggering unit)) == Spawner:CreepID [死的人是屬於hostile的]
&#160;&#160; &#160;Actions
&#160;&#160; &#160; &#160; &#160;General - If (Conditions) then do (Actions) else do (Actions)
&#160;&#160; &#160; &#160; &#160; &#160; &#160;If
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Spawner:CurrentWaves == Spawner:MaximumWaves &#160; [當前波數 等於 最大波數]
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Spawner:SpawningInProgress == false [不是在產兵]
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;(Number of Living units in Spawner:CreepUnitGroup) == 0 [剩下的單位為0]
&#160;&#160; &#160; &#160; &#160; &#160; &#160;Then
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Game - End game in Victory for player 1 (Show dialogs, Show score screen) [設定為勝利]
&#160;&#160; &#160; &#160; &#160; &#160; &#160;Else
參考地圖:
TD Tutorial.SC2Map (49 KB, 下载次数: 109)

以上一個簡單的td就完成了,有不明的可以問我。
------------完------------

少了點東西 edit了一次

评分

参与人数 1威望 +6 收起 理由
Renee + 6 楼主辛苦~~

查看全部评分

发表于 2010-12-22 08:32:04 | 显示全部楼层
LZ加油阿~~
回复

使用道具 举报

发表于 2010-12-22 08:48:53 | 显示全部楼层
LZ加油~
回复

使用道具 举报

发表于 2010-12-24 05:30:03 | 显示全部楼层
加分加分~~加入置顶教程~~
回复

使用道具 举报

发表于 2010-12-26 18:34:32 | 显示全部楼层
你好, 我的数据编辑器里 单位都没有 movement-mover 这个选项啊

能帮我解答下么 我是新手
回复

使用道具 举报

发表于 2010-12-26 18:41:26 | 显示全部楼层
找到了 谢谢
回复

使用道具 举报

发表于 2011-4-1 14:13:29 | 显示全部楼层
我是新手,用的是 简体中文版 能否把有些命令用中英对照的方式注明?谢谢[s:166][s:166]
回复

使用道具 举报

发表于 2011-4-1 14:28:04 | 显示全部楼层
请问:【数据编辑器】第2节:“提及probe的『收集技能』和『建造技能』”能否给出详细的命令地址,加以说明呢?

          【数据编辑器】第3节:如何给『builder』添加『Actor』呢?
回复

使用道具 举报

发表于 2011-4-5 18:25:41 | 显示全部楼层
要是有个英文和简体中文对照的表就好啦
回复

使用道具 举报

发表于 2011-5-4 00:34:32 | 显示全部楼层
先顶一个,不知道怎么才好!~!
回复

使用道具 举报

发表于 2011-5-21 22:38:36 | 显示全部楼层
3.為builder加上actor,一樣我選用probe的。


请问这步应该怎么做 没找到actor这个东西啊!
回复

使用道具 举报

发表于 2011-6-1 21:27:21 | 显示全部楼层
全是英文..................
回复

使用道具 举报

发表于 2012-4-18 21:10:46 | 显示全部楼层
  顶帖子是意见非常有意义的事情!
回复

使用道具 举报

发表于 2012-4-20 13:56:28 | 显示全部楼层
头目的 TD教程怎么找不到了 求助
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-24 12:57 , Processed in 0.069773 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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