Attempting a makeshift variable = eventId?

Hey all. I'm doing an event-based battle system and self-variables would be a life saver.

I'm trying to something like Variable ID = @event_id (In Event, making "Control Variable... #002" equal script "$gameMap.events[this._eventId]"). Image example below.

[IMG]http://s11.postimg.org/laxei29qr/attemptthing.png[/IMG]

I finally got it to run, but it's making said variable (in this case event id is 5) become 0.

Not sure if a self-variable type script is needed or if I could event this. Any help/insight would be much appreciated.

By the way, saw the variable become 0 as I am using OrangeHud by Hudell that demonstrates variable as a HUD.
1) you aren't checking for an event-ID, you're checking for the event itself - that is all data you see in all pages of an event combined and not the simple ID-Number.


You need to rewrite the script call to check for the event-ID instead.


2)http://forums.rpgmakerweb.com/index.php?/topic/42500-the-self-data-suite-support-thread/
Another workaround other than Andar's

Use

this._eventId instead of $gameMap.events[this.eventId]

Assuming you want to check wether this event ID equals your variable, use

this._eventId == $gameVariables.value(your id)

On the conditional command

Well, I thought $gameVariables was an array so it's member could be called by a [ ] but actually, it could not.
Sorry Andar, I should have said I'm working with RMMV. Not sure any ruby-based code could really help, since some things are different (such as the class is $gameVariables in RMMV instead of how it was in RMVXAce). Also the purpose for this script-calling is so I could copy and paste events rather than make/modify every single one. Looking like I'll make over 200 enemies and currently it's taking ~4 mins to edit each one. Also trying to learn the hard way and script calls more.

Another workaround other than Andar's

Use

this._eventId instead of $gameMap.events[this.eventId]

Assuming you want to check wether this event ID equals your variable, use

this._eventId == $gameVariables.value(your id)

On the conditional command

Well, I thought $gameVariables was an array so it's member could be called by a [ ] but actually, it could not.
Thanks Heartbreak61. "Variable = this._eventId" seems to work.

[IMG]http://s7.postimg.org/61z7lhgbv/attemptthing2.png[/IMG]

I couldn't however get the variable conditional to work. Scratch that. It's looking like I got what I came for but I'll event some more to see if there's anything lacking. Thanks guys.
Was able to do what I set out to do with "$gameVariables.value(this._eventId)" (variable chosen is the same number as the event ID) and "var NUM = $gameVariables.value(this._eventId); $gameVariables.setValue(this._eventId, NUM-1)" (when I want to subtract from said variable). Thanks guys for your input.
Sorry Andar, I should have said I'm working with RMMV.
Then you've posted in the wrong forum, this is for RGSS script support
I've moved this thread to JS script support. Please be sure to post your threads in the correct forum next time. Thank you.
Then you've posted in the wrong forum, this is for RGSS script support

I've moved this thread to JS script support. Please be sure to post your threads in the correct forum next time. Thank you.
Sorry about that. You may close the thread though as it's been solved.

Original thread: https://forums.rpgmakerweb.com/threads/attempting-a-makeshift-variable-eventid.48011/