Difference between revisions of "HPL3/Amnesia: Rebirth/Tutorials/Rifts"

From Frictional Wiki
Jump to navigation Jump to search
(Created)
 
(Finished formatting and adding pictures)
 
Line 1: Line 1:
 
This is how to set up a basic functional rift.
 
This is how to set up a basic functional rift.
  
First create an entity. Search for rift_simple in the directory menu.
+
First create an entity. Search for <code>rift_simple</code> in the directory menu.
 
[[File:Rift Fig 1.jpg|thumb|The rift entity|left]] {{clr}}
 
[[File:Rift Fig 1.jpg|thumb|The rift entity|left]] {{clr}}
Name it rift_simple_1.
+
Name it <code>rift_simple_1</code>.
  
Create an area trigger. Call it rift_1. This is the bounds of the rift so make it as big as the rift area.
+
Create an area trigger. Call it <code>rift_1</code>. 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 as such
+
Select <code>rift_simple_1</code>, go to entity tab and edit rift attributes:
[[File:Rift Fig 2.jpg|thumb|Rift parameters|right]]
+
[[File:Rift Fig 2.jpg|thumb|Rift parameters|left]] {{clr}}
See footnote 1.
+
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.
+
Create another area trigger, name it <code>amulet_tracking_1</code>. 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.
+
In <code>amulet_tracking_1</code>, go to area tab and expand Collide Callbacks.
(fig 3)
 
 
Type in the fields:
 
Type in the fields:
CC_entities: player
+
*'''CC_entities:''' <code>Player</code>
CC_funcs: OnCollide_Player_ActivateAmulet
+
*'''CC_funcs:''' <code>OnCollide_Player_ActivateAmulet</code>
 +
[[File:Rift Fig 3.jpg|thumb|CCs of the tracking area|left]] {{clr}}
  
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.
+
 
 +
Create a new entity. I believe this can be any entity with collision. This will be part of the portal entrance. I'm using <code>dw_rock_lump_large_4_1</code>.
 
Go into base tab and check StaticPhysics. The game will treat it like a static object now.
 
Go into base tab and check StaticPhysics. The game will treat it like a static object now.
Name it rift_1_entrance_1.
+
Name it <code>rift_1_entrance_1</code>.
shift+move 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
+
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.
as the naming is the same and it should make them all disappear.
 
  
Now copy and paste the below functions into your level script file. If you run your map in the game the rock should now 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.
(fig 4)
+
[[File:Rift Fig 4.jpg|thumb|First test|left]] {{clr}}
(footnote 2)
 
  
 
Setting the optional attributes can be used to make your portal look more like a portal.
 
Setting the optional attributes can be used to make your portal look more like a portal.
(fig 5)
+
[[File:Rift Fig 5.jpg|thumb|Showcase of a simple rift set-up|left]] {{clr}}
 
Most of them support wildcards so you can have multiple shaking lights or billboards for instance.
 
Most of them support wildcards so you can have multiple shaking lights or billboards for instance.
  
Line 40: Line 39:
 
*DeactivateEntities: This hides entities when rift is opened. Used to make rocks disappear when opened. Wildcard supported.
 
*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.
 
*Bounds: The rift boundary. While the player is inside the rift won't close.
 
  
 
You may also set these optional attributes for visual effects:
 
You may also set these optional attributes for visual effects:

Latest revision as of 14:05, 10 November 2020

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.
					//Voice_PlayDelayed("Dialogue_OpenRift",2.0f,-1,"OnEndOfVoice_Rift");
				}
			}
		}

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