ETF 映射/示例
外观
< 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"
}
我们漏掉了一些东西 - 我们需要向玩家显示他是否正在携带旗帜,否则他可能会感到困惑(如果他发现自己已经携带了 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
}