跳轉到內容

ETF 對映/示例

來自華夏公益教科書,開放書籍,開放世界

觸發器型別

[編輯 | 編輯原始碼]

你會使用六種主要的觸發器型別

刷子觸發器 這類似於 trigger_multiple - 一個區域刷子,當你走過它時會觸發。
點觸發器 這些用作 func_goalinfo 實體,可以設定最小值和最大值來定義它們的實際大小。當你走進實體周圍定義的區域時,它們會觸發 - 它們也可以產生其他效果,例如顯示一個在啟用時變得不可見的模型等。
不可觸碰觸發器 這些通常設定為 info_notnull,充當中繼或簡單的替代觸發器(即兩個具有相同名稱的實體,一個只能被藍色觸發,另一個只能被紅色觸發)。
旗幟 這些用作 func_goalitem 實體(或 func_flag,它們是相同的),當成功接觸時,會被玩家“攜帶”。
標準實體 這些是 func_door 或 info_player_start 實體之類的東西 - 它們的行為或多或少與通常一樣,但標準和級聯觸發器仍然起作用。
特殊實體 這些是 func_commandpoint 之類的東西 - 新的實體,其行為由實體定義。(稍後會詳細介紹)。

示例旗幟

[編輯 | 編輯原始碼]

“旗幟”是一個只能攜帶的實體,但只能由一個團隊攜帶,並且在攜帶時會產生不同的效果。

{
    // The red flag

    "classname" "func_goalitem"
    // this one is set by the editor when you position the entity:
    "origin" "1248 1984 -328"

    // What it looks like    
    "model" "models/flags/r_flag.md3"    // Model to use    
    "light" "200"                        // Dynamic light
    "color" "1 0 0"                      // Pure red
    "sparkle" "1 0 0"                    // Generate smoke puffs around carrier

    // What it's called
    "groupname" "redflag"

    // Criteria
    "allowteams" "blue"    // Only blue players can trigger (i.e. carry)

    // Messages on trigger
    // Centerprint message to activator:
    "carried_message" "~You have taken the ^1RED^* flag!"
    // Tell everyone activator has done it:
    "carried_all_message" "~%N has TAKEN the ^1RED^* flag!"
    // Tell everyone activator dropped the flag:
    "active_all_message" "~%N has DROPPED the ^1RED^* flag!"
    "inactive_all_message" "The ^1RED^* flag has returned."
    // Play Sound to team:
    "carried_team_sound" "~sound/teamplay/voc_team_flag.wav"
    // Play Sound to non-team players:
    "carried_nonteam_sound" "~sound/teamplay/voc_enemy_flag.wav"
    // Play Sound to activator:
    "carried_sound" "~sound/teamplay/voc_you_flag.wav"

    // Flaginfo (shown on \flaginfo command)
    "carried_flaginfo" "%N has the ^1RED^* flag."
    "active_flaginfo" "The ^1RED^* flag has been dropped at $l."			
    // Flags must use $l for active_flaginfo and active_all_message
    "inactive_flaginfo" "The ^1RED^* flag is at the red base."

    // Misc
    // Reveal spies on trigger, show flag above player when carried:
    "flags" "revealagent,showcarry"
    // Wait 45 seconds before going inactive (i.e. back to base):
    "wait" "45"
}

示例佔點

[編輯 | 編輯原始碼]

現在我們有了一個旗幟,我們需要一個地方來佔領它。

{
    // The capture point in the blue base

    "classname" "trigger_multiple"
    // Origin/size defined by brush (never set)
    "model" "*10"

    // Criteria
    // Only trigger if activator holds redflag:
    "holding" "redflag"

    // Messages
    // Centerprint message to everyone:
    "active_all_message" "~%N has CAPTURED the ^1RED^* flag!"
    "active_message" "You have scored 2 frags for capturing the flag."
    // Play sound to activator:
    "active_sound" "~sound/teamplay/voc_blue_scores.wav"
    // Play sound to activator's team (apart from activator):
    "active_team_sound" "sound/teamplay/flagcap_blu.wav"

    // 'Give' bonuses
    "give" "score=+2,health=+100,armor=+200,ammo_shells=+200,ammo_nails=+200,ammo_cells=+200,ammo_rockets=+200,ammo_medikit=+50,gren1=+4,gren2=+2"    
    // Give activator's team 10 points (the teamscore, not the players on the team):
    "teamscore" "10"

    // When activated, force redflag to inactive (back to base),
    // trigger scorer (optional extra 10 points entity):
    "activetarget" "redflag=~inactive,scorer"
}

示例指揮點

[編輯 | 編輯原始碼]

為了使事情更有趣,我們為什麼不設定一個“計分”指揮點,當玩家佔領旗幟時,給他們額外 10 分?

{
    // A button to press to claim the command point

    "classname" "func_button"
    "model" "*1"
    "angle" "-2"
    "wait" "5"
    // Trigger the scorer command point when activated:
    "activetarget" "scorer_cp"
}

{
    // The scorer command point (no model, so must be triggered by another entity)

    "classname" "func_commandpoint"
    "origin" "448 832 -128"

    // Misc
    "groupname" "scorer_cp"

    // Messages
    "active_all_message" "~%N has claimed the\ncapture bonus for the %T!"

    // On activation (i.e. touch if we have a model, or trigger by a button
    // or something otherwise)
    // All entities named 'scorer' are locked to activators team:
    "teamset" "scorer"
    // Set scorer to inactive (i.e. ready to be activated):
    "activetarget" "scorer=inactive"
}

{
    // An untouchable 'scorer' entity
    "classname" "info_notnull"    
    "origin" "444 828 -84"         // Hardly 'essential' in this case...

    // Misc
    "groupname" "scorer"           // So other entities can reference
    // Prevent scorer from being triggered initially
    // (i.e. until command point is claimed):
    "initialstate" "disabled"

    // On activation
    "teamscore" "10"               // Give the activator's team 10 points
    // Go inactive after 1 second (the chances of someone capturing twice
    // in under a second are pretty slim...):
    "wait" "1"
}

示例 HUD

[編輯 | 編輯原始碼]

我們漏掉了一些東西 - 我們需要向玩家顯示他是否正在攜帶旗幟,否則他可能會感到困惑(如果他發現自己已經攜帶了 5 分鐘卻沒有佔領,他會感到沮喪)。我們需要一個 HUD 實體。

{
    // A HUD entity shown to the red flag carrier
    "classname" "func_hud"
    "origin" "1252 1980 -292"

    // Entity never actually activates, just show this model:
    "inactive_model" "models/flags/r_flag.md3"
    "slot" "1"            // Display it in slot 1 (top left)
    "holding" "redflag"   // Only player holding redflag can see this entity
}
華夏公益教科書