I'm back with yet another roadblock in my project; Making enemies drop random health items upon death.
Here, my problem is that once an enemy dies, it picks one of the seven health items (at random) and places it where the enemy dies.
There are 7 different gems in total. The problem here is that when all 7 gems are collected, they are destroyed for good and the player can no longer receive health pickups.
I'm trying to fix it by adding a Create event for the Gem Group, but as you are all aware MMF2 does not allow for using the Create event on Qualifiers.
i think you could mark them as in active with a value, then set a later time to destroy them in a loop. Which is selective about what objects that are deleted.
but if you really want to run them to zero. you can pull them from a another level when you create them. This other level the player will never see. It will sort of work like your in program library of objects.
Originally Posted by Pan-tosser i think you could mark them as in active with a value, then set a later time to destroy them in a loop. Which is selective about what objects that are deleted.
but if you really want to run them to zero. you can pull them from a another level when you create them. This other level the player will never see. It will sort of work like your in program library of objects.
Hmm...that might be one way. Not sure how to pull that off though.
IF Count of [Health Item] <7
THEN Create [Health Item] at -100, -100
///
Seems to me like this would always create a health item off-screen. Change the coordinates of item generation if there's a certain zone from which the Event grabs health items.
To double-check that this works, add a sound effect to the Create action. You'll hear it when the event triggers. If you hear it a zillion times overlapping itself, then something's wrong. Same if you never hear it after collecting Health Items.
IF Count of [Health Item] <7
THEN Create [Health Item] at -100, -100
///
Seems to me like this would always create a health item off-screen. Change the coordinates of item generation if there's a certain zone from which the Event grabs health items.
To double-check that this works, add a sound effect to the Create action. You'll hear it when the event triggers. If you hear it a zillion times overlapping itself, then something's wrong. Same if you never hear it after collecting Health Items.
That'll do it. Thanks s-m-r! I'll go test it out as soon as I can later today.
You know, you could also have the health items created upon the destruction of the enemy creatures instead of have them created off to the side and then moved into the play area. I'm sure there's a reason you've not already done this, however.
Good point s-m-r. I guess creating right away would be the most obvious thing to suggest.
But i personal don't use that method. because i like a gap between the death and the power up. Just in case I decide to add any AI routines in too it. Where the AI decides to alter what is dropped based on what the player has.
I've also played around with different directions in a animation storing power up art work. I like your off screen method too. It's good for objects that never move, and might wander on screen when created.
Simple-pimple.
Jump into the properties of each of your active object power-ups and disable "Create at start" and "Visible at Start" options. Give each object a "Decay" alterable value (make sure it always replaces AlterableValueD for instance) and set it to 300 or something.
Use your trigger event to create each power-up object at the enemy's location just before it's destroyed - when each power-up is created, it will still be invisible until the decay value hits 0. Want to increase or decrease the duration before a power-up is visible? The Decay rate is dropped by 1 every frame. That doesn't necessarily mean 300 milliseconds especially if the event takes place while fastloops are executed, but it's a close enough guess.
You've already got all your power-ups grouped, so create an Always event and subtract 1 from the power-up group's "AlterableValueD" (Decay Value). Then create a new event that tests if "AlterableValueD" (Decay Value) is equal or less than 0. Chuck in a "Run Once When Event Loops" condition for safety, but you should be able to simply make the power-up visible. If you disabled "Move at start", now would be a good time to start the movement too.
When you get to adding collision data, do it on a individual basis and add a "Is power-up visible?" condition so the player doesn't trigger the power-up before the Decay reaches 0.
Edited by The_Antisony
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?