{"id":15,"date":"2008-04-21T00:01:31","date_gmt":"2008-04-20T22:01:31","guid":{"rendered":"http:\/\/www.elitepigs.de\/blog\/?p=15"},"modified":"2008-04-21T00:04:33","modified_gmt":"2008-04-20T22:04:33","slug":"half-life-2-deathmatch-tutorial-ii-round-gameplay","status":"publish","type":"post","link":"http:\/\/www.elitepigs.de\/blog\/archives\/15","title":{"rendered":"Half-Life 2 Deathmatch Tutorial II: Round Gameplay"},"content":{"rendered":"<p><a href=\"http:\/\/robotriot.hokuten.net\/img\/babelbabel_logo.jpg\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/robotriot.hokuten.net\/img\/babelbabel_logo.jpg\" alt=\"Babel Babel Logo\" \/><\/a><\/p>\n<p>This is the second in my series of HL2DM mapping tutorials.  Today, I will demonstrate a way to restart your map in HL2DM, without losing the teams&#8217; scores and resetting physics objects that might be scattered around your map. We needed such a game mechanic in our mod, because it&#8217;s based on &#8220;rounds&#8221;, where each team can score, and then the map should reset. This is very specific to our mod, but I think you can always use parts of the techniques explained here for your own map. Again, there might be easier ways to do this, but this one works for me so far.<\/p>\n<p><!--more--><\/p>\n<ol>\n<li>Create a <strong>game_score<\/strong> entity, and in its properties, set the name to &#8220;<strong>round_score<\/strong>.&#8221; The Points To Add field contains the amount of points you want to give the winning team, so enter whatever you deem appropriate. In the Flags section, enable <strong>Team Points<\/strong>.<\/li>\n<li>Create a second <strong>game_score<\/strong> entity and call this one &#8220;<strong>equalizer_score<\/strong>.&#8221; This entity will be used as a remedy to regain the points all players lose when they&#8217;re killed at the end of the round.<strong><\/strong><\/li>\n<li>I assume you already have a map complete with spawn points and everything else you need. Now, to make your map reset, you have to create a large brush that covers your entire map. Make it a <strong>trigger_hurt<\/strong>, and open its properties. Name it something like &#8220;<strong>kill_trigger<\/strong>.&#8221; Set Start Disabled to <strong>Yes<\/strong> and Damage to <strong>1000<\/strong>. In the Outputs section, set the Output to <strong>OnHurtPlayer<\/strong>, the Target is <strong>equalizer_score<\/strong> and the input should be <strong>ApplyScore<\/strong>. This gives all players the -1 score back they got for being killed via the trigger.<\/li>\n<li>For testing purposes, we will include a physics object in our map that should be reset to its original spawning position once the level resets. So create a <strong>prop_physics<\/strong> and choose whatever World Model you like. Give it a name, for example &#8220;<strong>the_prop<\/strong>.&#8221;<\/li>\n<li>To make our prop respawnable, we need to add two entities in our map: an <strong>env_entity_maker<\/strong> and a <strong>point_template<\/strong>. Name the point_template &#8220;<strong>prop_template<\/strong>,&#8221; and under Template 1, choose &#8220;<strong>the_prop<\/strong>.&#8221; Give the env_entity_maker a name like &#8220;<strong>prop_spawner<\/strong>.&#8221; In the Point_template to spawn drop-down list, choose <strong>prop_template<\/strong>. Now go to the Flags tab, and make sure <strong>Autospawn: Wait for entity destruction<\/strong> is the only activated flag. This takes care of the respawning of the physics object.<\/li>\n<li>Now we need some event that activates our kill_trigger. In our mod, it&#8217;s simply a trigger on top of a platform that one player has to touch. So create a brush and make it a <strong>trigger_multiple<\/strong> and give it a name like &#8220;<strong>round_restart<\/strong>.&#8221; Next click on the Outputs tab. We have to enter a couple of events now. The first one is to apply the score for this round to the winning team, so select the output <strong>OnStartTouch<\/strong> targeting <strong>round_score<\/strong> via the input <strong>ApplyScore<\/strong>. To reset the physics prop to its original position, simply add the output <strong>OnStartTouch<\/strong>, targeting <strong>the_prop<\/strong> this time and change the input to <strong>Kill<\/strong>. To make all players return to their spawn points, we have to activate our trigger_hurt. So select <strong>OnStartTouch<\/strong> again, with the target <strong>kill_trigger<\/strong> and the input <strong>Enable<\/strong>. Of course we can&#8217;t let the kill_trigger enabled all the time, because then everybody would die and respawn indefinitely. Add another <strong>OnStartTouch<\/strong> output targeting <strong>kill_tigger<\/strong> again, set the input to <strong>Disable<\/strong> and enter <strong>0.2<\/strong> in the After a delay in seconds of-field. The last event we need is to make sure our prop really respawns &#8211; so add an <strong>OnStartTouch<\/strong> output again with the target <strong>prop_spawner<\/strong> this time and the input <strong>ForceSpawn<\/strong>. Here&#8217;s a screenshot for a quick overview of the outputs we just added.<\/li>\n<p><a href=\"http:\/\/www.elitepigs.de\/blog\/wp-content\/uploads\/2008\/04\/hlt2tut-00-00.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-16\" title=\"hlt2tut-00-00\" src=\"http:\/\/www.elitepigs.de\/blog\/wp-content\/uploads\/2008\/04\/hlt2tut-00-00-282x300.gif\" alt=\"Outputs of round_restart\" width=\"282\" height=\"300\" srcset=\"http:\/\/www.elitepigs.de\/blog\/wp-content\/uploads\/2008\/04\/hlt2tut-00-00-282x300.gif 282w, http:\/\/www.elitepigs.de\/blog\/wp-content\/uploads\/2008\/04\/hlt2tut-00-00.gif 464w\" sizes=\"auto, (max-width: 282px) 100vw, 282px\" \/><\/a><\/ol>\n<p>This should be it &#8211; after compiling the map, the player who touches the trigger should reset the map, returning the players and physics prop to their spawning positions as well as scoring for his or her team. Optional game mechanics you might want to include are a round counter, which ends the game after round_restart has been activated a certain amount of times, and a game_text that displays which team has won the round.<\/p>\n<p>Also check out the previous chapter of this tutorial series:<\/p>\n<p><a href=\"http:\/\/www.elitepigs.de\/blog\/archives\/11\">Part I: Making Sure Players Are Ready<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the second in my series of HL2DM mapping tutorials. Today, I will demonstrate a way to restart your map in HL2DM, without losing the teams&#8217; scores and resetting physics objects that might be scattered around your map. We needed such a game mechanic in our mod, because it&#8217;s based on &#8220;rounds&#8221;, where each &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.elitepigs.de\/blog\/archives\/15\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Half-Life 2 Deathmatch Tutorial II: Round Gameplay&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,17,30],"tags":[31,33,81],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-gamedev","category-games","category-tutorials","tag-babel-babel","tag-half-life-2","tag-tutorials","entry"],"_links":{"self":[{"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":0,"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.elitepigs.de\/blog\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}