Actor: Difference between revisions
Hendricks266 (talk | contribs) No edit summary |
Doom64hunter (talk | contribs) m Add some missing info such as default values, and reword some paragraphs. |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
''' | <span {{code}}>'''useractor''' <type> <picnum> [strength] [action] [move] [moveflag 1] [...] [moveflag N]</span> | ||
< | Deprecated: <span {{code}}>'''actor''' <picnum> [strength] [action] [move] [moveflag 1] [...] [moveflag N]</span> | ||
Defines the given tile number as an actor, enabling hardcoded actor behavior, attributes and allowing code to be written for sprites of that tile number. | |||
Loosely speaking, "actors" are sprites that run code in game, such as enemies, breakable objects, etc. | |||
The token '''actor''' specifies the start of an actor code block, while '''enda''' marks the end of the block. | |||
'''actor''' MYACTOR | |||
[...] | |||
'''enda''' | |||
'''useractor''' notenemy MYACTOR2 | |||
[...] | |||
'''enda''' | |||
When defined with '''actor''' or '''useractor''', the sprites will execute their code once every tic, except for dormant enemies. Actors or dormant actors will have a statnum of 1 and 2 respectively. | |||
Prior to v1.4, only tile numbers hard-coded to execute script would work with the '''actor''' command. After v1.4 new actors could be defined, and the '''useractor''' command was added which allowed actors to be defined as specific types for hard-coded behavior. | |||
With the addition of '''useractor''', the old '''actor''' command is deprecated and remains for compatibility reasons. Using '''actor''' is identical to '''useractor''' except that it always uses the "notenemy" type. | |||
Example: | |||
define MYACTOR 3585 | |||
Example | |||
define | |||
''' | '''useractor''' notenemy MYACTOR 0 | ||
ifpdistl 1024 | |||
{ | |||
palfrom 32 0 16 0 | palfrom 32 0 16 0 | ||
} | |||
enda | enda | ||
To reuse code between actors, see also: [[state]]. | |||
== Parameters == | |||
All parameters after <picnum> are optional, and receive a default value of 0 if left undefined. | |||
{| {{prettytable}} | |||
| <type> || Defines the actor's hardcoded behavior type. Only used by '''useractor'''. | |||
|- | |||
| <picnum> || Either a [[define]] label, or the tile number as a constant. Identifies the tile to be defined as actor. | |||
|- | |||
| [strength] || Defines the initial health of the actor. | |||
|- | |||
| [action] || Defines the initial [[action]] an actor uses when activated. | |||
|- | |||
| [move] || Defines the initial [[move]] of the actor when activated. | |||
|- | |||
| [moveflag]... || A sequence of bit flags that specifies which hard-coded movement behavior to use, see [[move#moveflags|moveflags]]. | |||
|} | |||
== Types == | |||
The type is technically a [[bitfield]], though "3" is invalid. It is generally either "enemy", "enemystayput", or "notenemy". | |||
{| {{prettytable}} | |||
!Value!!DEFS.CON label!![[gameflags]]!!Description | |||
|- | |||
|0||notenemy||<font color="gray">(None)</font>||Default. Code begins executing at the start of a level. Generally used for interactive objects. | |||
|- | |||
|1||enemy||SFLAG_BADGUY||Enables hard-coded enemy behavior. Code only begins executing upon player sight. | |||
|- | |||
|2||enemystayput||SFLAG_BADGUY<br>SFLAG_BADGUYSTAYPUT||Same as "enemy" plus the [[actor]] will not leave the [[sector]] it is placed in. | |||
|- | |||
|4||<font color="gray">(None)</font>||SFLAG_ROTFIXED||The actor's position in rotating sectors is calculated without rounding errors. | |||
|} | |||
[[Category:Duke3D 1.3/1.5 commands]] | [[Category:Duke3D 1.3/1.5 commands]] | ||
[[Category:Sprite manipulation]] | [[Category:Sprite manipulation]] |
Latest revision as of 01:31, 10 January 2021
useractor <type> <picnum> [strength] [action] [move] [moveflag 1] [...] [moveflag N]
Deprecated: actor <picnum> [strength] [action] [move] [moveflag 1] [...] [moveflag N]
Defines the given tile number as an actor, enabling hardcoded actor behavior, attributes and allowing code to be written for sprites of that tile number.
Loosely speaking, "actors" are sprites that run code in game, such as enemies, breakable objects, etc.
The token actor specifies the start of an actor code block, while enda marks the end of the block.
actor MYACTOR [...] enda useractor notenemy MYACTOR2 [...] enda
When defined with actor or useractor, the sprites will execute their code once every tic, except for dormant enemies. Actors or dormant actors will have a statnum of 1 and 2 respectively.
Prior to v1.4, only tile numbers hard-coded to execute script would work with the actor command. After v1.4 new actors could be defined, and the useractor command was added which allowed actors to be defined as specific types for hard-coded behavior.
With the addition of useractor, the old actor command is deprecated and remains for compatibility reasons. Using actor is identical to useractor except that it always uses the "notenemy" type.
Example:
define MYACTOR 3585 useractor notenemy MYACTOR 0 ifpdistl 1024 { palfrom 32 0 16 0 } enda
To reuse code between actors, see also: state.
Parameters
All parameters after <picnum> are optional, and receive a default value of 0 if left undefined.
<type> | Defines the actor's hardcoded behavior type. Only used by useractor. |
<picnum> | Either a define label, or the tile number as a constant. Identifies the tile to be defined as actor. |
[strength] | Defines the initial health of the actor. |
[action] | Defines the initial action an actor uses when activated. |
[move] | Defines the initial move of the actor when activated. |
[moveflag]... | A sequence of bit flags that specifies which hard-coded movement behavior to use, see moveflags. |
Types
The type is technically a bitfield, though "3" is invalid. It is generally either "enemy", "enemystayput", or "notenemy".
Value | DEFS.CON label | gameflags | Description |
---|---|---|---|
0 | notenemy | (None) | Default. Code begins executing at the start of a level. Generally used for interactive objects. |
1 | enemy | SFLAG_BADGUY | Enables hard-coded enemy behavior. Code only begins executing upon player sight. |
2 | enemystayput | SFLAG_BADGUY SFLAG_BADGUYSTAYPUT |
Same as "enemy" plus the actor will not leave the sector it is placed in. |
4 | (None) | SFLAG_ROTFIXED | The actor's position in rotating sectors is calculated without rounding errors. |