User:Wisdurm/Sandbox/36. Citizen Screams and Runs

From Valve Developer Community
< User:Wisdurm‎ | Sandbox
Revision as of 13:00, 31 May 2024 by Wisdurm (talk | contribs) (images work :D)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



Important <a href="?page=entities">entities</a> referenced in this tutorial.
Click on the entity for more info from the Valve Developer Site.


<a href="https://web.archive.org/web/20140725075458/http://developer.valvesoftware.com/wiki/path_corner" target="_new">path_corner</a> | <a href="https://web.archive.org/web/20140725075458/http://developer.valvesoftware.com/wiki/aiscripted_schedule" target="_new">aiscripted_schedule</a> | <a href="https://web.archive.org/web/20140725075458/http://developer.valvesoftware.com/wiki/npc_citizen" target="_new">npc_citizen</a>



36. Citizen Screams and Runs



All basic tutorials are exactly that: basic. They are step by step guides

through each operation, hopefully fully illustrated. Experienced mappers may

find these tedious, but they are essentially designed for newbies. :-) If you haven't used Hammer at all before,

then do some of the ealier tutorials to get the absolute basics.




    In this short tutorial we'll get a citizen to run from one side of the map to the other screaming. This came from a query on my site "I've setup an npc_citizen outside a window, and a trigger_once brush entity inside the room with the window in it. I basically want the guy to run past the window screaming when the player goes through the trigger" (MrXbob). This map does exactly that, though the scream could be improved upon. Tutorial looks at using a path_corner with an NPC and an aiscripted_schedule

  1. Open Hammer, and for a great shortcut, there is already a suitable room :- load up the breaking glass VMF, downoad it <a href="https://web.archive.org/web/20140725075458/http://www.halfwit-2.com/?page=tutorials&id=11">here</a> at the bottom of the page. If you want to make a suitable map, you need a room divided by a wall with windows in.

  2. Click on the Entity tool and select an NPC_citizen. Place it on the other side of the wall to the player, by the left wall, facing right.

  3. Open the Properties and give it a Name

  4. Click on the Entity tool and select and place a path_corner on the right hand side of the map in the top corner.



  5. Open the Properties of the path_corner and give it a Name     pc1

  6. Click on the Entity tool and select an aiscripted_schedule. Place anywhere in the room.

  7. Open the Properties and give it a

    Name      script

    Target NPC     the name of your citizen

    AI state to set     Set state to ALERT

    Schedule to run     Run to Goal Entity

    Goal entity     pc1

  8. Click Apply and close the window.

  9. Open the Properties of your NPC_citizen again:

    Target Path Corner     pc1

    Sleep State     Waiting for input

    Expression Type      Scared

  10. Click on the Flags tab: make sure Fall to ground and Efficient - Don't acquire enemies or avoid obstacles are checked.

  11. Click Apply and close the window.

  12. Click on the Entity tool and select an ambient_generic Place anywhere in the room.

  13. Open the Properties and give it a

    Name      scream

    Sound Name Click on Browse and type scream into the filter, now you can check out the different screams that are available (Look in Sound Type Raw and Game Sounds. As you click on them the sounds play. Pick one you like by clicking OK

  14. To set up the trigger build a brush that the player will walk through using the trigger texture.

  15. Press CTRL+T and select trigger_multiple from the drop down.

    <img src="/web/20140725075458im_/http://www.halfwit-2.com/tutorials/36/trig.jpg">



  16. Open the Properties Click on the Outputs tab and enter the following:

    <img src="/web/20140725075458im_/http://www.halfwit-2.com/tutorials/36/out1.jpg">
    Alerts the citizen entity to input



    <img src="/web/20140725075458im_/http://www.halfwit-2.com/tutorials/36/out2.jpg">
    Runs the aiscripted_schedule



    <img src="/web/20140725075458im_/http://www.halfwit-2.com/tutorials/36/out3.jpg">
    Plays the scream sound



  17. Compile and run the map



<a href="tutorials/36/screamagain.zip">Download the File : screamagain.zip (3.288kb)</a>

Click to <img src="/web/20140725075458im_/http://www.halfwit-2.com/images/laughing5.gif" align="middle"> <a href="https://web.archive.org/web/20140725075458/http://www.halfwit-2.com/phpbb/viewtopic.php?t=49">Comment</a> <img src="/web/20140725075458im_/http://www.halfwit-2.com/images/laughing5.gif" align="middle"> on this tutorial or Click to <img src="/web/20140725075458im_/http://www.halfwit-2.com/images/mad.gif" align="middle"> <a href="https://web.archive.org/web/20140725075458/http://www.halfwit-2.com/phpbb/viewtopic.php?t=40">Complain</a> <img src="/web/20140725075458im_/http://www.halfwit-2.com/images/mad.gif" align="middle">


The next tutorial is "37. Dog Plays Ball" and can be found <a href="?page=tutorials&id=37">here</a>.



<a href="#top">Return to the top of the page


</a>