[RM2K3] FOOTSTEPS? WOW

Posts

Pages: 1

How can I add a footstep noise for every square that the player moves?



I have done it once but I can't manage to do it anymore T___T




PS: !!!!

I forgot to say that the TERRAIN TAB's footstep doesn't do the work for me


It has to be done so I can make EVENT'S footsteps
Put this in a Common Event that's set to be a Parallel Process:

If Switch "First Time Setting Coordinates" Is Off:
Change Variable "Hero X" To Hero X Coordinate
Change Variable "Hero Y" To Hero Y Coordinate
Turn On "First Time Setting Coordinates"
End
Change Variable "Hero X Dummy" To Hero X Coordinate
Change Variable "Hero Y Dummy" To Hero Y Coordinate
If "Hero X Dummy" =/= "Hero X" Then
Play Sound Effect
Change Variable "Hero X" To Hero X Coordinate
End
If "Hero Y Dummy" =/= "Hero Y" Then
Play Sound Effect
Change Variable "Hero Y" To Hero Y Coordinate
End

If you only want it active on certain types of terrain then add an extra line that uses "Hero Dummy X" and "Hero Dummy Y" to check the current terrain type, which can be done using "Store Terrain ID". You'll want it to be around the "Play Sound Effect" bit only, so replace "Play Sound Effect" with:

Store Terrain ID: Variable "Terrain".
If Variable "Terrain" = (The Value You Want) Then
Play Sound Effect
End

EDIT:

At least I think it should work; I feel like there's going to be a problem somehow, but I can't place my finger on it. Lemme know if it works.
Magi
Resident Terrapin
1028
Please don't forget that you might need to add a wait in there somewhere depending on the length of your sound effect.

While you are add it, why not add some additional sounds for different terrain types and some animations when running through dirt? If you're going the event route, there's really no harm in amping up your presentation to the maxxx
I worked out what the problem I couldn't place my finger on was. If you use the eventing that I wrote above then the sound effect will play immediately upon the hero teleporting to a new map. To fix this, you're going to need to do two things.

1) Make it so that the Common Event is only active when a switch called "Footsteps" is turned on. You can do this with the "Trigger Switch" box in the top-right of the Common Event.

2)Make it so that your teleport events look like this:

Turn Off "Footsteps"
Turn Off "First Time Setting Coordinates"
Teleport
Turn On "Footsteps"

That should fix the problem I think my code would have. I would test it, but I'm at work. Don't forget to turn "Footsteps" on at the start of the game, else sounds will never start playing!

@Magi:

You shouldn't need a Wait command. If the player can move to another tile faster than the sound effect plays then that's probably not the right sound effect to use.
With DynRPG, you could actually time a footstep sound with the charset's stepping animation frame--meaning the frequency of the stepping sound would depend on the hero's speed. The code would be pretty short. Start with 2 very short sound effects for footsteps (2 variations would sound nicer than 1), check for the stepping animation frame and play the appropriate sound effect.

RPG::Sound stepLeft("Step1", 100, 100, 50);
RPG::Sound stepRight("Step2", 100, 100, 50);

if (RPG::hero)
switch (RPG::hero->step) {
case RPG::ANI_FRAME_LEFT:
stepLeft->play();
break;
case RPG::ANI_FRAME_RIGHT:
stepRight->play();
break;
default: break;
}
}

I can whip this up into a plugin later if you're interested, but keep in mind that DynRPG/plugins can only be used with the unofficial version of 2k3.
Pages: 1