Now, as outlined in my guidelines, it is really difficult to make sure that your cube can never be destroyed and/or made impossible to retrieve.
Yet, sometimes, particularly when making lessons where you want the player to see that something special happens when the cube is oriented a certain way, you must have an initial orientation for the cube.
What if you could respawn your initially-oriented cube if it happens to be destroyed?
Well, turns out that this feature was surprisingly simple to add.
Just edit your editoritems.txt (found under Portal 2/portal2_dlc2/scripts). Find the line that says: "Type" "ITEM_CUBE". Scroll down until you find a line that says "TargetName". Below that line, add the following lines:
// ADDED BY BISQWIT
"Outputs"
{
"CONNECTION_STANDARD"
{
"Activate" "instance:cube;OnFizzled"
"Deactivate" "instance:cube;OnFizzled"
}
}
// ADDED BY BISQWIT
"ConnectionPoints"
{
// left
"Point"
{
"Dir" "1 0 0"
"Pos" "1 3 0"
"SignageOffset" "0 2 0"
"Priority" "0"
}
"Point"
{
"Dir" "1 0 0"
"Pos" "1 4 0"
"SignageOffset" "0 5 0"
"Priority" "0"
}
// right
"Point"
{
"Dir" "-1 0 0"
"Pos" "6 3 0"
"SignageOffset" "7 2 0"
"Priority" "0"
}
"Point"
{
"Dir" "-1 0 0"
"Pos" "6 4 0"
"SignageOffset" "7 5 0"
"Priority" "0"
}
// up
"Point"
{
"Dir" "0 1 0"
"Pos" "3 1 0"
"SignageOffset" "2 0 0"
"Priority" "0"
}
"Point"
{
"Dir" "0 1 0"
"Pos" "4 1 0"
"SignageOffset" "5 0 0"
"Priority" "0"
}
// down
"Point"
{
"Dir" "0 -1 0"
"Pos" "3 6 0"
"SignageOffset" "2 7 0"
"Priority" "0"
}
"Point"
{
"Dir" "0 -1 0"
"Pos" "4 6 0"
"SignageOffset" "5 7 0"
"Priority" "0"
}
}
Restart Portal 2. Now you can draw a signal line from a cube into any element that you wish to activate when the cube is fizzled. First rightclick the cube, select "Connect to", and select the target element. (The order of clicking is important.) Signage points are provided, but you will probably want to hide signages because they do not really make sense with a cube that can be picked up and moved. The signage will not move.
Now, if you want your cube to be respawned, follow these instructions:
- Create a cube without dropper. Orient it as you want.
- Create a dropper that does not drop the first cube automatically. Connect the cube into the dropper.
Done!
You can now even respawn the cube somewhere completely other than where it first appeared. Or you can create a puzzle where the door opens when the cube is fizzled. Possibilities are endless.
In the first chamber where I used this I made GLaDOS say "Cheater!" when the cube is fizzled, because it is not supposed to be possible to fizzle the cube by accident (it is still possible to do it intentionally with practice).
Note: When the cube is fizzled, the signal is activated and immediately deactivated. It will not keep a door open. It will not turn a laser on except for a blink of eye. If you want the signal to be kept on, you must either create a logic latch that sustains the signal, or remove the "Deactivate" line above.
