How do you call an Actor level without knowing the Actors ID?

firestalker

Veteran
Veteran
Joined
Nov 18, 2015
Messages
390
Reaction score
50
First Language
English
Primarily Uses
RMMV
I want to check the level of an actor, but not a specific actor.  I want to check the Level of an actor that is the target...  I want to use it in a formula for something but it can't be actor specific.


Is there a Script Call or something for this?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,528
Reaction score
14,261
First Language
English
Primarily Uses
RMVXA
I've done it in the damage formula with a.level, a the level of the attacker (or if it is the defender, b.level). Be advised though that by default, enemies don't have levels, so that might crash the game if the skill is used by enemies too.
 

firestalker

Veteran
Veteran
Joined
Nov 18, 2015
Messages
390
Reaction score
50
First Language
English
Primarily Uses
RMMV
Oh...  I forgot to mention this not for a damage formula.  This is for an unrelated formula.  Something that doesn't use the conventional formula rules and variables.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
How can you have a target if it's not a damage formula?  How do you specify who the target is, because target is used in the regular battle context.  Where are you planning on putting this call?
 
Last edited by a moderator:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
876
Reaction score
563
First Language
English
Primarily Uses
RMMV
In the damage formula. it'd be "b.level" to get the level of the target. Normally enemy's don't have levels (enemy levels plugins might change that), as bgillisp mentioned, but you could do a workaround like so:


(b.level || 1)


The || means "or", so the line is "target's level OR 1". So if the target doesn't have a level, it gives 1, and if they do, you get their level. The parenthesis are to enforce order of operations so it acts like we expect it to.


||'s behavior is a bit more complicated than that, because Javascript is a very mystical and mysterious language, but for a damage formula that's sufficient.
 

firestalker

Veteran
Veteran
Joined
Nov 18, 2015
Messages
390
Reaction score
50
First Language
English
Primarily Uses
RMMV
I'm looking for a way to call the level for an actor....  Not for the damage formula but something else...  an EXP Formula or a HP formula.  Or a Custom Formula where the formula is generic so there's no specific actor attached to it.  I want to make that generic Formula become specific to an actor.


Something like:


$gameActors.actor(actorId).level


Which doesn't work by the way....  I'm not sure if I'm explaining what I want very well.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
That should work, assuming actorId is defined.  What error is it giving you when you run it?  Does it make the game crash?  F8 will give you the developer tools, and the console tab will show you more info about the error.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
To help identify the problem, can you please specify what information you have on the actor and when/where you want to use that formula?


You can't get it in a general context the way you seem to believe - something needs to identify the actor it is used on, even if that something is a loop through all actors.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Yeah, the call that you need will depend on where you will be using it since different parts of the engine have different variables for the actors, some don't have variables that pertain to actors too. So unless you can specify where you want to call the actor's level, then it's super duper hard to us to help you.


like for example as people said above, if damage formula it will be a.level or b.level, if it's the item application it will most probably be user.level or this.level and so on.. So we need to know where you want to do this.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

On my journey of character rework: I had this character, she was meant to be just a princess that joins your party. And at long term she was just uninteresting... So I tweaked her to be a rebel agaisn't the royalty before meeting up with the party.

Quick tip for any other ametuer pixel artists! When trying to create a colour palette, enabling Antialiasing can speed up the process of creating different shades! Just place your lightest colour and your darkest colour next to each other, select both pixels, and stretch it out!
Revolutionizing the JRPG Industry: Knocking on Doors.

Take that, murderhobos.
Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.

Forum statistics

Threads
106,054
Messages
1,018,578
Members
137,843
Latest member
Betwixt000
Top