Hacking Toolkit

Usage

Package includes:
  • hackableTemplate
  • playerHackingTemplate
  • hackableCamera
  • hackableButton
  • door template
  • roadBlock Template
Setup:
  1. Add the playerHackingTemplate to the player template
Creating a hackable object:
  1. Add the hackableTemplate to the object
  2. Add a script to the object that implements PerformHack(user).
When the user looks at the object, they can press interact to run the PerformHack(user) function of whatever they’re looking at.
To see examples of this, look at the hackableButton template or roadBlock Template.
The hackableButtonScript implements a PerformHack method that calls an event on hack. This can be used to remotely open doors. Try adding the door template do your game, and attaching the PerformHack method from the door template to the onHack event of the hackableButtonScript.
Creating a remotely controlled object:
  1. Add the hackableTemplate to the object
  2. Check off the requiresControl property
When a hackable object requires control, OnButtonPressed and OnButtonReleased methods will be called on the hackable object. Look at the hackableCameraTemplate for an example of this in action.
Interactions:
If the Prompts package is installed and setup, a prompt will appear to tell the user how to hack the object they’re looking at. Likewise, if the Prompts pacakge is installed, GetButtonPrompts(prompts) will be forwarded to hackable objects that require control.
Suggestions:
A common pattern you might encounter is wanting a common template that is both hackable and non-hackable. For example, you might have a door that you want to open by hacking it directly in some scenarious, but in other scenarios you only want the door to open after pressing a button, for example.
The solution to this problem is to create your door template, and implement PerformHack(user) as usual, but do not attach the hackable script. Since the hackable script is not attached, the player won’t be able to directly hack it. Now create a second template that uses the template we just created, and add the hackable script to it.
That gives you 2 templates with 1 common base, one is directly hackable, one isn’t.
Too long, didn’t read:
  1. Add playerHackingTemplate to player
  2. Add hackableTemplate to literally anything
  3. Add a script that implements PerformHack(user).
local LitearllyAnythingScript = {}

HackableButtonScript.Properties = {}

function LiterallyAnythingScript:PerformHack(user)
	print("We've been hacked!")
end

return LiterallyAnythingScript

Hacking this object will print We've been hacked! to the console.
DryCereal Games
Games Packages Crayta