Chaos Project

RPG Maker => General Discussion => Topic started by: Trainer Zydragon on March 07, 2010, 09:35:24 am

Title: Character Position variable?
Post by: Trainer Zydragon on March 07, 2010, 09:35:24 am
Which section of script in which script edits, changes or defines character position? Or how would I go about defining it within a script?

I'm looking for this particular section of script for an options edit, yaknow so I can change char position like FF7 style.

Thanks for any help :)
Title: Re: Character Position variable?
Post by: lilbrudder917 on March 07, 2010, 11:58:29 am
So, basically you're asking how to move a player with a script call?

That would be this:
$game_map.setup(MAP ID)
$game_player.moveto(X, Y)
Title: Re: Character Position variable?
Post by: Trainer Zydragon on March 07, 2010, 12:01:56 pm
No no no, player positions in battle :P
Sorry if I didnt make that clear lol

Basically I want to make an option which changes their position if you want to, like forward middle and behind.

If you look at one of the battle scripts, theres a part that mentions a roulette depending on the players position in battle, which shows the chances of monsters attacking and stuff. So I want people effectively able to choose which characters they want to put further into the battle or further back (archers and such).
Title: Re: Character Position variable?
Post by: lilbrudder917 on March 07, 2010, 12:30:30 pm
Oh, this thing?
Spoiler: ShowHide
(http://i45.tinypic.com/bgxp4g.png)


Yeah, I just searched and found what you said, this:
Spoiler: ShowHide
  def random_target_actor(hp0 = false)
   # Initialize roulette
   roulette = []
   # Loop
   for actor in @actors
     # If it fits the conditions
     if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
       # Get actor class [position]
       position = $data_classes[actor.class_id].position
       # Front guard: n = 4; Mid guard: n = 3; Rear guard: n = 2
       n = 4 - position
       # Add actor to roulette n times
       n.times do
         roulette.push(actor)
       end
     end
   end
   # If roulette size is 0
   if roulette.size == 0
     return nil
   end
   # Spin the roulette, choose an actor
   return roulette[rand(roulette.size)]
 end


I'm not sure, but you could probably do this:

Spoiler: ShowHide
class Game_System
 attr_accessor :Position

 alias position initialize
 def initialize
   @Position  = 1
   position
 end
end


and then rewrite the random_target_actor from before, and change this line:
position = $data_classes[actor.class_id].position

to:
position = $game_system.position

Of course, using this would require you do this for each actor...

Otherwise, you could make it change the players class instead?

EDIT: Sorry, I'm not the best at Battle Systems.  :(
Title: Re: Character Position variable?
Post by: Trainer Zydragon on March 07, 2010, 12:50:34 pm
Lol I dunno if I'll be installing it into a battle system, but I'll defo be adding it to a CMS along with several other edits :)
Thanks for the help tho, I'll chuck you a level for that one lol
Title: Re: Character Position variable?
Post by: Fantasist on March 16, 2010, 06:12:55 am
Click here (http://forum.chaos-project.com/index.php/topic,5845.msg100981.html#msg100981) :)