Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[MMF2] [Sonic Worlds] Rocket Generator Sensor help.


Red6095

Recommended Posts

Well, I made a rocket gimmick, and it works well. The bad thing is that, the rocket explodes after it touches a sensor with a destroy line, some explosion effects and all. This also deletes every other rocket there's on the stage, so I'm trying to make a sensor that generates a rocket when the player overlaps it.

It just doesn't work. It appears less than half a second, and then dissapears.

Also, I made it so the sensor dissapears when touched, because If I let it there, the rocket will appear, but it'll be like transparent, as the player won't be able to touch it. Also it will cause the game to lag horribly, and the collision with almost everything will be buggy (for example, you gotta stay like 2 seconds over a ring to get it)

post-8658-138639765358_thumb.png

So, there's the code. What I'm doing wrong? Any help, please?

(also, if this thread doesn't belong here, please move it. I'm pretty sure it goes in fangaming assistance, but if it doesn't, then, dunno :P)

Link to comment
Share on other sites

Seems to be an object selection issue. You need to trigger MMF2's so called "smart" object selection to prevent all your rocket copies from being destroyed.

From what I understand, your process is like this:

1-Sonic touches rocket sensor

2-Rocket is generated

3-Rocket is destroyed.

I think you're getting lag because your condition is "sensor overlaps sensor" and it has no "only one action when event loops" condition. Meaning, MMF2 will create a shitton of rockets as long as the player sensor is around the rocket sensor.

Try making the process like this: When the player sensor is on the rocket area, create the rocket item (with a one action only limiter condition), and have an alterable value assigned to the rocket object: "time remaining". Set the AV to a certain value right on the creation event, and make it go down every frame. Then, when the value reaches zero, MMF2 will properly destroy the object without touching anything else.

MMF2's object selection works in contexts where the object in question is directly in the condition. For example, a "bullet collides with enemy" condition will properly destroy only one enemy since the bullet is colliding with only one specific copy.

However, a "bullet collides with enemy hitbox sensor" event that has a "destroy enemy" action will end up killing all enemies, because the condition doesn't directly treat the enemy object in question, but a hitbox instead. You could add an "enemy hitbox sensor overlaps enemy" subcondition for it to trigger correctly (this condition will always be true, but it should help MMF2 pick the correct enemy because of the bullet>hitbox>enemy connection.)

But the proper way to proceed when instances are being troublesome is to spread a value on the objects:

You should check how the Spread value action helps you control different instances of an object. Check this thread, it has an attached mfa that shows the spread action.

Link to comment
Share on other sites

Should I mention I'm using the moving hanging bar gimmick that came with SW? :P

I can't get the Spread Values to work right. Seems like the best option, but not the easiest.

I setted the Spread Value of the Rocket, the Hanging Bar 2 (lol), the Hanging Sensor 2, the Rocket Flight Sensor and the Rocket Exploding Sensor, all to 0, then all to 1, then all to random stuff I tried and it all worked the same with a few exeptions where nothing happened...

So how this "worked" was like this:

I duplicated the five items I already mentioned four times, to test this new little thing you thought me. I tried by jumping onto the first one, and it works. But the other three left don't. Also, If I jump on the other three, the first one will launch, but the others won't.

Anyway, at least it doesn't destroy the other instances of the objects, so, you can still hang on them, they're still there, but they won't launch.

FullRocketCode.rar

Also, the sensor made to create rockets wasn't meant to destroy them. It was there to just create them so I didn't have to basically clone the rockets to put one or two more, wich is such a pain to me.

And the lag issue was because the horrible ammount of rockets being generated in less than a second, and then destroyed in a similar amount of time, so, yeah, with this Spread Value thing you told me about, I won't be needing to use the Rocket Generator Sensor, so thanks!

Also, completely unrelated. How do I give reputation points or whatever they're called? (I think it's something like that :P)

Thanks!

PS: I uploaded the code in .rar because in .png caused the image to transform into a .jpg and lower its size. Then you wouldn't be able to see anyting.

Link to comment
Share on other sites

For selection purposes, you should have the overlapping condition be first for each event. However due to the nature of what you want done, you'll probably need object iteration to make sure that it works properly (MMF2's selection system is iffy at best). To make this easy, you should use the ForEach extension. Sonic Worlds Delta should have several examples of the ForEach object in action. If you want though, try using the 'Pick "object" at random' condition to cheat; this tends to work but can add latency in event processing due to testing one object per frame.

Link to comment
Share on other sites

Thanks fo all the help, it's all solved now.

Though, I don't really know what I did to fix everything.

There were two lines in the Rocket Exploding sensor that destroyed the flight and destroy sensors, so, that didn't let the other rockets to go.

So basic :P

Also, there's still some stuff to fix in the Rocket's destroy code.

I want to make sonic to automatically jump after the rocket explodes, and also, while the rocket flies, disable Sonic's control. Not sure how to do that, i don't know how to do it in Delta, so if someone can tell me how I can do that?

I tried by setting the Action 40 (springs) when the rocket touches the sensor, but Sonic just gets stuck in there...

I don't know what to do, since it's all I know. Any help? :3

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...