Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Can I edit $data_actor[@actor_id].parameters?

Dko

Member

I was wondering if its possible to expand the functionality of this? Because I want to store another set of variables by using $data_actor[@actor_id].parameters[6, @level] which I currently can't do. It seams like this code hidden by RPG maker xp so I can't find it in the basic scripts. But I could be wrong
 

Dko

Member

Well I just want it to hold my base_stat that ive put in. Like how it works normally for Str, Int, ect.

hemm maybe this is more about how I can write the changes I want in a separate script page? If so I can't seam to figure out where the subject is in most ruby/rgss tutorials. >.o
 

Dko

Member

Im making the changes so I can do things with $game_actor in a more logical way. Ive added a stat called stamina. I want to be able to use $data_actor[@actor_id].parameters[6, @level] to determine what a actors stamina is at a given level. Ive already began adjusting the debug menus to edit the values

EDIT: ok with the suggestion by Yeyinde I've figured it out. I basically cut and pasted the section from the help file and made a few edits to accommodate the new stat like thus. Im not sure if the for loop is totally necessary but it works fine. But yeah its read only. I assign a value to it and nothing happens. I need to find a way around it being read only. Other wise my extra stat just won't work.
Code:
@parameters = Table.new(7,100)  # 7 instead of 6 in the help file
      for i in 1..99
        @parameters[0,i] = 500+i*50
        @parameters[1,i] = 500+i*50
        @parameters[2,i] = 50+i*5
        @parameters[3,i] = 50+i*5
        @parameters[4,i] = 50+i*5
        @parameters[5,i] = 50+i*5
        @parameters[6,i] = 50+i*5   #Stamina
      end
 
But you don't need to.

If you are using it to add properties, you would relize that adding to that table will actually make other scripts decrease in compatablity. As well as just doing un-needed work.

Modifing the Data Structure classes is doable, but modifing the initialize method is not.

Here's what happens:

Yes click save. It goes through everything in your database. Depending on your settings, creates a dumps objects into the .rxdata files.

So modifing the initialize method does nothing, because the objects are created elsewhere (and I memory serves me right, its actually in C or C+).

You could modify that table to have another value, but would require to create a dummy table, reading the table and recording values in the dummy table, adding your new values in the dummy table then replacing the real table with the dummy table. Way too much work.
 
Resolved in the IRC

[01:20:09] <@Trickster> in module RPG class Actor
[01:20:24] <@Trickster> create a new method setup_extra_stats
[01:20:40] <@Trickster> in this method resize @parameters
[01:21:13] <@Trickster> run through levels 1 to 99 using a loop, and use a formula to set the stat for each level
[01:21:31] <@Trickster> setting @parameters[<x>, level] to the value returned
[01:21:39] <@Trickster> <x> is just the index
[01:21:56] <@Trickster> now In Scene_Title
[01:22:41] <@Trickster> alias the main method calling the old method first
[01:23:15] <@Trickster> and then run through $data_actors using a loop and call method setup_extra_slots for that RPG::Actor Object
[01:23:19] <@Trickster> and that's it
[01:23:35] <Dko> ok I think that will help a lot thanks
[01:24:10] <@Trickster> anytime :)
[01:24:48] <@Trickster> if you need an example (well almost) of what I just said take a look at my Stats that Level Up Script

extra note you must create methods in Game_Actor to read the new value from <rpg::actor>.parameters see the methods base_(stat) to see how its done
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top