Entity Tutorial 4: Usable Object

From SkyCorp Global
Jump to navigation Jump to search

The Dick Size Increaser mod demonstrates how to modify the player object:

function doUse()

   -- Write to the screen.
   io.write("Changing player\n");

   -- Get the instance of the Player class and store it in variable 'player'
   player = Player.getInstance();

   -- An example of accessing a player property and displaying it.  Note that
   -- usually it would be easier to just use the text parser for something this
   -- simple, however this demonstrates accessing the player object.
   io.write("You look down at your " .. player.getDickSizeString() .. ".  ");

   -- Transforms player's dick to be larger.  This version of the function will 
   -- output text to the screen, but other silent versions are available.
   player.tfDickLarger();

   -- Display the property again now just for testing purposes to show that the 
   -- player has changed.
   io.write("It now looks like a " .. player.getDickSizeString() .. ".\n");

   -- For the use() function, returning true will cause a continue scene to be
   -- displayed next.  In other words, processing will paused and a "Continue.."
   -- button will be displayed.  If you want to manage the scene transition yourself
   -- or display custom buttons, you would need to set those up and return false,
   -- however, that is rare.
   return true;
end