Event foot step sounds not working

con = 0
evid = $game_variables[146]
mspeed = $game_map.events[evid].move_speed
x1 = $game_map.events[evid].x; y1 = $game_map.events[evid].y;
wait(2)
x2 = $game_map.events[evid].x; y2 = $game_map.events[evid].y;
con += 1 if x1 != x2; con += 1 if y1 != y2;
if con > 0
dist = Math.sqrt((x1-x2)(x1-x2) + (y1-y2)(y1-y2))
regid = $game_map.events[evid].terrain_tag
volume = 100 - dist*10
if volume <= 1
volume = 0
end
if volume >= 80
volume = 80
end;
regid = $game_map.events[evid].region_id; gvar = 152 if regid == 0
gvar = 151 + regid
soundid = $game_variables[gvar]
RPG::SE.new(soundid, volume, 100).play

Gvar is assigned to a variable set a string
end
Capture.PNG
You should put code in CODE tags (the </> on the edit bar) - you can see where portions of your code were parsed as BBCode and turned your text italic instead of being displayed legibly.

You should also actually use some words in your post to introduce your problem and question...even if you feel the title of the thread covered everything, it comes across as more human than just plopping a chunk of code down, and people may feel more interested in helping you 😉

Original thread: https://forums.rpgmakerweb.com/threads/event-foot-step-sounds-not-working.171767/