The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => Topic started by: maia on March 12, 2008, 07:46:23 PM

Title: [VX] [RESOLVED] Variable as character level does not work?
Post by: maia on March 12, 2008, 07:46:23 PM
I tried it. I even started a new game, deleted all characters but 1.

Then I did variable A = Character A's level

The end result variable A = 0

So I did

Then I did variable A = Character A's EXP

I added the character's EXP via the command.

The end result variable A = 0

Nothing seems to work.

This is in the event system not the scripts.
Title: Re: Variable as character level does not work?
Post by: Zylos on March 12, 2008, 08:00:35 PM
That's odd. It should be working...
Well, here's some code that you can add in with an event.

Code: [Select]
$game_variables[X]=$game_actors[Y].level

X= Variable ID, Y = Actor ID
Title: Re: Variable as character level does not work?
Post by: Garge on March 12, 2008, 10:16:57 PM
I've noticed that some of VX script is missing little things here and there myself.  For example, in lines 840-841 of the Game_interpreter, it looks like this:
Code: [Select]
when 3  # Mul
        $game_variables[i] = value
when it should look like thisL
Code: [Select]
when 3  # Mul
        $game_variables[i] *= value

I think the problem is coming from somewhere in line 750 to 775
Code: [Select]
def command_122
    value = 0
    case @params[3]  # Operand
    when 0  # Constant
      value = @params[4]
    when 1  # Variable
      value = $game_variables[@params[4]]
    when 2  # Random
      value = @params[4] + rand(@params[5] - @params[4] + 1)
    when 3  # Item
      value = $game_party.item_number($data_items[@params[4]])
      actor = $game_actors[@parameters[1]]
      actor = $game_actors[@params[4]]
      if actor != nil
        case @params[5]
        when 0  # Level
          value = actor.level
        when 1  # Experience
          value = actor.exp
        when 2  # HP
          value = actor.hp
        when 3  # MP
          value = actor.mp
        when 4  # Maximum HP
          value = actor.maxhp
        when 5  # Maximum MP
          value = actor.maxmp
        when 6  # Attack
          value = actor.atk
        when 7  # Defense
          value = actor.def
        when 8  # Spirit
          value = actor.spi
        when 9  # Agility
          value = actor.agi
        end
      end

You had a similar problem with variables not taking # of items in possession, and I believe it stems from the same problem with the code in that area.  Using the script change that Modern algebra posted in this thread, http://rmrk.net/index.php/topic,25049.0.html (http://rmrk.net/index.php/topic,25049.0.html), the problem isn't happening between a brand new project and an old project that I have been running with his updated script.
Title: Re: Variable as character level does not work?
Post by: modern algebra on March 13, 2008, 12:12:05 AM
Mmm, enterbrain made a mistake.

They must have decided that setting actor values to variables was no longer useful.

Try replacing:

Code: [Select]
actor = $game_actors[@parameters[1]]

with

Code: [Select]
when 4  # Actor

So the code should look like this:

Code: [Select]
    when 3  # Item
      value = $game_party.item_number($data_items[@params[4]])
    when 4  # Actor
      actor = $game_actors[@params[4]]
      if actor != nil
        case @params[5]
        when 0  # Level
          value = actor.level
        when 1  # Experience
          value = actor.exp
        when 2  # HP
          value = actor.hp
        when 3  # MP
          value = actor.mp
        when 4  # Maximum HP
          value = actor.maxhp
        when 5  # Maximum MP
          value = actor.maxmp
        when 6  # Attack
          value = actor.atk
        when 7  # Defense
          value = actor.def
        when 8  # Spirit
          value = actor.spi
        when 9  # Agility
          value = actor.agi
        end
      end
    when 5  # Enemy

that is, I'm assuming you have the official english version where this was the case:

Code: [Select]
    when 3
      value = $game_party.item_number($data_items[@params[4]])
      actor = $game_actors[@parameters[1]]
      actor = $game_actors[@params[4]]

If I didn't constantly make errors just like this I'd criticize enterbrain right now. :P
Title: Re: Variable as character level does not work?
Post by: maia on March 13, 2008, 02:45:40 PM
It works!

I notice that they didn't even have a when 4.

This will be helpful to a lot of event gurus :-)

Thanks so much!
Title: Re: Variable as character level does not work?
Post by: modern algebra on March 13, 2008, 03:53:42 PM
Since I assume this is an error present in all of the English versions of VX, do you mind if I sticky this topic? Maybe we can make it like an FAQ or something. Eventually, enterbrain will probably release a fix, but until then this topic could be useful to a lot of people. Anyway, as you are the owner, do you mind if I sticky this?

It seems like something that everybody will need fixed.
Title: Re: Variable as character level does not work?
Post by: maia on March 13, 2008, 11:44:09 PM
Sure sticky it. After all you made the solution :-)
Title: Re: [RESOLVED] Variable as character level does not work?
Post by: Leventhan on March 15, 2008, 04:50:05 AM
Wow, this is quite a surprise.
MA you should ask enterbrain cash for finding the error.
Or the official english version for free at least. ^_^
Title: Re: [RESOLVED] Variable as character level does not work?
Post by: modern algebra on March 15, 2008, 06:00:57 AM
maia found the error, not me. And I think I'd need to do something a little more impressive than fixing a minor oversight in the scripts that are open anyway.
Title: Re: [RESOLVED] Variable as character level does not work?
Post by: maia on March 16, 2008, 03:05:25 PM
I bought a GPS in December... Their instruction manuel was printed backward and upside down. The book opened right to left instead of left to right, then when you read it, everything was out of order. Some pages were upside down. It went 1, 5, 2, 6, 3, something.

The company said they'd send me a new book.... never saw it and its now March.

In February the GPS screws broke and I could open the GPS like a book. Sometimes the little things are an indication of the product.
Title: Re: [RESOLVED] Variable as character level does not work?
Post by: Leventhan on March 17, 2008, 07:22:52 AM
uh wow
That's kinda deep?
Title: Re: [RESOLVED] Variable as character level does not work?
Post by: firebynight on March 25, 2010, 08:29:24 PM
i dont see any difference
Title: Re: [RESOLVED] Variable as character level does not work?
Post by: Strak on June 20, 2011, 08:00:48 PM
The *. It's *=, not =. Ever notice the multiply feature not working?

EDIT: Holy mother of necroposting. Sorry.