Self referencing event via script call?

What I'm trying to do is find the script calls for the following commands

Control variables > set to > game data > this events map X
Control variables > set to > game data > this events map Y
Control variables > set to > game data > this events facing direction

I can see exactly how to do it without a script call, but Ideally I need to use the script call so I can do it inside of a set move route.

I've looked everywhere and cannot figure out how to do this with a script call. Am I just being silly and/or blind?

Any help is greatly appreciated
Edit: Oh yeah ace hmmmm

Edit2:
Yeee theo also got it below <3 Here replace # with variable #, no 0s in front!
And if you can put them all in one script call remember to put ; at the end of the line!

$game_variables[#] = $game_map.events[event_id].x
$game_variables[#] = $game_map.events[event_id].y
$game_variables[#] = $game_map.events[event_id].direction
I believe that `this._eventId` contains the id of the event on the current map. Been a while, but im sure its that. could use that to get the position data to store in your variables. 🙂

edit: ninjad </3
oh wait. vx ace... hmmm... been even longer lol 😀
Code:
$game_variables[...] = $game_map.events[@event_id].x
$game_variables[...] = $game_map.events[@event_id].y
$game_variables[...] = $game_map.events[@event_id].direction
Replace ... with your variable id
@?????? Lmaaaaooo I fell for the same trap at first, eventID back then was just straight up event_id and I was so confused when I swapped to MV because I had negative zero script knowledge back then! 😴
Code:
$game_variables[...] = $game_map.events[@event_id].x
$game_variables[...] = $game_map.events[@event_id].y
$game_variables[...] = $game_map.events[@event_id].direction
Replace ... with your variable id

I've just tried these solutions (with the variable ID I needed), and its come up with undefined method 'x' for nil:NilClass

Am I doing something wrong?
try replace @event_id with self.event_id 🙂

(assuming your doing a script call with those as the script code)
@dex_1010 Yeah that means one of the things in your []'s is wrong!

If ???????????????????????????????????????????????????????????????????????????????'s didn't work try my previously edited answer above with [event_id] instead of [@event_id] ~ That's what was in my old projects 🙏
That's now returning a new error.

undefined method 'event
@dex_1010 Yeah that means one of the things in your []'s is wrong!

If ???????????????????????????????????????????????????????????????????????????????'s didn't work try my previously edited answer above with [event_id] instead of [@event_id] ~ That's what was in my old projects 🙏

That one leads to Undefined local variable or method 'event_id' for #<Game_Event0x86d501c>

EDIT:

If i use self.event_id then i get undefined method event_id
Did you replace # with a variable #? xD @dex_1010
It must have no 0's in front so for example if my variable is 4:

$game_variables[4] = $game_map.events[event_id].x
$game_variables[4] = $game_map.events[event_id].y
$game_variables[4] = $game_map.events[event_id].direction
woops wrong text entry box, mbad on the double post
side note: I remember trying to login when my username became ????'s... that was a fun day... 😀
Yeah it's variable 12 and I'm only inputting [12]

should probably explain, Ive been using RMVXA for about 6 years, just never delved into scripting much but I know the barebones basics
Trying replacing [event_id] with the id number of the event concerned. So your first example might read

$game_variables[4] = $game_map.events[15].x
😅 If putting in the eventid as kes says works, but the previous event ID calls don't then it might be unable to grab it from in the move-route script call I guess qvq Maybe cuz it might be trying to grab the eventID of "move-route" rather than the actual event? Not sure.

I don't remember for ace cuz it's pretty old now~ So you might have to program some of the move-route, then do event stuff, then do the rest of the move-route depending on how you have it set up.


Also if you're trying to do this in a common event, it's super wonky (Just double checking that's not the case here).
😅 If putting in the eventid as kes says works, but the previous event ID calls don't then it might be unable to grab it from in the move-route script call I guess qvq Maybe cuz it might be trying to grab the eventID of "move-route" rather than the actual event? Not sure.

I don't remember for ace cuz it's pretty old now~ So you might have to program some of the move-route, then do event stuff, then do the rest of the move-route depending on how you have it set up.


Also if you're trying to do this in a common event, it's super wonky (Just double checking that's not the case here).

Funny you should say that haha

Falcao's Pearl ABS has a feature where skills can trigger the following of a move route so I have been toying around with that in hopes it might work as well.

But even outside of the Pearl ABS and not using common events, its still not working unless i reference each individual event on those events
d355124b858871b00ce87b8154708bf7.png


Can you link us some screenshots tho, that should help some people maybe figure out what the heccin' be goin on. <3 Quarter-tempted to reinstall vxace but also my c-drive cries.
ok, I loaded up vx ace.

Code:
class Game_Interpreter
  def this_event
    return $game_map.events[@event_id]
  end
end

This is tried and tested code taken from a core script i wrote back in 2013-2014. If you add that code to a new script page, you can use 'this_event' in a script call. So for example, doing the following should work fine:

Code:
$game_variables[4] = this_event.x
$game_variables[4] = this_event.y
$game_variables[4] = this_event.direction

good luck :*
d355124b858871b00ce87b8154708bf7.png


Can you link us some screenshots tho, that should help some people maybe figure out what the heccin' be goin on. <3 Quarter-tempted to reinstall vxace but also my c-drive cries.

This is outside of common events inside the actual event move route
This is outside of common events inside the actual event move route
*sigh*

Script call in the move route is different than script call as event command, script call.
For that, use this
Code:
$game_variables[...] = self.x
$game_variables[...] = self.y
$game_variables[...] = self.direction

Original thread: https://forums.rpgmakerweb.com/threads/self-referencing-event-via-script-call.123200/