Skip to content

SCUMM 8 API: Actors

Paul Nicholas edited this page Aug 7, 2018 · 6 revisions

Actors have similar properties to Objects, but they also have the ability to walk, talk and have inventory.

Actor Definitions

Properties

The following properties apply to Actor definitions.

  • name

    • The display name of an Actor.
  • x,y

    • Position of Actor within a Room.
  • z

    • The z/depth pos of Actor within a Room (useful for forcing Actors to appear in-front/behind others)
    • The z-plane system in SCUMM-8 is from -64 to 64
      • (with the map being drawn at plane 0)
    • (Defaults to same as y pos)
  • w,h

    • Width and height (in sprite cel's) of an Actor.
  • classes

    • Actors can have multiple classes attributed, all of which have different effects. The available classes are:

      • class_untouchable = Actor cannot be interacted with at all
      • class_talkable = Actor can be talked to
      • class_openable = Actor can be opened(?)
      • class_actor = Object is an Actor (not just a normal Object)
    • For example: classes = { class_actor, class_talkable }

  • use_pos

    • The position the selected player will walk to when Actor is interacted with. The available use positions are:

      • pos_infront = Stand in-front of Actor
      • pos_left = Stand to the left of Actor
      • pos_right = Stand to the right of Actor
      • pos_above = Stand just above the Actor
      • pos_center = Stand in center of Actor
    • For example: use_pos = pos_left

  • use_dir

    • The direction the selected player will face to when Actor is interacted with. The available use positions are:
      • face_front
      • face_left
      • face_back
      • face_right
    • For example: use_dir = face_right
  • idle

    • A list of sprite numbers to use for when the Actor is just standing (e.g. not walking, etc.). There should be four items specified; one frame for each possible face direction.

      For example:

      -- (face front, left, back, right)
      idle = { 193, 197, 199, 197 }
  • talk

    • A list of sprite numbers to use as an overlay for when the Actor is talking (e.g. to show mouth in open position). There should be four items specified; one frame for each possible face direction.
    • NOTE:
      • An (optional) X,Y position of the talk sprite overlay can also be set by specifying a 5th and 6th value in the list

        • (by default, this offset is hard-coded to be the 2nd sprite down (e.g. 8 pixels) from the top of the Actor.
      • An (optional) width & height of the talk sprite overlay can also be set by specifying a 7th and 8th value in the list

        • (by default, this is hard-coded to 1x1)

        For example:

        talk = { 218, 219, 220, 219, -- talking front, left, back, right, 
                 2, 0,               -- x-offset-pos, y-offset-pos,
                 1, 1                -- sprite width, sprite height
        }  
  • walk_anim_side / walk_anim_front / walk_anim_back

    • A list of sprite numbers to animate the Actor when walking in a particular direction.

    • Note: The walk_anim_side property should be drawn facing right. Actor's sprite will be automatically flipped when walking left.

      For example:

      -- (facing front, left, back, right)
      walk_anim_side = { 196, 197, 198, 197 }
      walk_anim_front = { 194, 193, 195, 193 }
      walk_anim_back = { 200, 199, 201, 199 }
  • walk_speed

    • The speed that the Actor can move (e.g. distance moved, in pixels, per frame).
    • For example: walk_speed = 0.6
  • frame_delay

    • The amount of frames to display the current Actor's current sprite frame. Used to control the speed of animations (e.g. walking animation, etc.)
    • For example: frame_delay = 5
  • face_dir

    • States the direction the selected player should be facing in. The available use positions are:
      • face_front
      • face_left
      • face_back
      • face_right
    • For example: face_dir= face_right
  • trans_col

    • The color to draw as transparent (defaults to 0 = black)
  • col_replace

    • Allows you to specify an alternative color to the one originally in actor's sprites. Useful for re-using existing content.
    • For example: col_replace = {5,2}
  • lighting

    • Specifies the lighting level to use for a given Actor. Range is from 1=Normal to 0=black (default = 1).
    • For example: lighting = 0.75
  • scale

    • Specifies the scale factor to use when drawing the Actor. Range is from 1 = 100% to 0=almost 0% (default = 1)
    • Leave as nil for auto-scaling (fake) 3D depth scaling to occur.
    • If specified, this value will override and disable auto-scaling.

Verbs (func list)

The verbs property allows you to specify a list of functions for each verb that the Actor supports. When a user chooses a verb from the UI and clicks on the Actor, the defined function will be executed.

For example:

verbs = {
  lookat = function(me)
    say_line("it's a weird looking tentacle, thing!")
  end,
  talkto = function(me)
    say_line(me, "what do you want, Human?!")
  end,
  use = function(me)
    -- switch character
    selected_actor = me
    camera_follow(me)
  end
}

Scripts (list)

Allows you to specify a list of functions that are specific to a given Actor. These scripts can then either be called directly (synchronously) or run asynchronously via the start_script() function.

For example:

scripts = {
  watch_tentacle = function()
    while true do
      -- automatically face actor as he moves around
      do_anim(selected_actor, "anim_face", purp_tentacle)
      break_time(10)
    end
  end
}
Clone this wiki locally