{"id":370,"date":"2013-09-10T18:52:07","date_gmt":"2013-09-10T23:52:07","guid":{"rendered":"http:\/\/nslotnick.com\/?p=370"},"modified":"2014-09-08T02:13:27","modified_gmt":"2014-09-08T07:13:27","slug":"city-17-td","status":"publish","type":"post","link":"http:\/\/nslotnick.com\/?p=370","title":{"rendered":"City 17 TD"},"content":{"rendered":"<p><center><iframe loading=\"lazy\" src=\"\/\/www.youtube.com\/embed\/K1chlKqeW5U?rel=0\" height=\"480\" width=\"853\" allowfullscreen=\"\" frameborder=\"0\" align=\"middle\"><\/iframe><\/center><\/p>\n<table width=\"865\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"300\">Summary<\/p>\n<ul>\n<li>Name: City 17 Tower Defense<\/li>\n<li>Development Time: 120+ Hours (WIP)<\/li>\n<li>Genre: Tower Defense<\/li>\n<li>Playtime: 10 minutes<\/li>\n<li>Engine:Hammer<\/li>\n<\/ul>\n<\/td>\n<td>Download<br \/>\n<a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2014\/03\/City17TD.zip\" class=\"button orange \" target=\"_\"><span>.zip File<\/span><\/a><\/td>\n<td width=\"300\">Design Goals<\/p>\n<ul>\n<li>Built a Hammer Level, without mods, that plays like a tower defense game<\/li>\n<li>Scripted a resource system<\/li>\n<li>Scripted a spawn waves system<\/li>\n<li>Scripted a &#8216;Tower&#8217; spawn system<\/li>\n<\/ul>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 class=\"trigger toggle-white\"><a href=\"#\">Layout\/Design<\/a><\/h3><div class=\"toggle_container\"><\/p>\n<p><div id=\"attachment_18\" style=\"width: 940px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-2.jpg\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-18\" class=\"size-large wp-image-18\" alt=\"A top down and side view of the map.\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-2-1024x576.jpg\" width=\"930\" height=\"523\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-2-1024x576.jpg 1024w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-2-300x168.jpg 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-2.jpg 1431w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/a><p id=\"caption-attachment-18\" class=\"wp-caption-text\">A top down and side view of the map in editor.<\/p><\/div><\/p>\n<p>The layout of the map is a simple course that takes enemy NPC&#8217;s past tower positions. Alyx serves as the players life with a glowing orb above her head to indicate her health, green while healthy and red when hurt. Each wave increasing in Health and number with 10 waves in total. At the end of the 3rd and 6th waves Alyx will run further down the course giving the player more time to deal with each wave. Resource is gathered by killing enemies with towers and a small amount is given at the start to facilitate the building of a tower or two.<br \/>\n<\/div>\n<h3 class=\"trigger toggle-gray\"><a href=\"#\">Scripting: Resource System Wiki<\/a><\/h3><div class=\"toggle_container\"><br \/>\nThe following wiki entry was created after research and prototyping of the resource system for City 17 TD<\/p>\n<p>&nbsp;<\/p>\n<h2>Building a Resource System<\/h2>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-746\" alt=\"BRSOverview\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview-1024x266.png\" width=\"930\" height=\"241\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview-1024x266.png 1024w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview-300x78.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview-980x255.png 980w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview-530x138.png 530w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/BRSOverview.png 1071w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/a><\/p>\n<h2>Overview<\/h2>\n<p>This tutorial covers the creation of a resource system that can be added to and subtracted from. This can be used for any kind of game where time, counting, or gathering and spending resources is desired. Once the skeleton of the system is set up triggering additions or subtractions is a simple task.<br \/>\nYou will need the following entities to perform this task<\/p>\n<ul>\n<li>3 game_text entities<\/li>\n<li>3 logic_case entities<\/li>\n<li>3 math_counter entities<\/li>\n<li>1 logic_timer entity<\/li>\n<li>2 func_button entities or some other method of interacting with the system<\/li>\n<\/ul>\n<h2>Setting up entities<\/h2>\n<h3>Game_text<\/h3>\n<p>The game_text entities are the simplest entities we need to set up.<br \/>\nThey will occupy the 1\u2019s, 10\u2019s, and 100\u2019s portions of the resource<br \/>\nvalue.<\/p>\n<p>Set up each of the three game_text entities as such<\/p>\n<h4>Class Info<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSgame_text.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-748\" alt=\"NSgame_text\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSgame_text.png\" width=\"701\" height=\"527\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSgame_text.png 701w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSgame_text-300x225.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSgame_text-530x398.png 530w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/a><\/p>\n<p>Add 3 game_text entities and set up their values as such<\/p>\n<ul>\n<li>Name: use any three names with each one representing a digit slot. ex. txt_text1s, txt_text10s, txt_text100s<\/li>\n<li>Message Text: set to either &#8220;0&#8221; or if filling in the 100&#8217;s slot &#8220;&lt;Resource Name&gt; 0&#8221;.<\/li>\n<li>Fade In: 0<\/li>\n<li>Fade Out: 0<\/li>\n<li>Hold Time: 0.125<\/li>\n<li>Text Channel: use a unique channel for each game_text entity. I used 1 through 3.<\/li>\n<\/ul>\n<p>Once setup your done with the game_text entities.<\/p>\n<p>&nbsp;<\/p>\n<h3>Math_counter<\/h3>\n<p>The math_counter entities are doing the actual keeping of the values for the 1\u2019s, 10\u2019s, and 100\u2019s. They will also be broadcasting their value to the logic_case entities. As well as managing the movement of digits from one math_counter to another.<\/p>\n<p>Set up each of the three math_counter entities as such<\/p>\n<h4>Class Info<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_classinfo.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-749\" alt=\"NSmath_counter_classinfo\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_classinfo.png\" width=\"676\" height=\"505\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_classinfo.png 676w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_classinfo-300x224.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_classinfo-530x395.png 530w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/a><\/p>\n<ul>\n<li>Name: again name them different names with each one representing a digit slot. ex. math_count1s, math_count10s, math_count100s<\/li>\n<li>Initial Value: 1<\/li>\n<li>Minimum Legal Value: 0<\/li>\n<li>Maximum Legal Value: 11<\/li>\n<\/ul>\n<p>The counter is set up to go from 1 to 10 with a buffer number in front and in back. This is done to allow for rolling up and down without compromising the value stored within.<br \/>\nThis should become clearer once we get to the&#8230;<\/p>\n<h4>Outputs<\/h4>\n<p>Each Output is configured differently.<\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output1.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-750\" alt=\"NSmath_counter_output1\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output1.png\" width=\"677\" height=\"495\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output1.png 677w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output1-300x219.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output1-530x387.png 530w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/a><\/p>\n<p>For the 1s counter add the following outputs.<\/p>\n<ul>\n<li>Name: OnHitMax<\/li>\n<li>Target: this counter<\/li>\n<li>Input: SetValue: 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OnHitMax<\/li>\n<li>Target: the 10&#8217;s counter<\/li>\n<li>Input: Add: 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OnHitMin<\/li>\n<li>Target: this counter<\/li>\n<li>Input: SetValue: 10<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OnHitMin<\/li>\n<li>Target: the 10&#8217;s counter<\/li>\n<li>Input: Subtract: 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OutValue<\/li>\n<li>Target: the logic_case for the 1s<\/li>\n<li>Input: InValue<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Basically, this says if the counter reaches max (11) then set this counter to 1 (value for 0) and add 1 to the 10&#8217;s counter. If you hit the minimum set this counter to 10 (value for 9) and subtract 1 from the 10&#8217;s counter.<\/p>\n<p>The last output, the OutValue to the logic_case, is to update the game_text with what is contained inside the logic_case. This will be explained in more detail in the logic_case section.<\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output10.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-751\" alt=\"NSmath_counter_output10\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output10.png\" width=\"678\" height=\"502\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output10.png 678w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output10-300x222.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output10-530x392.png 530w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/a><\/p>\n<p>For the 10s counter add the following outputs.<\/p>\n<ul>\n<li>Name: OnHitMax<\/li>\n<li>Target: this counter<\/li>\n<li>Input: SetValue: 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OnHitMax<\/li>\n<li>Target: the 100&#8217;s counter<\/li>\n<li>Input: Add: 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OnHitMin<\/li>\n<li>Target: this counter<\/li>\n<li>Input: SetValue: 10<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OnHitMin<\/li>\n<li>Target: the 100&#8217;s counter<\/li>\n<li>Input: Subtract: 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Name: OutValue<\/li>\n<li>Target: the logic_case for the 1s<\/li>\n<li>Input: InValue<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>This says if the counter reaches max (11) then set this counter to 1 (value for 0) and add 1 to the 100&#8217;s counter. If you hit the minimum set this counter to 10 (value for 9) and subtract 1 from the 100&#8217;s counter.<\/p>\n<p>The last output, the OutValue to the logic_case, is to update the game_text with what is contained inside the logic_case. This will be explained in more detail in the logic_case section.<\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output100.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-752\" alt=\"NSmath_counter_output100\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output100.png\" width=\"675\" height=\"499\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output100.png 675w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output100-300x221.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_counter_output100-530x391.png 530w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/a><\/p>\n<p>For the 100s counter add the following outputs.<\/p>\n<ul>\n<li>Name: OutValue<\/li>\n<li>Target: the logic_case for the 1s<\/li>\n<li>Input: InValue<\/li>\n<\/ul>\n<p>The purpose of the OutValue to the logic_case is to update the game_text with what is contained inside the logic_case. This will be explained in more detail in the logic_case section.<\/p>\n<h3>Logic_case<\/h3>\n<p>The logic_case entities are what take the number from the counter and turn it into a value that is readable by the game_text entities, as the math_counter entities are integers and the game_text is a string.<br \/>\nEach value from 0 to 9 must be accounted for.<\/p>\n<h4>Class Info<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_classinfo.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-753\" alt=\"NSmath_case_classinfo\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_classinfo.png\" width=\"679\" height=\"502\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_classinfo.png 679w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_classinfo-300x221.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_classinfo-530x391.png 530w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/a><\/p>\n<p>For each logic_case do the following<\/p>\n<ul>\n<li>Name: Name them different names with each one representing a digit slot. ex. log_case1s, log_case10s, log_case100s<\/li>\n<li>Case 01: 1<\/li>\n<li>Case 02: 2<\/li>\n<li>Case 03: 3<\/li>\n<li>Case 04: 4<\/li>\n<li>Case 05: 5<\/li>\n<li>Case 06: 6<\/li>\n<li>Case 07: 7<\/li>\n<li>Case 08: 8<\/li>\n<li>Case 09: 9<\/li>\n<li>Case 10: 10<\/li>\n<\/ul>\n<p>Even though the math_counters we setup went from 0 to 11 we are only interested in 1 to 10. The 0 and the 11 values are held to allow the counter to go from 9 to 0 or 0 to 9 while adding\/subtracting 1 from the next highest digit (see Math_counter for more info)<\/p>\n<h4>Outputs<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-754\" alt=\"NSmath_case_output\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output.png\" width=\"676\" height=\"503\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output.png 676w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output-300x223.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output-530x394.png 530w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/a><br \/>\nFor the 1&#8217;s and 10&#8217;s logic_case entities create the following outputs<\/p>\n<ul>\n<li>Output: OnCase01<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 0<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase02<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase03<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 2<\/li>\n<\/ul>\n<p>*Output: OnCase04<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 3<\/li>\n<\/ul>\n<p>*Output: OnCase05<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 4<\/li>\n<\/ul>\n<p>*Output: OnCase06<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 5<\/li>\n<\/ul>\n<p>*Output: OnCase07<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 6<\/li>\n<\/ul>\n<p>Output: OnCase08<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 7<\/li>\n<\/ul>\n<p>Output: OnCase09<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 8<\/li>\n<\/ul>\n<p>Output: OnCase10<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message 9<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>These outputs will change the text value stored in the game_text it targets.<\/p>\n<p>For the 100&#8217;s logic_case there is a small change.<\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output100.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-755\" alt=\"NSmath_case_output100\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output100.png\" width=\"678\" height=\"501\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output100.png 678w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output100-300x221.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSmath_case_output100-530x391.png 530w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/a><\/p>\n<p>For the 1&#8217;s and 10&#8217;s logic_case entities create the following outputs<\/p>\n<ul>\n<li>Output: OnCase01<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 0<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase02<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 1<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase03<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 2<\/li>\n<\/ul>\n<p>*Output: OnCase04<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 3<\/li>\n<\/ul>\n<p>*Output: OnCase05<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 4<\/li>\n<\/ul>\n<p>*Output: OnCase06<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 5<\/li>\n<\/ul>\n<p>*Output: OnCase07<\/p>\n<ul>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 6<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase08<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 7<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase09<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 8<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnCase10<\/li>\n<li>Target: either the 1&#8217;s or 10&#8217;s game_text depending on which case this is for<\/li>\n<li>Input: AddOutput<\/li>\n<li>Parameter: message Resource 9<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>These outputs will change the text value stored in the game_text it targets.<\/p>\n<h3>Logic_timer<\/h3>\n<p>The logic_timer entity controls the refresh rate of the game_text entities.<\/p>\n<h4>Class Info<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_classinfo.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-756\" alt=\"NSlogic_timer_classinfo\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_classinfo.png\" width=\"679\" height=\"506\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_classinfo.png 679w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_classinfo-300x223.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_classinfo-530x394.png 530w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/a><\/p>\n<ul>\n<li>Name: log_timer or any other representative name<\/li>\n<li>Refire Interval: 0.1<\/li>\n<\/ul>\n<p>With a refire interval of 0.1 this timer will fire 10 times a second.<\/p>\n<h4>Outputs<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_output.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-757\" alt=\"NSlogic_timer_output\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_output.png\" width=\"680\" height=\"505\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_output.png 680w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_output-300x222.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSlogic_timer_output-530x393.png 530w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<ul>\n<li>Output: OnTimer<\/li>\n<li>Target: game_text for the 1&#8217;s<\/li>\n<li>Input: Display<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnTimer<\/li>\n<li>Target: game_text for the 10&#8217;s<\/li>\n<li>Input: Display<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Output: OnTimer<\/li>\n<li>Target: game_text for the 100&#8217;s<\/li>\n<li>Input: Display<\/li>\n<\/ul>\n<p>With these outputs, the game_text will update every time the timer goes off (every 0.1 seconds)<\/p>\n<h3>Func_button<\/h3>\n<p>The func_button is a placeholder for any other entity that you want to initiate the adding or subtracting.<\/p>\n<h4>Outputs<\/h4>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_add.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-758\" alt=\"NSbutton_add\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_add.png\" width=\"682\" height=\"504\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_add.png 682w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_add-300x221.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_add-530x391.png 530w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_sub.png\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-759\" alt=\"NSbutton_sub\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_sub.png\" width=\"680\" height=\"499\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_sub.png 680w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_sub-300x220.png 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/NSbutton_sub-530x388.png 530w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<p>The outputs at this point are a bit different. There is only one output that can be repeatedly used depending on how many points you wish to add\/subtract. In the examples above if you hit the add button it adds 7 while the subtract button removes 5.<\/p>\n<ul>\n<li>Output: OnPressed (or any other action you wish to award\/use resources for)<\/li>\n<li>Target: math_counter for the 1&#8217;s. ex. math_count1s<\/li>\n<li>Input: Add or Subtract<\/li>\n<li>Parameter: 1<\/li>\n<li>Delay: The first Output has a delay of 0.00 with each consecutive output having an additional 0.02 (this is cumulative, See example images)<\/li>\n<\/ul>\n<p>Reminder: These outputs can be added to any button, enemy death, etc. These outputs must follow this format.<\/p>\n<h2>Running the Resource System<\/h2>\n<ul>\n<li>Click on the add button to add to the total.<\/li>\n<li>Click the subtract button to remove from the total.<\/li>\n<\/ul>\n<p><\/div>\n<h3 class=\"trigger toggle-white\"><a href=\"#\">Scripting: Towers<\/a><\/h3><div class=\"toggle_container\">\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-4.jpg\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-20\" alt=\"\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-4-1024x576.jpg\" width=\"930\" height=\"523\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-4-1024x576.jpg 1024w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-4-300x168.jpg 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-4.jpg 1431w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/a><\/p>\n<p>This is the spawning system for ally towers, as well as the resource system and game wave managers. The allies are housed inside of a trigger, when a tower is called the npc spawns right where it&#8217;s standing in the image, gets scooped up by the trigger and teleported to the proper location. The resource system is explained above.<\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button.jpg\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-783\" alt=\"teleport button\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button-1024x421.jpg\" width=\"930\" height=\"382\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button-1024x421.jpg 1024w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button-300x123.jpg 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button-980x403.jpg 980w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button-530x218.jpg 530w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/09\/teleport-button.jpg 1716w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/a><\/p>\n<p>The towers were built as a prefab and then placed on the map. As part of the prefab, I inserted script nodes to facilitate the prefabs role as a Tower.\u00a0 As an example of one of the functions of building towers this way, each of the scripted elements can be coded to automatically assign sequential numbers to each new prefab&#8217;d script if given the correct characters(&amp;&amp; in hammer). Teleporting it to the right tower platform is accomplished by the buying action&#8217;s script. Each button changes the destination of teleport_ally to the teleport_dest_# that it is built with. So as each new tower platform is created all of it&#8217;s component pieces are built with it as well.<\/p>\n<p><\/div><h3 class=\"trigger toggle-gray\"><a href=\"#\">Scripting: Wave Spawn System<\/a><\/h3><div class=\"toggle_container\"><\/p>\n<p><a href=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-3.jpg\" rel=\"lightbox[370]\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-19\" alt=\"This is the basic arrangement of the spawning system for the enemy. Each different enemy has a set of triggers and counters used in spawning waves of enemies.\" src=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-3-1024x576.jpg\" width=\"930\" height=\"523\" srcset=\"http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-3-1024x576.jpg 1024w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-3-300x168.jpg 300w, http:\/\/nslotnick.com\/wp-content\/uploads\/2013\/04\/City-17-TD-3.jpg 1431w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/a><br \/>\nThis is the spawning system for the enemies.<\/p>\n<p>A wave relies on a single Relay that when called would spawn a predetermined number of enemies with a specific amount of health.<\/p>\n<p>As the game progresses a counter keeps track of the wave number and when a wave is completed it prepares the next wave for deployment.<\/p>\n<p>This happens in a loop until either the victory\u00a0 after 10 waves or the loss condition is achieved.<\/p>\n<p><\/div><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary Name: City 17 Tower Defense Development Time: 120+ Hours (WIP) Genre: Tower Defense Playtime: 10 minutes Engine:Hammer Download Design Goals Built a Hammer Level, without mods, that plays like a tower defense game Scripted a resource system Scripted a spawn waves system Scripted a &#8216;Tower&#8217; spawn system &nbsp; &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,23],"tags":[],"class_list":["post-370","post","type-post","status-publish","format-standard","hentry","category-individual","category-scripting"],"_links":{"self":[{"href":"http:\/\/nslotnick.com\/index.php?rest_route=\/wp\/v2\/posts\/370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nslotnick.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nslotnick.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nslotnick.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nslotnick.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=370"}],"version-history":[{"count":35,"href":"http:\/\/nslotnick.com\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions"}],"predecessor-version":[{"id":812,"href":"http:\/\/nslotnick.com\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions\/812"}],"wp:attachment":[{"href":"http:\/\/nslotnick.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nslotnick.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=370"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nslotnick.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}