HPL3/Amnesia: Rebirth/Tutorials/Rifts

From Frictional Wiki
Jump to navigation Jump to search

This is how to set up a basic functional rift.

First create an entity. Search for rift_simple in the directory menu.

The rift entity

Name it rift_simple_1.

Create an area trigger. Call it rift_1. This is the bounds of the rift so make it as big as the rift area. Select rift_simple_1, go to entity tab and edit rift attributes:

Rift parameters

See Footnote 1 for parameter explanations.

Create another area trigger, name it amulet_tracking_1. Make it the as big as you want the amulet to track the portal - in this area, the Amulet will glow green and point to the rift. In amulet_tracking_1, go to area tab and expand Collide Callbacks. Type in the fields:

  • CC_entities: Player
  • CC_funcs: OnCollide_Player_ActivateAmulet
CCs of the tracking area

Create a new entity. I believe this can be any entity with collision. This will be part of the portal entrance. I'm using dw_rock_lump_large_4_1. Go into base tab and check StaticPhysics. The game will treat it like a static object now. Name it rift_1_entrance_1. Shift+move or Ctrl+D to duplicate it. The number at the end should automatically go up. You can do this as many times as you want and even change the entity as long as the naming is the same and it should make them all disappear.

Now copy and paste the functions from Footnote 2 into your level script file. If you run your map in the game the rock should now disappear.

First test

Setting the optional attributes can be used to make your portal look more like a portal.

Showcase of a simple rift set-up

Most of them support wildcards so you can have multiple shaking lights or billboards for instance.

Footnote 1

Explanation of rift attributes:

  • OpenDist: distance at which the rift will open.
  • StartOpenDist: Distance at which rift will start to open.
  • TrackingDistance: Distance at which amulet will start tracking rift.
  • OpeningStages: Not entirely sure; different stages of rift opening. StageCallback will be called when highest value is surpassed.
  • StageCallback: function in script to be called when rift is fully opened.
  • DeactivateEntities: This hides entities when rift is opened. Used to make rocks disappear when opened. Wildcard supported.
  • Bounds: The rift boundary. While the player is inside the rift won't close.

You may also set these optional attributes for visual effects:

  • ActivateBillboards: When the rift opens, these billboards appear. Wildcard supported.
  • ShakingLights: When you hold your amulet out, these lights will get brighter and shake around, creating a "shimmering" effect. Wildcard supported.
  • GuidingLights: Lights that get brighter the closer you get to the portal. Get brighter with amulet out. Wildcards supported.
  • RimLights: Lights that turn on when the portal is opened. Used to create "glowing portal" effect.

Footnote 2

void OnRiftStage_CaveRift(const tString &in asRift, int alStage, bool abOpening, float afOpenAmount)
			Debug_Log("RIFT: "+alStage+" "+afOpenAmount+" "+abOpening);
			if (alStage == 0)
				if (!abOpening)
			else if (alStage == 1)
				if (abOpening)
					//This is where you put all the code you want to run when the portal opens.

					//If you have irratic rocks, this code will make them drop. Wildcard supported.
					//Prop_SetStaticPhysics("Irratic rock name *", false);
					//Entity_AddImpulse("Irratic rock name *", cVector3f_Down * 0.25, true, true);
					//Tasi reacts to portal opening.

bool OnCollide_Player_ActivateAmulet(const tString &in asParent, const tString &in asChild, int alState)
			if (alState == 1)
				Amulet_StartTracking(true, "", -1.f);
			return true;