Actor: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
ai -> moveflags... this was actually wrong all the time.
Fox (talk | contribs)
No edit summary
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''actor''' <name> <strength> <action> <move> <moveflags...><br>
'''actor''' <picnum> <strength> <action> <move> <moveflag 1> [...] <moveflag N>
:(actor code...)<br>
[[enda]]


<name> is the name/tile of the actor. You can either input a [[define]]d name, or the tile number directly.
'''useractor''' <type> <picnum> [strength> <action> <move> <moveflag 1> [...] <moveflag N>


<strength> is the health of the actor.
Defines parameters for in-game sprites, and allows code to be written for sprites of the specific tile number.


<action> is the intial [[action]] an actor uses (optional).
The token '''enda''' marks the end of the actor.


<move> is the initial [[move]] of the actor (optional).
'''actor''' MYACTOR
  [...]
'''enda'''
'''useractor''' notenemy MYACTOR2
  [...]
'''enda'''
 
Loosely speaking, "actors" are sprites that run code in game, such as enemies, breakable objects, etc.
 
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.


<moveflags...> is is a (possibly empty) sequence of parameters that specify certain hardcoded movement behavior (optional, see [[move]]).
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.


(actor code...) is the code for the actor.
With '''useractor''', the old '''actor''' command is deprecated.


[[enda]] ends an actor.
Example:
define MYACTOR 3585
'''actor''' MYACTOR 0
  ifpdistl 1024
  {
    palfrom 32 0 16 0
  }
enda


See also [[state]].


Loosely speaking, actors are sprites that run code in game, such as enemies and breakable props.  More precisely, an actor is a sprite with a [[statnum]] of 1.  Sprites with that statnum will execute their actor code once every game tic.  Prior to version 1.4, only the tile numbers hardcoded to be actors could be actors.  In the GAME.CON script file, they were designated by the [[actor]] command.
== Parameters ==


Version 1.4 introduced the [[useractor]] syntax which allows use of any tile number as an actor.
All parameters after <picnum> are optional.


{| {{prettytable}}
| <type> || is the actor type for special behavior. Only used by '''useractor'''.
|-
| <picnum> || You can either input a [[define]]d name, or the tile number directly.
|-
| <strength> || is the health of the actor.
|-
| <action> || is the intial [[action]] an actor uses.
|-
| <move> || is the initial [[move]] of the actor.
|-
| <moveflag> || is a sequence of parameters that specify certain hard-coded movement behavior.
|}


Example actor:
== Types ==
define SOMEACTOR 3585
 
The type is technically a [[bitfield]], though "3" is invalid. It is generally either "enemy", "enemystayput", or "notenemy".
'''actor''' SOMEACTOR 0
 
ifpdistl 1024
{| {{prettytable}}
{
!Value!!DEFS.CON label!![[gameflags]]!!Description
    palfrom 32 0 16 0
|-
}
|0||notenemy||<font color="gray">(None)</font>||Default. Code begins executing at the start of a level.
enda
|-
|1||enemy||SFLAG_BADGUY||Enables hard-coded 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]]

Revision as of 00:46, 20 February 2020

actor <picnum> <strength> <action> <move> <moveflag 1> [...] <moveflag N>

useractor <type> <picnum> [strength> <action> <move> <moveflag 1> [...] <moveflag N>

Defines parameters for in-game sprites, and allows code to be written for sprites of the specific tile number.

The token enda marks the end of the actor.

actor MYACTOR
  [...]
enda

useractor notenemy MYACTOR2
  [...]
enda

Loosely speaking, "actors" are sprites that run code in game, such as enemies, breakable objects, etc.

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 useractor, the old actor command is deprecated.

Example:

define MYACTOR 3585

actor MYACTOR 0
  ifpdistl 1024 
  { 
    palfrom 32 0 16 0 
  }
enda

See also state.

Parameters

All parameters after <picnum> are optional.

<type> is the actor type for special behavior. Only used by useractor.
<picnum> You can either input a defined name, or the tile number directly.
<strength> is the health of the actor.
<action> is the intial action an actor uses.
<move> is the initial move of the actor.
<moveflag> is a sequence of parameters that specify certain hard-coded movement behavior.

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.
1 enemy SFLAG_BADGUY Enables hard-coded 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.