Area activation by gun.

Tutorials and guides for Plazma Burst and community features.

Area activation by gun.

Postby Nyove » 29 September 2020, 14:15

NOTE: I know this is a repost of for another topic, but I find this tutorial valuable and don't want this tutorial to get overshadowed.

The map page for reference will be: https://www.plazmaburst2.com/level_edit ... -detectgun

First, we record the coordinates of the gun constantly.
This is achieved by moving the region to the gun and getting X and Y coordinates of that region.

Next, we check if the coordinates of the gun is within the bounds of the coordinates of the collector.


Imagine this area is the collector. It has 4 sides. The gun can only be in the collector if:
1. X coordinate of gun > left limit
2. X coordinate of gun < right limit
3. Y coordinate of gun > bottom limit
4. Y coordinate of gun < top limit

If these 4 conditions are fulfilled, then the gun is definitely in the collector.

NOTE 1 - In the PB2 ALE, the lower the object, the Y value increases. Therefore, to compare the coordinates with the bottom and top limit, we have to flip the sign. Therefore, step 3 and 4 should be:
3. Y coordinate of gun < bottom limit (smaller means the gun is higher in Y axis.)
4. Y coordinate of gun > top limit (greater means the gun is lower in Y axis.)

NOTE 2 - This detects only the location of the gun, so if the player is holding on to the gun and enters the collector, the trigger will still be executed. To tackle this solution, one of the method is to make the area unaccessible for players, perhaps with a tiny gap. Another way is to check if the gun is equipped by anybody, but this method can get complicated as well.

NOTE 3 - Depending of your decoration offset, if your decoration is offset-ed far away from the gun, the detection may not be smooth. This is because the detection detects the gun, not the box decoration. There is currently no way to solve this, as regions cannot be moved to decorations.

NOTE 4 - To reuse the trigger, activate the infinite calling timer again.

Best regards,
Nyove
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: Area activation by gun.

Postby xElijah » 29 October 2020, 14:26

Useful. But a system where door opens if you just carry a specific gun while pressing a button would be more simple and handy. It would be simpler to implement to a map and be less buggy/desynchronized in this buggy/desynchronized game.
User avatar
xElijah
Usurpation Soldier [50]
 
Posts: 96
Joined: 3 October 2020, 15:43


Return to Tutorials

Who is online

Users browsing this forum: No registered users