I need help with triggers

Report any bugs here or ask questions here.

I need help with triggers

Postby marlook23 » 20 September 2020, 16:10

I'll try to explain the best way I can.

I want to active a trigger dropping a gun.

Like, someone say to you: "Put the gun down" and you can choose. And if you obey, he don´t pull all the bullets on your chest. Or, if you put the weapon with a decoration, it activates some actions and give you free pass to other levels, etc.

I suspect that it have to be part of -activation: by movable. But I dont already imaging how to prepare the situation explained before.

I'm even interested in know the full complexity of all the trigger's action, to be more comfortable to work with. Exist a tutorial list or page to watch it?

Thx for your time.

marlook23
Recruit
 
Posts: 21
Joined: 23 October 2016, 12:32

Re: I need help with triggers

Postby Strikez » 20 September 2020, 17:06

Now although im not the smartest player when it comes to triggers, i am sure that activation via movables only works for movable objects such as doors and not guns or decors

Strikez
Recruit
 
Posts: 7
Joined: 29 August 2020, 06:42

Re: I need help with triggers

Postby mrblake213 » 21 September 2020, 00:51

I think the best thing you can do here is that by letting the player press E to "drop the gun" and if he didn't press the button then we should assume that he didn't choose to drop it and thereby going to the next event.

I don't know whether it can be done more efficiently with variables.
The staff job description:
User avatar
mrblake213
Moderator
 
Posts: 696
Joined: 16 July 2013, 10:25
Location: Philippines

Re: I need help with triggers

Postby Nyove » 21 September 2020, 01:43

Hey marlook23,

In this scenario, I am assuming you want to spawn a set of weapons through a trigger execution.
The map page for your reference will be: https://www.plazmaburst2.com/level_edit ... awngun&a=#
Copy the map source as soon as possible, as I don't intend to keep the map forever.

1. Put the set of weapons you want to spawn on an entity. (A single weapon works fine.)
2. Use trigger action 'Save inventory info of Character 'A' to variable 'B'' to save the inventory info (the guns that entity is carrying) to a variable, let's call it ~gunsToSpawn.
3. Use trigger action 'Spawn all weapons stored in variable 'A' at position of Character 'B'' to clone the weapons stored in ~gunsToSpawn to a character.

To execute that trigger, you can use the method mrblake suggested, by using an USE button region. You can also explore alternative solutions like timers, execute when gun fired, etc. (There are many options.) In the map demo, I used USE button region method.

For a slightly more efficient (lag free) way but advanced method, you can manually set the variable using 'Set variable 'A' value to value 'B'' and use weapon ID. That way you can skip step 1 mentioned above.

Refer to viewtopic.php?f=126&t=21750 for weapon ID explanation.

Best regards,
Nyove
Proud to be part of something meaningful.
Need help with the launcher? Contact us on plazmaburst2.com/support

Contact me on discord for quickest reply possible.
https://discord.gg/hRbwsAdDuk

User avatar
Nyove
Trial Staff
 
Posts: 199
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: I need help with triggers

Postby marlook23 » 21 September 2020, 14:43

Nyove wrote:Hey marlook23,

In this scenario, I am assuming you want to spawn a set of weapons through a trigger execution.
The map page for your reference will be: https://www.plazmaburst2.com/level_edit ... awngun&a=#
Copy the map source as soon as possible, as I don't intend to keep the map forever.

1. Put the set of weapons you want to spawn on an entity. (A single weapon works fine.)
2. Use trigger action 'Save inventory info of Character 'A' to variable 'B'' to save the inventory info (the guns that entity is carrying) to a variable, let's call it ~gunsToSpawn.
3. Use trigger action 'Spawn all weapons stored in variable 'A' at position of Character 'B'' to clone the weapons stored in ~gunsToSpawn to a character.

To execute that trigger, you can use the method mrblake suggested, by using an USE button region. You can also explore alternative solutions like timers, execute when gun fired, etc. (There are many options.) In the map demo, I used USE button region method.

For a slightly more efficient (lag free) way but advanced method, you can manually set the variable using 'Set variable 'A' value to value 'B'' and use weapon ID. That way you can skip step 1 mentioned above.

Refer to viewtopic.php?f=126&t=21750 for weapon ID explanation.

Best regards,
Nyove


well this is a lot of work, but this is not what Im searching.

I need to know if exist a form to activate a trigger by a gun. Not at the same time. Explain. You get a weapon with a "box decoration" for example, and you have to introduce that "box" in a collector (non-specific), having the system to advertise the player if the box have enter the collector or vice versa (nothing happen). Better?

Is not about drop the gun itself, is more like the gun reach some part of a map and activate a trigger. And If it can be when crossing a certain point.

marlook23
Recruit
 
Posts: 21
Joined: 23 October 2016, 12:32

Re: I need help with triggers

Postby Nyove » 21 September 2020, 16:58

Hey marlook23,

No worries. I am assuming you are talking about some form of gun detection (trigger gets executed when gun enters a collector.) It is possible, but can get very complicated.

The map page for your reference will be: https://www.plazmaburst2.com/level_edit ... -detectgun
Make a copy of the map, as I don't intend to keep the map forever.

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.

Good luck with all of these.

Best regards,
Nyove
Proud to be part of something meaningful.
Need help with the launcher? Contact us on plazmaburst2.com/support

Contact me on discord for quickest reply possible.
https://discord.gg/hRbwsAdDuk

User avatar
Nyove
Trial Staff
 
Posts: 199
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: I need help with triggers

Postby marlook23 » 25 September 2020, 20:59

this is what I was trying but I've no idea of how use all the variables. I guess is time to learn. Thx Nyove you will be on the credits of my future map :v

marlook23
Recruit
 
Posts: 21
Joined: 23 October 2016, 12:32

Re: I need help with triggers

Postby nightmar » 28 September 2020, 10:44

I am pretty sure it is doable without the usage of variables. However I can only imagine doing it if you want an event to occurr after the gun reaches a specific place in the map.
How many bugs does this game have anyway? jeez
User avatar
nightmar
Falkok [250]
 
Posts: 289
Joined: 2 September 2017, 19:36
Location: Inside your closet or under your bed


Return to Bug Reporting, Help & Support

Who is online

Users browsing this forum: No registered users