Also, here is what we’re going to be working on tonight with steps to complete, just in case anyone can decipher my scatterbrained notes and wants to throw this together for themselves! I’m posting here so that I don’t forget the steps taken to recreate it as this was a pretty detailed setup.
Steps to create randomized movement on Platforms
In Platform:
- Static Mesh
- Create two vector variables> Original Loc and Offset, make offset editable
- Event Begin Play>Set Original Loc to “Get Actor Location (self)”
- Custom Event>MoveMe
- MoveMe>FlipFlop
- A and B go to different Sequence Nodes
- two Gate Nodes. A “Then 0” plugs into second gate close, “Then 1” plugs into first gate Open. B “Then 0” plugs into first gate close, “Then 1” into second gate open.
- Event Tick>Sequence, “Then 0” into first gate Enter, “Then 1” second gate enter.
- Two Set Actor Location nodes, one behind each gate.
a. First Set actor location vector =
Current: Get Actor Location (self)
Target: Original Location + Offset
Delta Time: Get World Delta Seconds
Interp Speed: SumNum
b. Second Set actor location vector =
Current: Get Actor Location (self)
Target: Original Location
Delta Time: Get World Delta Seconds
Interp Speed: SumNum
In Platform Move
- Box collision
- Create these vars > Float Array (Name:TimerAmount)(editable)(3 elements: 1.0,2.0,3.0), Int (Name: Current Timer Group), Actor Array (name: Contained Actors), Int Array (Name:TimerGroupMatched), Int (Name: MoveBackGroup)
- Event Begin Play>Set Contained Platforms
- Contained Platforms set to “Get Overlapping Actors”
Target is “Box” - Get array length
- Resize Array “Timer Group Matched”, size = Contained Platforms Length
- Foreachloop, array = contained platforms
- LoopBody exec pin > Set array Elem
- Timer Group matched > Target Array
10.Index = Foreachloop index
11.Item = Random Int in Range. Min = 0, Max = Length of array (timer amount) minus 1 - Completed exec pin>Set timer
Object:self
Function Name: MovePlatforms
Time=SumNum
Looping:True - Delay node
Duration = MovePlatforms Timer (Time) value - Set Timer Node
Object:Self
Function Name: MoveBack
Time: MovePlatforms Timer (Time) value
Looping: True - Custom Event: MovePlatforms
- ForEachLoop
Array: Timer Group Matched - Loop body exec pin> branch
True if Array Element == Current Timer Group - True Exec Pin>Cast to Platform
Object Pin: Get Contained Platforms Array, index set to Foreachloop array index - Call Function: MoveMe
- Completed exec pin>Set Current Timer Group
Current Timer Group: Current Timer Group + 1 - Branch node
Condition: Current Timer Group > Timer Amount Length minus 1 - True: Set Current Timer Group
Current Timer Group: 0 - Custom Event: MoveBack
- Copy all steps from MovePlatforms function and paste them into MoveBack function
- Compile, save, close blueprints, place collision box in level, resize to fit multiple platforms
- Place multiple platforms in move box, event begin play.