How do Effects actually work?

SkobbejakGames

New member
Trying to add a Shake/Earthquake Effect to my Camera. Cant find the place where it needs to be added as an available Effect as I cant drag the Shake script onto the camera. I'm trying to use the Start Stop Effect Playmaker Action however neither the Shake nor the Earthquake Effects are available.

Please any help on the matter would be greatly appreciated as the documentation seems to only give half the necessary information or outdated instructions?
 

Justin

Administrator
Staff member
The Effects are added to the character rather than the camera. In the demo scene you can see all of the effects listed within the Ultimate Character Locomotion component.
 

SkobbejakGames

New member
Thanks for the clarification Justin. However, the Boss Stomp as well as the Shake Effects seems to be missing from the Start Stop Effect Playmaker action's drop down list and I cant seem to access the Effects via the Playmaker action. The respective Effects do however show in the Start Effect drop downs on the Locomotion component. I know I can call it manually via a seperate script as indicated in the documentation, but I just wanted to check why the Playmaker action doesnt want display any of the Effects in the drop down list for the appropriate action?
 

SkobbejakGames

New member
Also, I cant seem to figure out how to add, configure and trigger an effect exactly. The Character in the Demo Scene doesnt seem to have any Effects added to it by default and I cant add the Shake script to the character as the error message states it needs to be derived. I cant find it on any of the ability drop downs, all I can find is the Start Effect Event drop down but that only triggers the effect, I dont know hopw to add it to the character and configure its parameters. The documentation also doesnt explain the setup process, only the triggering process.
 

Justin

Administrator
Staff member
All of the effects are under the Effects dropdown within the Ultimate Character Locomotion component. It's under the Item Abilities foldout. In the demo scene the Nolan character has four effects added to it and there is an effects room which give an example of the effects.
 

Justin

Administrator
Staff member
No, there isn't a delay built in. When you are starting the effect you could set a delay within your script for calling TryStartEffect.
 

SkobbejakGames

New member
Okay, I have tried literally everything. Im following the Demo's setup exactly but I keep getting this error when I tick the enabled box and try to force the effect to run:

IndexOutOfRangeException: Index was outside the bounds of the array.
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStopEffect (Opsive.UltimateCharacterController.Character.Effects.Effect effect) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1643)
Opsive.UltimateCharacterController.Character.Effects.Effect.StopEffect (System.Boolean fromController) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/Effect.cs:149)
Opsive.UltimateCharacterController.Character.Effects.Effect.StopEffect () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/Effect.cs:138)
Opsive.UltimateCharacterController.Character.Effects.BossStomp.Stomp () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/BossStomp.cs:73)
Opsive.UltimateCharacterController.Character.Effects.BossStomp.EffectStarted () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/BossStomp.cs:58)
Opsive.UltimateCharacterController.Character.Effects.Effect.StartEffect (System.Int32 index) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/Effect.cs:115)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartEffect (Opsive.UltimateCharacterController.Character.Effects.Effect effect) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1616)
Opsive.UltimateCharacterController.Character.Effects.Effect.StartEffect () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/Effect.cs:105)
Opsive.UltimateCharacterController.Character.Effects.Effect.set_Enabled (System.Boolean value) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Effects/Effect.cs:43)
Opsive.UltimateCharacterController.Editor.Inspectors.Character.UltimateCharacterLocomotionInspector.OnEffectListDraw (UnityEngine.Rect rect, System.Int32 index, System.Boolean isActive, System.Boolean isFocused) (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Character/UltimateCharacterLocomotionInspector.cs:581)
UnityEditorInternal.ReorderableList.DoListElements (UnityEngine.Rect listRect) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:589)
UnityEditorInternal.ReorderableList.DoList (UnityEngine.Rect rect) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:414)
Opsive.UltimateCharacterController.Editor.Inspectors.Utility.ReorderableListSerializationHelper.DrawReorderableList (UnityEditorInternal.ReorderableList& reorderableList, Opsive.UltimateCharacterController.Editor.Inspectors.InspectorBase inspector, System.Array drawnObject, System.String serializedData, UnityEditorInternal.ReorderableList+HeaderCallbackDelegate drawHeaderCallback, UnityEditorInternal.ReorderableList+ElementCallbackDelegate drawElementCallback, UnityEditorInternal.ReorderableList+ReorderCallbackDelegate reorderCallback, UnityEditorInternal.ReorderableList+AddCallbackDelegate addCallback, UnityEditorInternal.ReorderableList+RemoveCallbackDelegate removeCallback, UnityEditorInternal.ReorderableList+SelectCallbackDelegate selectCallback, System.Action`1[T] drawSelectedElementCallback, System.String key, System.Boolean requireOne, System.Boolean indentList) (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Utility/ReorderableListSerializationHelper.cs:75)
Opsive.UltimateCharacterController.Editor.Inspectors.Character.UltimateCharacterLocomotionInspector.<GetDrawCallback>b__32_0 () (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Character/UltimateCharacterLocomotionInspector.cs:301)
Opsive.UltimateCharacterController.Editor.Inspectors.StateSystem.StateBehaviorInspector.OnInspectorGUI () (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/StateSystem/StateBehaviorInspector.cs:92)
UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1647)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


I have my Effects added in the Character Locomotion, I have their values set up, I have them set to Start on Enable, I have the triggering states set up and added to the Effects. I have the State Trigger script and its trigger set up.

What is the significance of the Index Array if the effect is called by name? What does the Index Array need to be set to? Where do I set it? Why does the Playmaker action for Effects control try to control Abilities instead of Effects?

The trigger doesn't even seem to call to the Effect state as I see no interaction between them.

Frankly, this is a very unintuitive and overly complicated system for something as simple as a camera shake imho and nowhere does it seem to be properly explained or how to troubleshoot it. Why is this so convoluted?
 
Last edited:

Andrew

Moderator
Staff member
When you say you are "forcing" the effect to run, what are you using to do this? Are you using TryStartEffect and TryStopEffect?

Also check this page for a simple example Effect script (a camera shake) and make sure you're following its implementation, as well as how it's calling TryStartEffect and TryStopEffect.

 

Andrew

Moderator
Staff member
I'm unable to reproduce this within the demo scene. I created a new script with the example code from this page (changing line 2 to using Opsive.Shared.Game;), added the effect to the Effects list in Nolan's UltimateCharacterLocomotion component, set it to "Start When Enabled" then manually enabled it during run-time. The effect ran just fine. Creating a new effect based on one of the demo's built-in effect scripts also works.

Could you share the effect script that you're using?
 
Top