I’m glad it worked to some extent! It could still have worked without the variable, though. ^^;; But I’m so glad it did work, at least!
Also, you didn’t have to copy the conditions! The sub-event obeys the same conditions as the “parent event”!
Sub-events inherit the conditions of the ones above it. So, for example, if Event 1 has the “If item is in inventory” condition, the sub-event will ALSO obey the condition! No need to copy them if they’re sub-events.
If you don’t mind, though, I still wanna break down the events on these screenshots to try and explain what was going wrong!
// Second Screenshot //
The reason why using HASWALNUT worked in that example is because the value of HASWALNUT is 1, so every single time the Random expression gives a 1 in WalnutShot, it plays. The expression can only give the values 1, 2 or 3 - so it’s a 1/3 chance. It works great, but it doesn’t NEED the HASWALNUT variable.
You didn’t need to compare it to HASWALNUT. If you replace it with just “1”, it’ll work the same - as that’s the fixed value of HASWALNUT if the Walnut is equipped.
So no, HASWALNUT is still not quite necessary!
I’m sorry, I love the name of the variable though
And also, there’s nothing stopping the For Each event from playing over and over yet again. Which is why I kinda wanted you to drag it to be a sub-event.
// First Screenshot //
In the 3rd event:
If Variable WalnutShot of Bullet <= Bullet.Variable(WalnutShot)
As you’ve already pointed out, you were literally testing if WalnutShot is less or equal to WalnutShot. This is probably why every single bullet was becoming a Walnut. ^^;;
Instead, you could’ve done:
If Variable WalnutShot of Bullet = 1
Which would give the exact same result as comparing it to HASWALNUT, which is also a fixed 1 value.
And now that I think about it, there’s a chance you don’t even need a sub-event at all!
I think this is how it could’ve worked:
For each Bullet object
If inventory "MyStuff" contains a "Walnut"
If "Walnut" is equipped in inventory "MyStuff"
If variable "WalnutShot" of Bullet = 0
do RandomInRange(1,3) to variable "WalnutShot" of Bullet
If variable "WalnutShot" of Bullet = 1
do = 2 to the scale of Bullet
Set animation of Bullet to "WalnutShot"
I think that would do it, without the need for sub-events or for the HASWALNUT variable, and really simplifying it into two events! ^^
I hope this helps, and sorry I took a bit to respond!