Creating a Rule for Enemies to release items
butterbean
Member Posts: 4,315
I wanted to know how you could create a rule to allow enemies to emit or release certain items once destroyed, and have only certain enemies do this, or have every 15th enemy release an item such as a new gun, or an upgrade to your weapon.
If this is in Game Salad, please describe how this could be done
Thank you!
If this is in Game Salad, please describe how this could be done
Thank you!
Comments
Here's how I would plan to do that.
1. Create a game attribute that keeps track of how many enemies have been spawned. 'TotalEnemy'
2. Its one simple Change Attribute added into the actor that spawns an enemy to increment 'TotalEnemy' by one each time a spawn happens.
Add into the enemy actor(s) the following:
1. An attribute that keeps track of which enemy number it is. 'IAmNumber'
2. A Change Attribute that changes 'IAmNumber' to game.'TotalEnemy'%15, which means it will set the value to something between and including 0 and 14.
3. Where you have the Destroy behavior, add next to it the Rule
-> If 'IAmNumber' equals 0, Spawn Actor (Your weapon)
If you want to make it more difficult and have different things get dropped, you would add some logic and use the random function. But the info above should get you what you need.
Hope that helps.