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
m (add AI category)
(→‎Keyvalues: choices data type)
 
(48 intermediate revisions by 23 users not shown)
Line 1: Line 1:
[[category:AI]]
{{LanguageBar}}
aiscripted_schedule
{{CD|CAI_ScriptedSchedule|file1=scripted.cpp}}
{{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.


KEYS
{{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.}}


Name targetname <target_source> The name that other entities refer to this entity by.
{{clearleft}}


Target NPC m_iszEntity <target_destination> The name or classname of an NPC to use.
==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>}}


Search Radius (0=everywhere) m_flRadius <integer> Radius to search within for an NPC to use. 0 searches everywhere.
==Keyvalues==
{{KV Targetname}}
{{KV|Target NPC|intn=m_iszEntity|targetname|The name or classname of an NPC to command.}}
{{KV|Search Radius (0{{=}}everywhere)|intn=m_flRadius|float|Radius to search within for an NPC to command.}}
{{KV|All in radius|intn=graball|bool|Whether to grab all matching NPCs in the specified radius, or just the first one found.}}
{{KV|AI state to set|intn=forcestate|integer choices|Overrides the NPC's current alertness state.
:*0: <None>
:*1: Idle
:*2: Alert
:*3: Combat}}
{{KV|Schedule to run|intn=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_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.}} }}


All in radius graball <choices> Whether to grab all matching NPCs in the specified radius, instead of just one
==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.}}


spawnflags spawnflags <flags>
==See also==
* {{ent|scripted_sequence}} (for seizing complete control of the NPC)
* [[Assaults]] (for combat)
* [[npc_citizen_fleeing]] - A prefab that demonstrates scheduled behavior.


AI state to set forcestate <choices>
[[Category:AI]]
 
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
 
Kill Removes this entity from the world.
 
KillHierarchy Removes this entity and all its children from the world.
 
AddOutput <string> Adds an entity I/O connection to this entity. Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>. Very dangerous, use with care.
 
FireUser1 Causes this entity's OnUser1 output to be fired.
 
FireUser2 Causes this entity's OnUser2 output to be fired.
 
FireUser3 Causes this entity's OnUser3 output to be fired.
 
FireUser4 Causes this entity's OnUser4 output to be fired.
 
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.
 
 
OUTPUTS
 
OnUser1 Fired in response to FireUser1 input.
 
OnUser2 Fired in response to FireUser2 input.
 
OnUser3 Fired in response to FireUser3 input.
 
OnUser4 Fired in response to FireUser4 input.

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