You wanna do this, here you go!..
Devices Needed-
- Lifecycle: Starts the timer when the game begins.
- Property: Stores the randomly generated time (number type).
- Trigger:
Generates the random time.
Starts the main timer (repeater).
Triggers the monster’s attack with a delay. - Repeater: This is the timer itself.
- Monster/Sentry: This entity attacks the player.
To set it up
-
Lifecycle to Random Trigger:
Place a Lifecycle and set the event to, Game Start
Place a Trigger (call it Random Time Trigger, because it sounds more logical)
Wire the Lifecycle to the “Random Time Trigger”: Lifecycle (Game Start) < Random Time Trigger (Trigger). -
Random Time Generation:
Open the block code for the “Random Time Trigger”
Create a new number property (lik attackTimer). Set its default to 0.
Use a “set property” block to set AttackTimer to a random number between 45 and 60.
The random number block is in the math section of blocks. -
Trigger to Start Repeater:
Place another Trigger (call it “Start Timer Trigger”).
Wire the “Random Time Trigger” to “Start Timer Trigger”: Random Time Trigger (Trigger) < Start Timer Trigger (Trigger). -
Setting up a REPEATER:-(Important)
Place a Repeater.
Wire “Start timer trigger” to the Repeater to start it: Start timer trigger (Trigger) < Repeater (Start)`.
In the Repeater’s settings:
Set Task Interval to 1 (for 1-second intervals).
Set Time to Run, to …“”“Until receiving on a channel”“”…(important) -
Checking time and triggering Attack:
Place a Trigger (call it Attack Trigger)
Wire Repeater to Attack Trigger: Repeater (Task runs) < Attack Trigger (Trigger)
In the “Attack Trigger” settings:
Set Triggered by to, Never.
Enable “Run Delay” and set it to 10 seconds (or whatever delay you want bros and brodettes).
Wire Attack Trigger to the monster’s attack logic (like , start attacking the player, move toward the player, ) (there is a lot of the word “trigger”, also Important)
Hope you guys find it convenient!
(Furthermore, this is my first “Community Made Guides!”)