MP Costs increase every 10 Levels

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
it should be

Code:
if self.actor?
 

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
using it without ? seems to work fine for me... anyway the thing is he still needs to do it for the custom cost part (the one that actually shows the costs)
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
actor is only defined in Game_Actor and returns $data_actors[@actor_id] so it won't work if referencing an enemy. but in this case it would work yes.
 

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
That is exactly why it is used as a boolean for the if... if it doesn't exist, the statement returns false... I never used it to reference anything on the codes I posted.
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
if it doesn't exist it will error not return false.
 

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
it doesn't seem to do so for me and you can always add a ? to be sure...

most battler scripts that I've seen that needs to check if it's actor or not uses that check...

even Game_Interpreter uses checks like that

actor = $game_actors[@params[1]] if actorbasically, if the object after an "if" doesn't exist, the game takes it as the same as false... if it exists it takes it as truenext time, try things out first will you?
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
add this below materials

class RPG::UsableItem::Damage  def eval(a, b, v)    [Kernel.eval(@formula), 0].max * sign  endendand attack an enemy with this formula

Code:
if b.actor;100;else;50;end
 
Last edited by a moderator:

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
why would I even need to add that? that is already defined by default...


anyway I tried it, works fine for me, no errors.


and in case you missed the edit, Even Game_Interpreter uses the check "if actor"


and battler scripts out there uses if actor or if actor? so if what you say is true (that it will error if it doesn't exist), care to explain to me why they work?
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
the default damage eval method has a rescue.

in all those cases actor has already been declared as a local variable.
 

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
Eh? My scripts doesn't declare actor as a local variable, and I use if self.actor or self.actor? as a check if the battler is actor or not. and it works
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
actor is being declared right there...

actor? is a valid method for all battlers

actor returns $data_actors[@actor_id] and only works for objects that come from Game_Actor.

you have not used if self.actor in any of your scripts 

you have used if self.actor? in 1 of your scripts 
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
If you want to do it directly the method you want is in Game_BattlerBase (line 638 or thereabouts):

#--------------------------------------------------------------------------# * Calculate Skill's MP Cost#-------------------------------------------------------------------------- def skill_mp_cost(skill) (skill.mp_cost * mcr).to_i endChange the body of the method so that it takes actor level into consideration
 

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
624
Reaction score
159
First Language
English
Primarily Uses
RMMZ
@Mouser So you are saying that I can alter that method somehow to take in to consideration the actors level? But this would affect every skill..
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
@Mouser So you are saying that I can alter that method somehow to take in to consideration the actors level? But this would affect every skill..
Yes, start a blank script which you place right below Materials (where it says "insert here"):

class Game_BattlerBase def skill_mp_cost(skill) <insert your code> endendand your method now replaces the 'stock' version. You can make it apply equally to every skill, you can use conditionals to have it work one way if an actor uses it and other for the Game_Enemy's. You can have it treat different skills differently, you can even add more parameters to the method call if you want - whatever your heart desires. Just stick it between the def and the end.

If you always overwrite the game methods directly and add your own when needed you never have to worry about things like script compatibility and other issues that can come up when mixing blocks of code from different sources. All is in harmony and peace and Zen find their homes in your code.

Of course, this assumes you know Ruby syntax and the basics of Object Oriented design, like the difference between a variable and a method (actor vs actor?) and a class and an instance and things of that nature. But hey, you gotta start somewhere :)
 
Last edited by a moderator:

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
624
Reaction score
159
First Language
English
Primarily Uses
RMMZ
I'm not fluent in Ruby, but I have taken some Java so I know the basics of Objects, variables vs methods, etc. I usually just look up examples online when I need to do something similar to this.
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
I'm not fluent in Ruby, but I have taken some Java so I know the basics of Objects, variables vs methods, etc. I usually just look up examples online when I need to do something similar to this.
This is the _perfect_ type of method for you to start learning on.

No inheritance, it takes one parameter, returns one value, and does a bit of math in between.

You can also see exactly how it's working by watching your MP bar in the game so you know if it's doing what you want it to.
 
Last edited by a moderator:

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
624
Reaction score
159
First Language
English
Primarily Uses
RMMZ
Alright, I will mess around with it. Thanks!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,845
Messages
1,016,961
Members
137,561
Latest member
JaCrispy85
Top