Aiscripted schedule

From Valve Developer Community
Revision as of 20:45, 7 December 2019 by Darkdoom (talk | contribs)
Jump to navigation Jump to search
English (en)Hrvatski (hr)Translate (Translate)
Aiscripted schedule.png

Template:Base point It issues a command to an NPC without suppressing its normal AI routines.

Not available in Left 4 Dead seriesLeft 4 Dead series.

C++ In code, it is represented by theCAI_ScriptedScheduleclass, defined in thescripted.cppfile.

Flags

  • 4: Repeatable
  • 1024: Search Cyclically - If the target parameters can apply to more than one entity, the aiscripted_schedule will normally select one of these targets to affect at random each time it is triggered. Checking this flag will instead make it cycle through a list of them, affecting all the entities in order as it is triggered. This is useful for making sure that every member of the group will eventually be affected, especially when targeting the schedule to affect multiple spawns.
  • 2048: Don't Complain - the following messages will be suppressed:
    • Found <entity>, but can't play!
    • ScheduledMoveToGoalEntity to goal entity <entity> failed, can't execute script <this>
    • ScheduledFollowPath to goal entity <entity> failed, can't execute script <this>

Keyvalues

Target NPC (m_iszEntity) ([todo internal name (i)]) <targetname>
The name or classname of an NPC to command.
Search Radius (0=everywhere) (m_flRadius) ([todo internal name (i)]) <float>
Radius to search within for an NPC to command.
All in radius (graball) ([todo internal name (i)]) <boolean>
Whether to grab all matching NPCs in the specified radius, or just the first one found.
AI state to set (forcestate) ([todo internal name (i)]) <choices>
Overrides the NPC's current alertness state.
  • 0: <None>
  • 1: Idle
  • 2: Alert
  • 3: Combat
Schedule to run (schedule) ([todo internal name (i)]) <choices>
Which AI schedule to run.
  • 0: <None>
  • 1: Walk to Goal Entity (see below)
  • 2: Run to Goal Entity
  • 3: Set enemy to Goal Entity
  • 4: Walk Goal Path
  • 5: Run Goal Path
  • 6: Set enemy to Goal Entity AND Run to Goal Entity
Interruptability (interruptability) ([todo internal name (i)]) <choices>
What can cause the NPC to give up on this schedule?
  • 0: General
  • 1: Damage or Death
  • 2: Death
Goal entity (goalent) ([todo internal name (i)]) <targetname>
Provides the name of a goal entity, used by some schedules.
PlacementTip.gifPlacement Tip:You can use the schedule entity itself as the goal entity.


Inputs

StartSchedule
Starts the scripted schedule. This will first locate an NPC that matches the given target, then tell the NPC to run the specified schedule.
StopSchedule  !FGD
Tells NPC targets to stop running this schedule.


Outputs

Tips

  • If you using it for striders, make sure that you placed info_node_air_hint and selected type: Strider node, otherwise it won't work. For striders nodes should be in air and under path_corner to make it work.
  • Actually always make sure that you have enough nodes and they just sligtly a bit under ground, so npc won't fall underneath. If you have not enough, you can get error like "Bogus Route Move Type" in -dev mode or just standing npc's, path_corner doesn't require info_node, but when y missing them, it can cause serious problems in real in game situations.
  • Always make sure that first path to which ai should schedule his move is in 576 units range, otherwise it won't work.
  • Quite common mistake is when in aiscripted_schedule keyvalue Schedule to run not changed from Walk/Run to Goal Entity to Walk/Run Goal Path. Always make sure you did it.

See also