Attempting a makeshift variable = eventId?

slimey

Villager
Member
Joined
Oct 26, 2015
Messages
8
Reaction score
2
First Language
English
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.



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.
 

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
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.
 

slimey

Villager
Member
Joined
Oct 26, 2015
Messages
8
Reaction score
2
First Language
English
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.



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.
 

slimey

Villager
Member
Joined
Oct 26, 2015
Messages
8
Reaction score
2
First Language
English
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,370
Reaction score
7,678
First Language
German
Primarily Uses
RMMV
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.
 

slimey

Villager
Member
Joined
Oct 26, 2015
Messages
8
Reaction score
2
First Language
English
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.
 

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

Latest Threads

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,882
Messages
1,017,230
Members
137,607
Latest member
Maddo
Top