{"id":1895,"date":"2024-04-05T10:46:44","date_gmt":"2024-04-05T09:46:44","guid":{"rendered":"https:\/\/www.katsbits.com\/site\/?p=1895"},"modified":"2024-04-05T10:46:44","modified_gmt":"2024-04-05T09:46:44","slug":"trigger-kill-ai-entity-chain","status":"publish","type":"post","link":"https:\/\/www.katsbits.com\/site\/trigger-kill-ai-entity-chain\/","title":{"rendered":"RtCW trigger_hurt Entity Chain to trigger_kill AI"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.katsbits.com\/site\/trigger-kill-ai-entity-chain\/#Entities_Needed\" >Entities Needed<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.katsbits.com\/site\/trigger-kill-ai-entity-chain\/#Entity_Setup_Positioning\" >Entity Setup &amp; Positioning<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.katsbits.com\/site\/trigger-kill-ai-entity-chain\/#Entity_Chain_Connections\" >Entity Chain Connections<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.katsbits.com\/site\/trigger-kill-ai-entity-chain\/#Entity_KeyValue_Pairs\" >Entity Key\/Value Pairs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.katsbits.com\/site\/trigger-kill-ai-entity-chain\/#Compile_Test_Map\" >Compile  &amp; Test Map<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>Sometimes it&#8217;s simpler to use entities to carry out player and\/or triggered actions  in custom single player levels for   Return to Castle Wolfenstein; it avoids the need to set up a complex scripts that have to be tracked to make sure no &#8217;empty&#8217; or &#8216;null&#8217; calls are made, crashing the game when run.<\/p>\n<blockquote style=\"background-color: #ddecf3; color: #000;\"><p><b>Download<\/b>: <a href=\"https:\/\/www.katsbits.com\/files\/rtcw_sp\/kill-ai.zip\" title=\"Download trigger kill sample for for RtCW SP\">Trigger_kill source<\/a> (c. 100 KB | *.map, *.bsp).<\/p><\/blockquote>\n<p>Instead GTK Radiant can be used to set up a simple entity chain that when triggered will carry out the desired action, in this case killing an AI.<\/p>\n<p>To get the most from this tutorial it&#8217;s assumed  you know how to use and understand the basics of both GTK radiant and editing Return to Castle Wolfenstein to make single player levels and mod&#8217;s.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Entities_Needed\"><\/span>Entities Needed<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The simplest way to kill an AI via a triggered event  is to use a series of brush based &quot;<b>trigger_<\/b>&quot; entities chained together. Brush based entities are normal brush volumes that are &#8216;flagged&#8217; or &#8216;converted&#8217; to brush entities using the Right Mouse Button (grid view) pop-up menu. For this chain to work two are needed; a <b>trigger_once<\/b> and a <b>trigger_hurt<\/b>.<\/p>\n<p>Draw out two normal brush volumes, select one, RMB to open the entity menu and  convert it in to a &quot;<b>trigger_once<\/b>&quot; via the &quot;<b>trigger &gt; trigger_once<\/b>&quot; option. Deselect and do the same for the other brush volume this time converting it in to a &quot;<b>trigger_hurt<\/b>&quot; via the &quot;<b>trigger &gt; trigger_hurt<\/b>&quot; menu option. Deselect. Also needed is a &quot;<b>target_relay<\/b>&quot;, so RMB click and place a one of those via the &quot;<b>target &gt; target_relay<\/b>&quot; menu option.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Entity_Setup_Positioning\"><\/span>Entity Setup &amp; Positioning <span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The entity set-up, their connection along the chain are important, else the triggered action won&#8217;t work, or, the wrong AI will be killed (namely the player). To kill a specific AI in a level, position the &#8216;<i>ai_<\/i>&#8216; entity <b><i>inside<\/i><\/b> the trigger_hurt &#8211; the brush volume needs be big enough to completely envelope the entity with room on all sides to allow for any  movement by the AI if\/when it activates any default animation sequences in default mode.<\/p>\n<p>Place the &#8216;<i>trigger_once<\/i>&#8216; where it&#8217;s to be triggered by the  player and then put the &#8216;<i>target_relay<\/i>&#8216; near it or the trigger_hurt &#8211; make sure that the relay isn&#8217;t submerged in any type of level brushwork (walls and so on). See below.<\/p>\n<div class=\"content_images\"><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/ai-kill-entity-positions.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/ai-kill-entity-positions_sml.jpg\" alt=\"Position of entities used to kill and AI in RtCW single player levels\" width=\"428\" height=\"291\" border=\"0\" title=\"Position of entities used to kill and AI in RtCW single player levels\" \/><\/a><\/p>\n<p>Position of entities used to kill and AI in RtCW single player levels<\/p>\n<\/p><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Entity_Chain_Connections\"><\/span>Entity Chain Connections<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In addition to the position of entities, their relative connections are also important because the player needs to trigger the &#8216;hurt&#8217; entity and not have that self-affecting; this is why a &#8216;relay&#8217; is used, it acts as a go-between so the triggered action doesn&#8217;t backfire onto the player.<\/p>\n<p>To correctly set up the chain connections, <i>select the &#8216;trigger_once&#8217; <b>first<\/b><\/i> and <i>then the &#8216;target_relay&#8217;<\/i>, press &quot;<b>Ctrl+K<\/b>&quot; to connect those entities. Once done, select the target_relay, then the trigger_hurt, pressing Ctrl_K to connect those two entities together &#8211;  this should result in &quot;<b>trigger_once &gt; target_relay &gt; trigger_hurt<\/b>&quot;, no other connections are necessary; so long as the ai_ is inside the trigger_hurt, when that fires the AI will be killed.<\/p>\n<div class=\"content_images\"><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/ai-kill-entity-connections.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/ai-kill-entity-connections_sml.jpg\" alt=\"Correct entity connection to kill and ai with a trigger event\" width=\"428\" height=\"291\" border=\"0\" title=\"Correct entity connection to kill and ai with a trigger event\" \/><\/a><\/p>\n<p>Correct entity connection to kill and ai with a trigger event<\/p>\n<\/p><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Entity_KeyValue_Pairs\"><\/span>Entity Key\/Value Pairs<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The trigger_hurt  needs to have a damage ability associated with it, a key\/value pairing that&#8217;s higher than any health value that might be applied to the AI to be killed &#8211; this is what actually &#8216;kills&#8217; the AI so keep in mind that different AI have different default health values, a SuperSoldat is much stronger than a standard foot soldier for example. Using the &#8216;<b>Entity Inspector<\/b>&#8216; add the &quot;<b>key\/value<\/b>&quot; pair of &quot;<b>dmg\/<i>[n]<\/i><\/b>&quot; (where &quot;[n]&quot; is a number above &quot;100&quot;) to the selected trigger_hurt entity as shown below.<\/p>\n<p>Additional required settings include; &quot;<b>start_off<\/b>&quot; to force the trigger_hurt to  activate only when triggered  as well as preventing issues where the trigger entity activates on load  before the AI is present (the order in which entities are loaded into a map are not always &#8216;logical&#8217; or &#8216;hierarchical&#8217;); &quot;<b>silent<\/b>&quot; so  no &#8216;death&#8217; noise is heard by the player on trigger activation; &quot;<b>no_protection<\/b>&quot; to ignore any additional script or entity based settings (an otherwise &#8216;invulnerable&#8217; ai_  will be killed); and &quot;<b>once<\/b>&quot; so the trigger is destroyed after use to prevent accidental re-triggering.<\/p>\n<div class=\"content_images\"><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/ai-kill-entity-key-values.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/ai-kill-entity-key-values_sml.jpg\" alt=\"Adding a &quot;dmg&quot; damage value to the trigger_hurt to kill the AI\" width=\"428\" height=\"271\" border=\"0\" title=\"Adding a &quot;dmg&quot; damage value to the trigger_hurt to kill the AI\" \/><\/a><\/p>\n<p>Adding a &quot;dmg&quot; damage value to the trigger_hurt to kill the AI<\/p>\n<\/p><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Compile_Test_Map\"><\/span>Compile  &amp; Test Map<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Use &quot;<b>spdevmap <i>[mapname]<\/i><\/b>&quot; from the in-game console to load up the test map in developers mode, walking between the two pillars will trigger each scenario; the soldier is correct so the player activating the trigger_once will kill the AI inside the trigger_hurt. On the other hand, the player walking between the pillars in front of the Super Soldat will be killed because the trigger &#8216;backfires&#8217; onto the player due to it being incorrectly set up.<\/p>\n<div class=\"content_images\"><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/killing-ai-with-an-entity-chain.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/killing-ai-with-an-entity-chain_sml.jpg\" alt=\"Killing an enemy AI using entities in RtCW single player levels\" width=\"428\" height=\"271\" border=\"0\" title=\"Killing an enemy AI using entities in RtCW single player levels\" \/><\/a><\/p>\n<p>Killing an enemy AI using entities in RtCW single player levels. trigger_once[1] connected to a target_relay[2], which is in turn is connected to the trigger_hurt[3] used to kill the ai_soldier[4].<\/p>\n<p>              <a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/in-game-ai-lives.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/in-game-ai-lives_sml.jpg\" alt=\"In game. Soldier AI is alive and alert - note the pose as a result of defaul animations\" width=\"428\" height=\"253\" border=\"0\" title=\"In game. Soldier AI is alive and alert - note the pose as a result of defaul animations\" \/><\/a><\/p>\n<p>Running the trigger kill test map inside RtCW in spdevmap mode. The trigger_once brush is set between the two pillars either side of the screen, the soldier AI being alive and alert at load time &#8211; note the pose as a result of default animations being active due to the proximity of the player<\/p>\n<p>              <a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/in-game-ai-trigger-hurt-kill.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/rtcw-killing-ai-entity-chain\/in-game-ai-trigger-hurt-kill_sml.jpg\" alt=\"AI killed by player walking through trigger_once which activate the chain and kills the soldier\" width=\"428\" height=\"253\" border=\"0\" title=\"AI killed by player walking through trigger_once which activate the chain and kills the soldier\" \/><\/a><\/p>\n<p>The AI is killed as soon as the player walks through the trigger_once brush volume which activate the entity chain killing the soldier. The same principle can be applied to any and all ai_ based entities in RtCW<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1899,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[327,485,129,331,328,106,484,109,108,107,23,483],"class_list":["post-1895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-map","tag-ai","tag-bots","tag-bsp","tag-entities","tag-gtkradiant","tag-inspector","tag-level-design","tag-level-editing","tag-radiant","tag-rtcw","tag-trigger"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/1895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/comments?post=1895"}],"version-history":[{"count":4,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/1895\/revisions"}],"predecessor-version":[{"id":1903,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/1895\/revisions\/1903"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/media\/1899"}],"wp:attachment":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/media?parent=1895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/categories?post=1895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/tags?post=1895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}