Author Topic: Confusion with "Change Block" command  (Read 1531 times)

Kemuja

  • Welfare Team Captain
  • Level 1: Bizz
  • *
  • Posts: 14
    • View Profile
Confusion with "Change Block" command
« on: July 09, 2021, 06:14:22 PM »
I was trying to make a TNT, that would have "Detonate" as its Destroy animation (and destroyed when anyone bumbs or steps on it). Now I wanted to make a better chain reaction (normally, when this TNT gets destroyed, another would start its "Detonate" animation. I want to make it so, that when this detonates, TNTs next to it would instantly explode).

I was then trying to work with commands to make it trigger a command when near an explosion and would change itself into a "insta-exploding" version of itself (a different block + because there's no way to change block's Destroy animation to something else as far as I saw), but here's a kicker: "Change block" command doesn't allow me to have it change itself into insta-explosive; I can only make it change every TNT on the screen into it.
I was also trying to use "for nearest block", but that went nowhere.
When I tried to do something like this:
Code: [Select]
change block ,5nothing happened, but when I did this:
Code: [Select]
change block 5it would give a GameMaker error and crash.

How do I make a triggered block change itself into a different block (without it changing every block on the screen)

Antikore

  • Developing Mortal Theater at day, developing depression at night.
  • Level 22: Trex
  • *
  • Posts: 2020
  • Enjoying Platform Builder from the very start
    • View Profile
    • PBuilder Resources
Re: Confusion with "Change Block" command
« Reply #1 on: July 22, 2021, 11:45:00 AM »
I was trying to make a TNT, that would have "Detonate" as its Destroy animation (and destroyed when anyone bumbs or steps on it). Now I wanted to make a better chain reaction (normally, when this TNT gets destroyed, another would start its "Detonate" animation. I want to make it so, that when this detonates, TNTs next to it would instantly explode).

I was then trying to work with commands to make it trigger a command when near an explosion and would change itself into a "insta-exploding" version of itself (a different block + because there's no way to change block's Destroy animation to something else as far as I saw), but here's a kicker: "Change block" command doesn't allow me to have it change itself into insta-explosive; I can only make it change every TNT on the screen into it.
I was also trying to use "for nearest block", but that went nowhere.
When I tried to do something like this:
Code: [Select]
change block ,5nothing happened, but when I did this:
Code: [Select]
change block 5it would give a GameMaker error and crash.

How do I make a triggered block change itself into a different block (without it changing every block on the screen)

This may work, I didn't check but may do the thing. There is always the chance of needing some bugfix to make it work:
Code: [Select]
for nearest block <id of your main tnt block>
spawn block 5, self
remove block

Note that this miay activate any tnt in the view, just because its the nearest
And also this will only work for one close tnt and not all of the surrounding ones, SO, you may need to do some kind of workaround
Sorry because my English is not very good because I'm Spanish ;) :P

Kemuja

  • Welfare Team Captain
  • Level 1: Bizz
  • *
  • Posts: 14
    • View Profile
Re: Confusion with "Change Block" command
« Reply #2 on: July 22, 2021, 02:01:31 PM »
This may work, I didn't check but may do the thing. There is always the chance of needing some bugfix to make it work:
Code: [Select]
for nearest block <id of your main tnt block>
spawn block 5, self
remove block

Note that this miay activate any tnt in the view, just because its the nearest
And also this will only work for one close tnt and not all of the surrounding ones, SO, you may need to do some kind of workaround

This actually worked (Note, that it triggers when in the range of the explosion).
Cheers!