User Tools

Site Tools


developer_center:developer_editor:automatically_attacked_in_player_s_area

Automatically attacked in player's area

Finished product

Trigger

To create this feature, we got to have 3 triggers

  • Trigger 1: will create a circle arround the player, it will move following player location
  • Trigger 2: will identify when the player enters the creature's area or the creature's area enters the player's area.
  • Trigger 3: will identify when the player leaves the creature's area or the creature's area leaves the player's area.
  • To identify in trigger 2 and trigger 3, we're going to have a boolean variable.

Step 1 - Create the event to define the boolean (it's trigger 2)

We are going to identify the player's area (it isn't an area created by hand; it is the player's location). Because, the player's handmade area can't be moved. 

Step 2 - As mentioned above, we got to have a boolean variable to identify whether the creatures are insides the player's area. If yes, the boolean value will be true. If nothing, the boolean will keep false

Step 3 - As above, we will create the event when player leaves that area And we will copy area from trigger 1 to here: Step 4 - Because the cretures leave the area, and the area don't have any things now. Therefore, it will be false

Step 5 - Then we will make the creatures get attack when entering. And we will create a loop for the trigger. It will repeat from the player enters the map to they leave the map. Therefore, we got to make it break for 1 second to reduce laggy and make the player get a good experience.

We are going to define the player's area with an effect, its size is 5 to fit will area 5 * 5 * 5 (we did above)

Step 6 - Continue developing the loop, we will repeat when creature enters our area and breaking after they leave

As mentioned above we need time to break the loop

Then we will make the creature takes damages and turns off takes damages of player's permissions


If you have any questions about Developer Tools, feel free to join our official discord server Mini World Global DEV discord

developer_center/developer_editor/automatically_attacked_in_player_s_area.txt · Last modified: 2024/08/07 07:25 by don