Self referencing event via script call?

Status
Not open for further replies.

dex_1010

Villager
Member
Joined
Feb 28, 2016
Messages
21
Reaction score
1
First Language
english
Primarily Uses
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
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV
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
 
Last edited:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
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 :D
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
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
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV
@?????? 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! :kaoslp:
 

dex_1010

Villager
Member
Joined
Feb 28, 2016
Messages
21
Reaction score
1
First Language
english
Primarily Uses
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?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
try replace @event_id with self.event_id :)

(assuming your doing a script call with those as the script code)
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV
@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 :kaothx:
 

dex_1010

Villager
Member
Joined
Feb 28, 2016
Messages
21
Reaction score
1
First Language
english
Primarily Uses
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 :kaothx:
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
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV
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
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV
woops wrong text entry box, mbad on the double post
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
side note: I remember trying to login when my username became ????'s... that was a fun day... :D
 

dex_1010

Villager
Member
Joined
Feb 28, 2016
Messages
21
Reaction score
1
First Language
english
Primarily Uses
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
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
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
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV
:kaoswt2: 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).
 

dex_1010

Villager
Member
Joined
Feb 28, 2016
Messages
21
Reaction score
1
First Language
english
Primarily Uses
:kaoswt2: 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
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
150
Reaction score
184
First Language
English
Primarily Uses
RMMV


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.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
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 :*
 

dex_1010

Villager
Member
Joined
Feb 28, 2016
Messages
21
Reaction score
1
First Language
english
Primarily Uses


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
 

Attachments

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
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
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top