Combat Stealth States
Combat and Stealth States
Section titled “Combat and Stealth States”State Management Systems
Section titled “State Management Systems”Character states determine what abilities can be used and how the character behaves. The two primary states are Combat State and Stealth State, which have specific rules about when they can be active.
Combat State Implementation
Section titled “Combat State Implementation”Core Combat Rules
Section titled “Core Combat Rules”- Stealth Restriction: Cannot enter stealth while in combat state
- Duration: Combat state lasts 5 seconds after activation
- Auto-Deactivation: Automatically turns off after timer expires
Combat State Variables
Section titled “Combat State Variables”Create combat state management in master character blueprint:
- Combat Boolean: Tracks whether character is currently in combat
- Combat Timer: 5-second timer that controls combat duration
Combat State Functions
Section titled “Combat State Functions”// Combat State ActivationCE_Combat_State() {set_combat_to_true;start_5_second_timer;// Timer calls F_Combat_State_Off when complete}
// Combat State DeactivationF_Combat_State_Off() {set_combat_to_false;}
Combat State Triggers
Section titled “Combat State Triggers”Combat state activates when:
- Character receives damage
- Character uses attack abilities
- Character enters hostile encounters
Stealth State Implementation
Section titled “Stealth State Implementation”Stealth Functions
Section titled “Stealth Functions”Create stealth management functions in master character blueprint:
Stealth Activation
Section titled “Stealth Activation”- Function:
F_Stealth_On
- Movement: Set move speed to walk
- Visual Effects: Apply stealth appearance changes
Stealth Deactivation
Section titled “Stealth Deactivation”- Function:
F_Stealth_Off
- Movement: Set move speed back to run
- Visual Effects: Return to normal appearance
Stealth State Rules
Section titled “Stealth State Rules”- Combat Prevention: Cannot activate stealth while in combat
- Combat Breaking: Entering combat automatically breaks stealth
- Movement Speed: Stealth forces slower movement speed
Visual Feedback Systems
Section titled “Visual Feedback Systems”Player Character Appearance Changes
Section titled “Player Character Appearance Changes”Implement visual feedback for stealth state using dynamic materials:
Material Setup Process
Section titled “Material Setup Process”- Create Dynamic Materials: Create material instances for character mesh elements
- Material Parameters: Add scalar parameter named “color_stealth”
- Default Values: Set default color_stealth value to 1.0
- Stealth Values: Set stealth color_stealth value to 0.3 for transparency effect
Implementation Code
Section titled “Implementation Code”// Create dynamic material instances for meshF_Mesh_Materials() {create_dynamic_material_instance_element_0;create_dynamic_material_instance_element_1;store_as_mesh_material_variables;}
// Apply stealth visual effectsF_Stealth_On() {set_scalar_parameter('color_stealth', 0.3);set_move_speed_walk;}
F_Stealth_Off() {set_scalar_parameter('color_stealth', 1.0);set_move_speed_run;}
Material Modification
Section titled “Material Modification”Modify character materials to support stealth effects:
- Add Multiply Node: Connect to base color output
- Add Scalar Parameter: Name “color_stealth” with default value 1.0
- Apply to All Materials: Repeat for each material used by character mesh
State Integration
Section titled “State Integration”Damage Integration
Section titled “Damage Integration”When character receives damage:
- Activate combat state immediately
- If character was in stealth, break stealth state
- Combat state prevents re-entering stealth for 5 seconds
Attack Integration
Section titled “Attack Integration”When character uses attack abilities:
- Activate combat state
- Break stealth if currently active
- Prevent stealth reactivation until combat cooldown expires
Keybind Setup
Section titled “Keybind Setup”Temporary Testing Keybind
Section titled “Temporary Testing Keybind”Create temporary keybind for testing stealth functionality:
- Key: Q (or chosen test key)
- Combat Check: Branch to verify not in combat state
- State Toggle: Use flip-flop to toggle stealth on/off
- Error Feedback: Print message if stealth blocked by combat state
The combat and stealth state system provides the foundation for tactical gameplay mechanics and ensures proper interaction between different character abilities.