Thursday, August 23, 2012

Tutorial: Settings NPCs In Motion

In this post I'm going to describe to a simple way to set your NPCs into motion. We'll be using NPC routes.

To begin with open up World Editor and make sure that the urban_newbieland primitive is loaded. It would be exceptionally helpful to have the newbieland.land file loaded as well so that you can visualize the continent as you draw your paths and zones.


Creating an NPC Path

  1. Navigate to rangers_starting_city (the npc_manager)
  2. Right click on rangers_starting_city and choose npc_route
    1. Provide a name, e.g. patrol_npcs
    2. Set AI Activity to either guard or normal.
    3. Set AI Movement to follow_route
    4. Set vertical_pos to auto.
  3. Ensure that patrol_npcs is selected
    1. Enter Edit Point mode
    2. Enable Add Points
    3. Draw your path.
  4. Right click on patrol_npcs and add a new NPC Group
  5. Name it "guard_npcs"
  6. Right click on guard_npcs and add a new NPC Bot
    1. Name it newbieland_guard_patrol - ensure the name is unique if you add multiple bots.
    2. Set the sheet_client, e.g. company_of_the_drill_loge_master_z_h_b1
    3. Set vertical_pos to auto
    4. You may also set chat_parameters if necessary and equipment if you want to customize equipment or colors. For reference see chiang_the_strong.
    5. Move the point representing the bot(s) to somewhere near the beginning of the path.
  7. Next you will have to enable the NPC event handling.
    1. Right click on patrol_npcs and add a new npc_state_event_handler
    2. Name it "destination_reached_all"
    3. Set the event to destination_reached_all
    4. Right click on the new event handler and add a new npc_event_handler_action
      1. Name it "begin_state"
      2. Set the action to begin_state
      3. Set the parameters to patrol_npcs
  8. Save the primitive and reboot your EGS and AIS. A full shard reboot is recommended to simplify potential problems during content development.

No comments:

Post a Comment