So, my end goal is to be able to create proximity sounds, but I've run into an issue I wasn't expecting. I'm not experienced with Ruby scripts, but I'd seen a specific couple of lines that I thought should work:
Ruby:
sx = distance_x_from($game_player.x).abs
sy = distance_y_from($game_player.y).abs
But when the event is triggered, it gives the error message:
"Script 'Game_Interpreter' line 1411: NoMethodError occured.
undefined method 'distance_x_from' for #<Game_Interpreter:0xd4c39f4>"
So, anybody able to help me figure out what's wrong?
that means there's no method called distance_x_from or distance_y_from defined in the Game_Interpreter... the line you see working might be from other script that define that method inside Game_Interpreter. you might want to have that script installed if you want it to work...
if you're did not want to have that script... i think you can also get the event x and y that currently executing the event command with:
Code:
ex = $game_map.events[@event_id].x
ey = $game_map.events[@event_id].y
for player you can use:
Code:
px = $game_player.x
py = $game_player.y
but... if i remember correctly we can also store above in variables...
there's a built in function that can grab that gamedata and store it in control variable event command.
you can store them in the variables... and then you can calculate it to know the 'distance'...
i cannot test above because currently my ACE is already uninstalled... but hope this help.
edit: i think the script you see is this:
What is Simple Detect System?Lets explain it. When player get closer to a specific event, player will be detected.How Works ItRead Introductions in Script.Note : Make Parallel Process in detector event.Example :Script : # ------------------------------------------------- # Script Name : Detector ...
www.rpgmakercentral.com
but using that script... your way of calling the method still wrong though... you need to pass the eventid and the player pos...
so maybe this:
Code:
sx = distance_x_from(@event_id,$game_player.x).abs
sy = distance_y_from(@event_id,$game_player.y).abs
hope this help.