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.
Game_Actors...[RESOLVED]

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
 Alright...So, in my game, Actors are more like recruits fully determined by their class. Actor_ID plays no bearing whatsoever and I've discluded it from the Actor setup method arguments for easy recruiting and removing. Also, it has no meaning because I do not need the actor data at all, for all my data is determined internally by their class/level being the only input vairables.

 Looking at Game_Actors, it basically says nothing but "Actor_ID" all over the place. So the big problem is,

1) Should I re-include actor_id among my arguments?
2) If not, how do I fix Game_Actors to fit my setup?
3) Just what does this class do? 0_0


« Last Edit: January 04, 2009, 11:19:19 PM by da good king »

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
umm yeah, you should leave the actor_id in there. o_o

Game_Actor is used to keep track of certain Actor stats, and the rest of the system knows what stats to interpret, based on which actor id is given as a parameter.
without that, battles won't work, menus won't work, etc...

read the RMXP help file, it'll do you a load of good.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 87
Oh, I've read it over alot ;), but all the same, I can see that I should keep it. It was just a matter of finding the proper expression for adding a "new" actor. Since I'm adding and removing them all the time, it would be ridiculous to have to remember every single one's ID, So I spose for adding a "new" Actor_ID, I'll use a parameter of $game_actors.size + 1 to ensure that it uses a new ID. Hmmm....thx :)

The line of code that's really getting me is this:
Code: [Select]
if @data[actor_id] == nil
    @data[actor_id] = Game_Actor.new(actor_id)
end
It says that if that ID does not exist, make a new actor with that ID, but what should I do about my other 2 parameters??? (Class, Level)

Oh, and one more ?...because I CANNOT figure out why this isn't working..When I try to refer to my class it says it's nil. It seems it stops working just because I change its name....i.e. I change Game_Party to Game_Stuff, and refer to it using $game_stuff rather than $game_party and it stops working o_0???
(I swear I could do this before and now it just won't work -_-)

I can also see $game_actor doesnt work unless you use $game_actors, so exactly how does refering work? ... (I feel rly noob asking this ? >.<)
« Last Edit: January 03, 2009, 07:40:02 PM by da good king »

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
actors are stored in the database, and you can change their class and level with events.
why cant' you just make all the 'recruits' in the database, and have things work from there?

your questions are also kinda confusing, I can't get a grasp as to what you're trying to do.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 87
I am speaking a bit cryptic >.<. Well, I'm going to be adding and removing recruits alot, so I want the method to include class and level as arguments which actually has provided no problems. (resolved i.e.) The only concern I have now is that I cannot refer to my custom class: Game_Commander. This class handles some data for your commander, such as rank, battles fought, won, and lost.

When I try to refer to this data using $game_commander it does not work...It returns NilClass...

Spoiler for "Game_Commander":
Code: [Select]
#==============================================================================
# ** Game_Commander
#------------------------------------------------------------------------------
#  This class handles the commander
#==============================================================================

class Game_Commander
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :name                     # Trainer's Name
  attr_reader   :id                       # Trainer ID
  attr_reader   :prof                     # Profession / Occupation
  attr_reader   :level                    # Trainer Level
  attr_reader   :exp                      # Exp
  attr_reader   :rank                     # Trainer Rank
  attr_reader   :offense_rank             # Offensive Strategum
  attr_reader   :defense_rank             # Defensive Strategum
  attr_reader   :speed_rank               # Speed Strategum
  attr_reader   :offense_score            # Offensive Score (1000 to rank 10)
  attr_reader   :defense_score            # Defensive Score (1000 to rank 10)
  attr_reader   :speed_score              # Speed Score (1000 to rank 10)
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @name = "Default"
    @id = rand(9) * 10000 + rand(9) * 1000 + rand(9) * 100 + rand(9) * 100 + rand(9) * 10 + rand(9)
    @level = 1
    @prof = "Nerd"
    @exp_list =
    @exp =
    @battles = 0
    @wins = 0
    @losses = 0
    @draws = 0
    @rank = 0
    @offense_score = 0
    @defense_score = 0
    @speed_score = 0
    @offense_rank = (@offense_score / 100.000).floor
    @defense_rank = (@defense_score / 100.000).floor
    @speed_rank = (@speed_score / 100.000).floor
  end
end

How would I refer to the variables in this class? :S
« Last Edit: January 03, 2009, 09:02:41 PM by da good king »

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
you need to make a $Game_Commander object if I'm not mistaken...

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 87
0_0 !!!!!  :tpg:

Seeing that there is NO coding in all of the scripts that specifically creates the objects $game_party, $game_actors, or the like, I suppose that's what's been getting me confused...I guess those objects are preset into the game.  :-\

My bad >.< zzzzzzzzzzzz and thx for all the help.

EDIT: Alright...there in lies my final ?: When you refer to data, it's commonly separated by ".", what type of object is this and how do I add data to it or create it in the first place? and

How do you refer to an instance variable within a class.........
« Last Edit: January 04, 2009, 02:06:45 AM by da good king »

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
EDIT: Alright...there in lies my final ?: When you refer to data, it's commonly separated by ".", what type of object is this and how do I add data to it or create it in the first place? and

How do you refer to an instance variable within a class.........

ok, "." is just a separator, it's used to tell the interpreter what part of the object to call

Code: [Select]
Object.member

where member could be an attr_reader, attr_accessor, or a method.

attr_reader creates a variable that can be accessed through the class/object to show a value
attr_accessor works like attr_reader, but you can directly modify it when you call it.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 87
hmmmm i c.. but I have already created my reader attributes, so why can't I access them yet? :S You said I needed to make it a $Game_Commander object, how?

*
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 Most Mature Member2010 Favourite Staff Member
Seeing that there is NO coding in all of the scripts that specifically creates the objects $game_party, $game_actors, or the like, I suppose that's what's been getting me confused...I guess those objects are preset into the game.  :-\

NAMs doing a great job helping, so I'll leave you alone. I did want to point out, however, that those $game variables are indeed created in a visible script - in Scene_Title under the method: command_new_game

To add a new one, you will need to do quite a few things - you will need to make it in command_new_game of Scene_Title, and you will also need to go into Scene_Load and Scene_Save and edit read_save_data and write_save_data, respectively. An easier way might be to add it to an already existing globally saved class, such as $game_actors or $game_party or whichever one would make the most sense. To do that, all you would need to do is add commander as a public instance variable to the class, so, if you were to add something like this in a new slot before main and after Game_Actors in the script editor:

Code: [Select]
class Game_Actors
  attr_reader :commander
  alias dagdkng_cmmndr_recruit_init_943 initialize
  def initialize
    # Run original method
    dagdkng_cmmndr_recruit_init_943
    @commander = Game_Commander.new
  end
end

then you could access your commander object by the code:

$game_actors.commander

Like I said though, that might not be where it makes the most sense to add the new class.

But yeah, I get confused all the time when I'm typing, so that probably did not make sense to you. I'll turn the floor back over to NAM

***
Rep:
Level 87
Well, the both of you ARE doing an excellent job of explaining this, and I do finally understand it now, however much a new found hassle it is. I figured these were presaved into the game but I had hoped they wouldnt be so annoying to add.

I think....I will use your idea. Since the commander is head of the "party", I'll make a stretch here and add his data to $game_party. Or, who knows, maybe I'll take the long route and create my own data. After all, I can't actually go forward with my project until I fix my laptop, so I'm really just practicing code for now.

Thanks again NAM and Algebra. [resolved :)]
« Last Edit: January 04, 2009, 11:19:56 PM by da good king »