Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
Code:
◆If:Script:(($gameActors.actor(1).isClass(5).id || $gameActors.actor(4).isClass(5).id || $gameActors.actor(5).isClass(5).id || $gameActors.actor(8).isClass(5).id || $gameActors.actor(9).isClass(5).id))
  ◆Jump to Label:Bypass
  ◆
:Else
  ◆Text:None, Transparent, Bottom
  :    :\N[1] Is not a thief. He cannot perform this
  :    :command.
  ◆If:Class of \N[1] is Thief
    ◆Jump to Label:Bypass
    ◆
  :End
  ◆Jump to Label:Break
  ◆
:End
It is an IF OR statement that should return true when any of the above actors are the thief class. Do these type of statements work in RPG maker?
I did try to get around it using the script
Code:
◆Script:if (($gameActors.actor(1).isClass(5).id || $gameActors.actor(4).isClass(5).id || $gameActors.actor(5).isClass(5).id || $gameActors.actor(8).isClass(5).id || $gameActors.actor(9).isClass(5).id)){
:      :$gameVariables.value(200); = 5;
:      :}
Then a conditonal branch to check the variable but it still through up the message that the actor was not a thief. Edit: I have a feeling it may be due to the isClass(5).id part but I am not sure.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,446
Reaction score
15,714
First Language
English
Primarily Uses
RMVXA
Or works fine in RPGMaker, so it is not that. Change it to isClass(4).id and see if it works, as class id's might be starting at 0 in the engine, and if that is the case you'll have to use 1 less than what you really want to access it.

Or try changing someone to class 6 in the database and see if that works now. In fact that might be faster.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I tried changing it to class 4 and it still returned false.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
410
Reaction score
238
First Language
English
Primarily Uses
RMMV
Use this format instead, it should solve the issue.

Code:
$gameActors.actor(1).isClass($dataClasses[5])
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
That fixed it, seems to be working now.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,446
Reaction score
15,714
First Language
English
Primarily Uses
RMVXA
What you need to do is find a way to force the engine to print out the values of a script at certain points. In Ruby you can do that with msgbox_p( what you wish to print out), not sure about Javascript.

Now I did try your code in ACE and it says that code is NIL, which might be the problem. But maybe they changed it in Javascript to be a different reference.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,225
Reaction score
11,101
First Language
Czech
Primarily Uses
RMMV
@bgillisp In javascript it would be console.log (whatever)
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
410
Reaction score
238
First Language
English
Primarily Uses
RMMV
For troubleshooting I'll usually just use console.log() for checking values in MV.

EDIT: Ninja'd
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I had the debug menu to check when the variable changed. Using
($dataClasses[5]) to check the class however fixed it. I added in an event to change the class of each actor at will and it worked each time.
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
677
Reaction score
411
First Language
English
Primarily Uses
RMMV
The Game_Actor.prototype.isClass method returns a boolean (true or false), which inherently do not have id properties. The actual method looks like this:
Code:
Game_Actor.prototype.isClass = function(gameClass) {
    return gameClass && this._classId === gameClass.id;
};
So when you pass in a class, you get back either the value "true" or the value "false". So, you were ultimately trying to do "true.id" and "false.id" in your original post, both of which return "undefined" - which JavaScript evaluates as false.

You could also reference the Actor's _classId property if you wanted:
Code:
$gameActors.actor(1)._classId === 5 || $gameActors.actor(4)._classId === 5

Are you ultimately just trying to see if there's a thief in the party, though? You could try the following if you're using RMMV 1.6 or greater:
Code:
$gameParty.members().find(member => member._classId === 5)

If you're using a version prior to 1.6, you could use:
Code:
$gameParty.members().filter(function(member) { return member._classId === 5; }).length
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
Thank you those do look like very nice extra solutions to the issue I was having.
 

Latest Threads

Latest Posts

Latest Profile Posts

Has it really been 50 streams? At this point it's just guilting me into pushing out a prototype. :kaoswt:



I should probably just bite the bullet and send it out, then go with my original plan to provide weekly updates.
I know it's just other small RM devs, but it still always feels legitimizing to have folks email me in private with a steam key, requesting a review of their game.:kaoluv: Look ma, I've made it to the big leagues.
time and time again I enjoy dramatic remarks on how I should find a better job.
As it stands, I go to work for 10-14 days a month. At work, I have time for my private projects. I arrive home, my mind is clear.
So yes, the pay sucks. But I have what so many lose after graduation. Freedom.
Came back cuz of the sale. Got MZ. The System 2 advanced settings for UI are so frustrating, and I see we still hate pixel fonts. Marvelous.
Did another YouTube short. This one has like 1k views (or maybe 380? Analytics is being weird). Getting them zoomer views, yo!

Forum statistics

Threads
129,718
Messages
1,204,640
Members
170,802
Latest member
RavenMiller44
Top