Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Bob423

naming multiple actors at the same time?

Question

ok, i was wondering, i there was a way, scripting or otherwise, to do this...

 

when 1 actor is named, it takes that name, and gives it to 3 other actors, so different classes can have different stats

 

thanks

Share this post


Link to post
Share on other sites

14 answers to this question

Recommended Posts

  • 0

Yup. After the name input, use a script command and paste:

 

$game_party.actors[1].name = $game_party.actors[0].name

 

You'll need to change the first number in brackets for subsequent numbers referring to other actors in the party.

 

Actor 0 is the first actor, actor 1 is the second actor, and so on. Make sense?

Share this post


Link to post
Share on other sites
  • 0

Better to use:

 

$game_actor[ACTOR_ID].name

than

$game_party.actors[iNDEX].name

 

The actors and their IDs are static while the order of the party is not. Aside from that, using this way will allow you to set the names of actors that are not currently in the party.

Share this post


Link to post
Share on other sites
  • 0

so what im getting is this

 

if actor 1 is named, and actors 2-4 are going to have the same name, i do this

 

(actor naming thing)

$game_actor[0].name = $game_actor[1].name

$game_actor[0].name = $game_actor[2].name

$game_actor[0].name = $game_actor[3].name

 

hope thats right, thanks guys :biggrin_002:

 

 

edit: ok this is weird, i got an error saying:

 

undefined method "[]" for nil:NilClass

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

I'm sorry, its "$game_actors", with an "s" :P

 

Remember, when using the $game_actors way, you reference them by their ID in the database, not the index in the party. So the first actor is $game_actors[1]. This means that you can change them without being the party.

 

You seem to have it backwards there:

 

(actor naming)(say the first actor in the database is the one being set...)

$game_actors[2].name = $game_actors[1].name

$game_actors[3].name = $game_actors[1].name

$game_actors[4].name = $game_actors[1].name

Share this post


Link to post
Share on other sites
  • 0

oh, ok thanks :biggrin_002:

 

edit: um... is there a way to make it so each line fits on 1 line? i seem to be having a problem with it sneaking in a line break, and making a no method error. i know what it is, because ive had this problem before, but cant seem to fix it.

 

maybe i could create a scene in script editor and call that?

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

Yeah just put it in a function block and put that in a class block, then call the function when you want the names changed.

 

Actually I think RGSS calls functions methods, but I refuse to do so.

Share this post


Link to post
Share on other sites
  • 0

ok how do i do that? i have this, but i know it wont work (i tried it lol)

 

class Scene_Actornames < Game_Actors

 $game_actors[2].name = $game_actors[1].name
 $game_actors[3].name = $game_actors[1].name
 $game_actors[4].name = $game_actors[1].name

 $game_actors[6].name = $game_actors[5].name
 $game_actors[7].name = $game_actors[5].name
 $game_actors[8].name = $game_actors[5].name

 $game_actors[10].name = $game_actors[9].name
 $game_actors[11].name = $game_actors[9].name
 $game_actors[12].name = $game_actors[9].name
end

Share this post


Link to post
Share on other sites
  • 0

First of all, you didn't define a function. You need to do that. There is not scene involved or parenting.

Share this post


Link to post
Share on other sites
  • 0

what kiri said. In fact, I wouldn't even bother putting it in a class:

 

put this in a script above main, or even in the main script before all other code:

def name_actors
 $game_actors[2].name = $game_actors[1].name
 $game_actors[3].name = $game_actors[1].name
 $game_actors[4].name = $game_actors[1].name
 # Etc
end

 

then just call a script in an event:

name_actors

Share this post


Link to post
Share on other sites
  • 0

Just define it right in the Interpreter class and you won't need to make your own class. All script calls are processed there anyways.

Or you could just shorten the variable names in a script call:

 

g = $game_actors
name = g[1].name
g[2].name = name
g[3].name = name
g[4].name = name

 

Stuff like that works fine. You can also just break the lines after the '=', like this:

 

$game_actors[2].name = 
$game_actors[1].name
$game_actors[3].name = 
$game_actors[1].name
$game_actors[4].name = 
$game_actors[1].name

Edited by ForeverZer0

Share this post


Link to post
Share on other sites
  • 0

First of all, you didn't define a function. You need to do that. There is not scene involved or parenting.

first of all, i knew that, and wanted to know what to do next (guess i forgot to mention that :sweatdrop: 0

 

and thanks kell :biggrin_002:

Share this post


Link to post
Share on other sites
  • 0

Wow...there's so many ways of doing this.

Is this also possible in VX? This same code? Just curious.

Share this post


Link to post
Share on other sites
  • 0

Wow...there's so many ways of doing this.

Is this also possible in VX? This same code? Just curious.

 

lol, there are actually probably TONS more ways of doing this... One of the things I love about programming- one problem can have thousands of solutions. It's like a puzzle with no definite finish.

 

And this should work for VX as well.. I am 99.9% sure the $game_actors object is the same between xp + vx, so it will work.

Share this post


Link to post
Share on other sites
  • 0

lol, there are actually probably TONS more ways of doing this...

 

This is especially true in Ruby. Some other languages you can be a bit more confined in your methods, but Ruby is about as dynamic as it gets, which makes it so popular as a first "learning-to-program" language. You can learn a lot of universal programming techniques that you can then apply to more powerful languages after you discern the different syntax between the two.

 

Ruby was my first language, and I'll always have a little spot in my heart just for it, even though I rarely use it anymore. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...