This article's documentation is for anything that uses the Source engine. Click here for more information.

Aiscripted schedule: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Formatting, again)
(→‎Keyvalues: choices data type)
 
(45 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{wrongtitle|title=aiscripted_schedule}}
{{LanguageBar}}
==Entity Description==
{{CD|CAI_ScriptedSchedule|file1=scripted.cpp}}
'''Entity Name:''' aiscripted_schedule
{{this is a|point entity|name=aiscripted_schedule|except=Left 4 Dead series|sprite=1}}
It issues a command to an [[NPC]] without suppressing its normal AI routines.


Issues a command to an NPC without taking the NPC out of its AI. This does not seize control of the NPC as a scripted_sequence does.
This entity is often used to make a NPC travel to a specific location or follow a [[path_corner]] track.


==Entity Values==
{{ModernPlacementTip|A NPC can follow a tight path_corner track without requiring a [[nodegraph]], but this is not recommended since a nodegraph is still needed for NPCs to navigate around corners or move freely.}}
===Keys===


* '''Name''' ''targetname <target_source>'' 
{{clearleft}}
** The name that other entities refer to this entity by.
* '''Target NPC''' ''m_iszEntity <target_destination>''
** The name or classname of an NPC to use.
* '''Search Radius (0=everywhere)''' ''m_flRadius <integer>''
** Radius to search within for an NPC to use. 0 searches everywhere.
* '''All in radius''' ''graball <choices>''
** Whether to grab all matching NPCs in the specified radius, instead of just one
* '''spawnflags''' ''spawnflags <flags>''
* '''AI state to set''' ''forcestate <choices>''
* '''Schedule to run''' ''schedule <choices>''
* '''Interruptability''' ''interruptability <choices>''
* '''Goal entity''' ''goalent <target_destination>''
** Provides the name of a schedule-specific goal entity (see 'Schedule to run')


===Inputs===
==Flags==
{{fl|4|Repeatable}}
{{fl|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.}}
{{fl|2048|Don't Complain|The following messages will be suppressed:
:*<code>Found <entity>, but can't play!</code>
:*<code>ScheduledMoveToGoalEntity to goal entity <entity> failed, can't execute script <this></code>
:*<code>ScheduledFollowPath to goal entity <entity> failed, can't execute script <this></code>}}


* '''Kill'''
==Keyvalues==
** Removes this entity from the world.
{{KV Targetname}}
* '''KillHierarchy''' 
{{KV|Target NPC|intn=m_iszEntity|targetname|The name or classname of an NPC to command.}}
** Removes this entity and all its children from the world.
{{KV|Search Radius (0{{=}}everywhere)|intn=m_flRadius|float|Radius to search within for an NPC to command.}}
* '''AddOutput''' ''<string> <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>''
{{KV|All in radius|intn=graball|bool|Whether to grab all matching NPCs in the specified radius, or just the first one found.}}
** Adds an entity I/O connection to this entity. Very dangerous, use with care
{{KV|AI state to set|intn=forcestate|integer choices|Overrides the NPC's current alertness state.
* '''FireUser1'''
:*0: <None>
** Causes this entity's OnUser1 output to be fired.
:*1: Idle
* '''FireUser2'''
:*2: Alert
** Causes this entity's OnUser2 output to be fired.
:*3: Combat}}
* '''FireUser3'''
{{KV|Schedule to run|intn=schedule|integer choices|Which AI schedule to run.
** Causes this entity's OnUser3 output to be fired.
:*0: <None>
* '''FireUser4'''
:*1: Walk to Goal Entity (see below)
** Causes this entity's OnUser4 output to be fired.
:*2: Run to Goal Entity
* '''StartSchedule'''
:*3: Set enemy to Goal Entity
** Starts the scripted schedule. This will first locate an NPC that matches the given target, then tell the NPC to run the specified schedule.
:*4: Walk Goal [[path_corner|Path]]
:*5: Run Goal Path
:*6: Set enemy to Goal Entity AND Run to Goal Entity
}}
{{KV|Interruptability|intn=interruptability|integer choices|What can cause the NPC to give up on this schedule?
:*0: General
:*1: Damage or Death
:*2: Death}}
{{KV|Goal entity|intn=goalent|targetname|Provides the name of a goal entity, used by some schedules. {{PlacementTip|You can use the schedule entity itself as the goal entity.}} }}


===Outputs===
==Inputs==
{{I|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.}}
{{I|StopSchedule|nofgd=1|Tells NPC targets to stop running this schedule.}}


* '''OnUser1'''
==See also==
** Fired in response to FireUser1 input.
* {{ent|scripted_sequence}} (for seizing complete control of the NPC)
* '''OnUser2'''
* [[Assaults]] (for combat)
** Fired in response to FireUser2 input.
* [[npc_citizen_fleeing]] - A prefab that demonstrates scheduled behavior.
* '''OnUser3'''
** Fired in response to FireUser3 input.
* '''OnUser4'''
** Fired in response to FireUser4 input.


[[category:AI]]
[[Category:AI]]
[[category:Entities]]

Latest revision as of 07:54, 3 May 2025

English (en)Hrvatski (hr)Translate (Translate)
C++ Class hierarchy
CAI_ScriptedSchedule
CBaseEntity
C++ scripted.cpp
Aiscripted schedule.png

aiscripted_schedule is a point entity available in all Source Source games except Left 4 Dead seriesLeft 4 Dead series Left 4 Dead series.

It issues a command to an NPC without suppressing its normal AI routines.

This entity is often used to make a NPC travel to a specific location or follow a path_corner track.

PlacementTip.gifPlacement Tip:A NPC can follow a tight path_corner track without requiring a nodegraph, but this is not recommended since a nodegraph is still needed for NPCs to navigate around corners or move freely.

Flags

Repeatable : [4]
Search Cyclically : [1024]
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.
Don't Complain : [2048]
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

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Target NPC (m_iszEntity) <targetname>
The name or classname of an NPC to command.
Search Radius (0=everywhere) (m_flRadius) <float>
Radius to search within for an NPC to command.
All in radius (graball) <boolean>
Whether to grab all matching NPCs in the specified radius, or just the first one found.
AI state to set (forcestate) <integer choices>
Overrides the NPC's current alertness state.
  • 0: <None>
  • 1: Idle
  • 2: Alert
  • 3: Combat
Schedule to run (schedule) <integer 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) <integer choices>
What can cause the NPC to give up on this schedule?
  • 0: General
  • 1: Damage or Death
  • 2: Death
Goal entity (goalent) <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.

See also