Ravenfield

Ravenfield

Camera Shake Controller
RadioactiveJellyfish  [developer] 2 Aug, 2023 @ 6:48am
For Scripters
Accessing CSC
First, to access Camera Shake Control just put this in your Start function:
local cscObject = self.gameObject.Find("CSC") if cscObject then self.CSC = cscObject.GetComponent(ScriptedBehaviour) end
IMPORTANT: Do not put this in Awake. It has to be in Start!

Add Modifier
The AddModifier function lets you add a multiplier to the camera shake intensity.

Given the code above, to add a modifier do:
self.CSC.self:AddModifier("MyModifierName",modifier)

All modifiers are multiplied together to get the final itensity. For example, if I have the modifier "PlayerArmor" with a value of 0.8 and "Steady" with a value of 0.5 and given a base speed multiplier of 1 my final speed will be calculated as such:
1 x 0.8 x 0.5 = 0.4

Make sure your modifier name is unique! Only one instance of a modifier can exist at a time. If a modifier already exists, it will simply overwrite the existing modifier with the new one.

Remove Modifier
The RemoveModifier function removes a specific modifier.

Given the code above, to remove a modifier do:
self.CSC.selfm:RemoveModifier("MyModifierName")

Other Things To Note!
Every time a modifier is added or removed, the system will recalculate the camera shake intensity.

If you have Player Armor on, it will input a "PlayerArmor" modifier.

If you have any questions, feel free to reach out to me in the main RF Discord or on my own server.
Last edited by RadioactiveJellyfish; 2 Aug, 2023 @ 7:03am