RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] [RESOLVED] Variable as character level does not work?

0 Members and 2 Guests are viewing this topic.

****
Rep:
Level 90
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.
« Last Edit: January 03, 2012, 01:41:23 AM by modern algebra »
community project for RPG Maker VX: http://rmrk.net/index.php/topic,33789.0.html

********
Furry Philosopher
Rep:
Level 94
Rawr?
2013 Best RPG Maker User (Creativity)Gold - GIAW 11 (Hard)Randomizer - GIAW 11Secret Santa 2013 ParticipantFor frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Mapping)2012 Best RPG Maker User (Programming)Secret Santa 2012 ParticipantGold - GIAW 9Project of the Month winner for September 2008For taking a crack at the RMRK Wiki2011 Best RPG Maker User (Programming)2011 Best Veteran2011 Kindest Member2010 Best RPG Maker User (Story)2010 Best RPG Maker User (Technical)
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




**
Rep:
Level 86
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, the problem isn't happening between a brand new project and an old project that I have been running with his updated script.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
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
« Last Edit: March 13, 2008, 12:15:48 AM by modern algebra »

****
Rep:
Level 90
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!
community project for RPG Maker VX: http://rmrk.net/index.php/topic,33789.0.html

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
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.

****
Rep:
Level 90
Sure sticky it. After all you made the solution :-)
community project for RPG Maker VX: http://rmrk.net/index.php/topic,33789.0.html

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
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. ^_^
Be kind, everyone you meet is fighting a hard battle.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
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.

****
Rep:
Level 90
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.
community project for RPG Maker VX: http://rmrk.net/index.php/topic,33789.0.html

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
uh wow
That's kinda deep?
Be kind, everyone you meet is fighting a hard battle.

**
Rep: +0/-0Level 81
i dont see any difference

****
I saw a squirrel...
Rep:
Level 82
...it got in my way.
The *. It's *=, not =. Ever notice the multiply feature not working?

EDIT: Holy mother of necroposting. Sorry.

Gods ain't gonna help ya son...