Skip to content

SCUMM 8 Tutorial: Switchable Characters

Paul Nicholas edited this page Apr 29, 2017 · 3 revisions

Introduction

The ability to switch between playable characters has been a unique feature of classic adventure games such as Maniac Mansion, Day of the Tentacle and (most recently) Thimbleweed Park. This feature is pretty easy to replicate in SCUMM-8, as this tutorial will explain.

How is it done?

The way the above feature was implemented was to create two "dummy" inventory items, which when "used", will change the selected_actor global property to the other Actor and set camera to follow them. The camera system will automatically take care of performing a transition/iris effect, if the target Actor is not in the current Room.

Dummy Inventory

Simply define two "dummy" inventory objects (with sprites of the target Actor) and "use" code that changes the selected_actor.

obj_switch_tent = {		
  data = [[
    name = purple tentacle
    state = state_here
    state_here = 170
    trans_col = 15
    x = 1
    y = 1
    w = 1
    h = 1
  ]],
  verbs = {
    use = function(me)
      selected_actor = purp_tentacle
      camera_follow(purp_tentacle)
    end
    }
  }
}

obj_switch_player= {		
  data = [[
    name = humanoid
    state = state_here
    state_here = 209
    trans_col = 11
    x = 1
    y = 1
    w = 1
    h = 1
  ]],
  verbs = {
    use = function(me)
      selected_actor = main_actor
      camera_follow(main_actor)
    end
  }
}

...add them initially to a "dummy" Room that is never displayed (affectionately called "The Void")...

-- "the void" (room)
-- a useful place to put objects/actors when you don't want them in a "displayable" room	
rm_void = {
  data = [[
    map = {0,0}
  ]],
  objects = {
    obj_switch_player,
    obj_switch_tent
  },
}

Finally, write a couple of lines within the startup_script() to ensure the dummy objects are automatically picked-up into the respective Actor's inventories...

-- set initial inventory (if applicable)
pickup_obj(obj_switch_tent, main_actor)
pickup_obj(obj_switch_player, purp_tentacle)

...and that's it! 😄

Further steps

If you wanted to take this further, you could also switch the Verb/Gui colors for each character (a la Thimbleweed Park), by modifying the following global properties:

verb_maincol = 12  -- main color (lt blue)
verb_hovcol = 7    -- hover color (white)
verb_shadcol = 1   -- shadow (dk blue)
verb_defcol = 10   -- default action (yellow)
Clone this wiki locally