Different footsteps sounds on different regions quirk - SOLVED

Started by Akril15, Wed 01/06/2011 03:34:04

Previous topic - Next topic

Akril15

I've discovered two different ways to get the player character to have different footstep sounds on different regions within a room -- one way is changing the sound by making use of the "Player walks onto region" and "Player walks off of region" events, the other is inserting code like this in repeatedly_execute:
Code: ags
if (Region.GetAtRoomXY(player.x, player.y) == region[1]) {
    steps_dirt(); //footsteps on dirt
  }
   if (Region.GetAtRoomXY(player.x, player.y) == region[2]) {
   steps_wood(); //footsteps on wood
  }

Both of these methods work, but there's still one minor problem: if I trigger an event that makes the player character walk across multiple regions, her footsteps will sound the same regardless of which region she is walking across. If she's standing on a footsteps-on-wood region and the event requires her to walk across a footsteps-on-dirt region, her footsteps will sound as if she's walking on wood even while she's walking across the dirt region.

I don't encounter this problem at all if I move her across multiple regions by using the Walk cursor, and there are only a couple of screens where I use multiple regions like this, but I'd still like to get this problem solved, as minor as it is.

Thanks!

Khris

The problem is that the player character performs a blocking walk and during those, repeatedly_execute isn't called.
One solution is to use repeatedly_execute_always instead. Just create a function of that name in Global.asc.

Akril15

All right -- that fixed it! Thank you for explaining why the game was behaving like that; it had me stymied for a long time.

SMF spam blocked by CleanTalk