# Boss attack randomiser doesn't work

**URL:** <https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732>\
**Category:** Help\
**Tags:** game\
**Created:** [November 15, 2024, 7:37pm UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732 "2024-11-15T19:37:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PLAYER42](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PLAYER42](https://forum.makecode.com/u/PLAYER42)\
**Post date:** [November 15, 2024, 7:37pm UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732/1 "2024-11-15T19:37:33Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/5/35a16c94530a317205a7c39bf0f25e15e858c13b.png)  
I’m trying to randomise my boss attacks but none of the methods I’ve tried have worked, the image shows the latest iteration which allows the game to still run, my previous attempts used the “For action settled once every X” block but that froze the game, is there any way I can fix this?

[https://arcade.makecode.com/S05444-03372-29317-23855](https://arcade.makecode.com/S05444-03372-29317-23855)

---

<div class="post-metadata">

**Author:** ![anon30657772](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anon30657772](https://forum.makecode.com/u/anon30657772)\
**Post date:** [November 17, 2024, 8:35pm UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732/2 "2024-11-17T20:35:43Z")

</div>

Why not use a forever block that checks if the boss is enabled and if they are, then run a % chance condition for different attacks after a pause block!

---

<div class="post-metadata">

**Author:** ![PLAYER42](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PLAYER42](https://forum.makecode.com/u/PLAYER42)\
**Post date:** [November 19, 2024, 3:44am UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732/3 "2024-11-19T03:44:38Z")

</div>

Unfortunately, I don’t know how to use the chance block, the help thing doesn’t show anything useful

---

<div class="post-metadata">

**Author:** ![anon30657772](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anon30657772](https://forum.makecode.com/u/anon30657772)\
**Post date:** [November 21, 2024, 3:08am UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732/4 "2024-11-21T03:08:20Z")

</div>

Think of the % chance as how often you want the code inside the logical statement to happen. 100% being always, 50% being half of the time and 0% being never.

In [_ **this** _](https://makecode.com/_WLfWfrg0jWyT) game example, each sprite has a different chance of getting a point when we press A (spacebar):

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/6/2/6280091eff2131b606234e3f366553527f91142b.png)

A more appropriate example would be [_ **this game** _](https://makecode.com/_9CvdbaYjF7gd) I made long ago. _(PS: The code is just an example of how to do bosses with different attacks but it’s definitely **NOT** a good one! I was new and still experimenting)_.

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [November 21, 2024, 8:21pm UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732/5 "2024-11-21T20:21:01Z")

</div>

I don’t know about you, but “else if” exists, press the “+” on the boolean blocks.  
(Not trying to be rude…)

---

<div class="post-metadata">

**Author:** ![anon30657772](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anon30657772](https://forum.makecode.com/u/anon30657772)\
**Post date:** [November 22, 2024, 12:37am UTC](https://forum.makecode.com/t/boss-attack-randomiser-doesnt-work/31732/6 "2024-11-22T00:37:01Z")

</div>

No offense taken!  
Using “Else IF” here would actually change the gameplay!  
When only using IFs, the game will check all statements. But, when using an “Else IF”, the game will only check the other IFs only if the first statement was false. Both are viable depending on context!
