Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - nazra7

1
Thank you so much! IT works perfectly! Would it also be possible to change the enemy's battler graphic, skills, auto states from armor, and Elemental/State efficiency/weaknesses to equal that of the actor's as well? And if not all of these, just as many as possible?
2
I just tried this new script out and it seems to work the same as the last version of it but for some reason its not changing the attack animation of the enemy. No errors or anything either, its just not changing.
3
Yes! That worked! And I also had to call the script during a battle, not before one. Thank you so much!!! :D :haha: I have another question I hope you could help me with if its not too much trouble. Along with the actor's stats, I'd also like to set the enemy's normal attack animation to the same animation as the actor's weapon attack animation. I tried adding this to the script:

  #--------------------------------------------------------------------------
  # * Get Offensive Animation ID for Normal Attack
  #--------------------------------------------------------------------------
  def animation1_id
    return @animation1_id || $data_enemies[@enemy_id].animation1_id
  end
  #--------------------------------------------------------------------------
  # * Get Target Animation ID for Normal Attack
  #--------------------------------------------------------------------------
  def animation2_id
    return @animation2_id || $data_enemies[@enemy_id].animation2_id
  end


But that didn't seem to do anything at all. I think its because the actor's attack animation is stored in a variable with a different name, unlike the names of the stat variables because when I search for actor.animation1_id or actor.animation2_id I get no result. There's only actor.animation_id which I think is the id of the animation that plays on the actor when its a target of a skill as I've learned from fiddling around with it. So, if you know know how I could make it to where the enemy's attack animation is set to the actor's attack animation/weapon animation, if you could show me how I would greatly appreciate it so much!
4
Hello again KK20, I just tried to test this script, and when I tried to call this script with an event:

e = $game_troop.enemies
$game_troop.setup(4)
e[1].set_actor_stats(41)


I got this error: No Method error occurred while running script. Undefined method 'set_actor_stats' for nil:NilClass. I don't know why its giving me this error since the script you gave me clearly defines set_actor_stats. I've tried placing it in multiple places around my custom scripts above the main script and below the default scripts, and I've tried rewriting the Game_Enemy script to include this code instead of using a new script to rewrite it to no avail. If you can find out what's going on here, please let me know how to fix this. I can't thank you enough for all the help you've given me so far!  :haha:
5
Ah, thank you SO much! I didn't know what part of that line of code could be stored in a variable. I'm going to try it out here pretty soon and I'll get back with you if there's anymore issues.
6
That explains it perfectly! Thanks so much and again really sorry for the late reply. I  really want to try this but there's just one more problem. I can't figure out how to call this line of code using the script command for events: $game_troop.enemies[0].set_actor_stats(5) because its too long to fit inside the tiny box, half of it is put on the second line like this:

$game_troop.enemies
[0].set_actor_stats(5)




and this will of course cause a crash error. I know you can store certain codes in variables to shorten the code length to fit inside this tiny script box, but I don't know if that can be one with this specific line of code. Could you tell me how to get this code to fit inside the tiny event script box? Or how I can use the game's script editor to set up battles with specified enemies in specified troops to have the same stats as a specified actor? Please let me know, and thanks very much again in advance! I really appreciate all the help you've given me so far :D
7
Hey, sorry for the late reply, and thanks again for your reply. My battle system does use the default troops in the RMXP database. I understand what the value actor_ID represents, I'm just having a hard time understanding how to use this method you're suggesting to change a specific enemy's stats to equal that of a specific actor's stats. So far, this is what I understand:

1. Place this script above the "Main" script and below the default scripts:

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Sets the base stats of the enemy to that of an Actor
  #--------------------------------------------------------------------------
  def set_actor_stats(actor_id)
    actor = $game_actors[actor_id]
    @hp = @maxhp = actor.maxhp
    @sp = @maxsp = actor.maxsp
    @str = actor.str
    @dex = actor.dex
    @int = actor.int
    @atk = actor.atk
    @pdef = actor.pdef
    @mdef = actor.mdef
    @eva = actor.eva
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  def base_maxhp
    return @maxhp || $data_enemies[@enemy_id].maxhp
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum SP
  #--------------------------------------------------------------------------
  def base_maxsp
    return @maxsp || $data_enemies[@enemy_id].maxsp
  end
  #--------------------------------------------------------------------------
  # * Get Basic Strength
  #--------------------------------------------------------------------------
  def base_str
    return @str || $data_enemies[@enemy_id].str
  end
  #--------------------------------------------------------------------------
  # * Get Basic Dexterity
  #--------------------------------------------------------------------------
  def base_dex
    return @dex || $data_enemies[@enemy_id].dex
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  def base_agi
    return @agi || $data_enemies[@enemy_id].agi
  end
  #--------------------------------------------------------------------------
  # * Get Basic Intelligence
  #--------------------------------------------------------------------------
  def base_int
    return @int || $data_enemies[@enemy_id].int
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack Power
  #--------------------------------------------------------------------------
  def base_atk
    return @atk || $data_enemies[@enemy_id].atk
  end
  #--------------------------------------------------------------------------
  # * Get Basic Physical Defense
  #--------------------------------------------------------------------------
  def base_pdef
    return @pdef || $data_enemies[@enemy_id].pdef
  end
  #--------------------------------------------------------------------------
  # * Get Basic Magic Defense
  #--------------------------------------------------------------------------
  def base_mdef
    return @mdef || $data_enemies[@enemy_id].mdef
  end
  #--------------------------------------------------------------------------
  # * Get Basic Evasion
  #--------------------------------------------------------------------------
  def base_eva
    return @eva || $data_enemies[@enemy_id].eva
  end
 
end


2. Use this command: e.set_actor_stats(5)

But this is where I am lost. What does the command "e.set_actor_stats(5)" do exactly? Does it change a single enemy's stats to equal the stats of actor number 5? If so, which enemy's stat is it changing? Or does it instead change the stats of every enemy in the entire current troop of enemies? After reading your last post, it does indeed sound like the above script only changes the stats of every enemy in the troop to equal the stats of actor 5 rather than changing just a single and specific enemy's stats. If that's true, then how do I change just one specific enemy's stats instead of the entire troop? Please let me know as soon as possible. And thanks again!
8
Thanks very much for the reply! But I'm kind of confused as to how to use this script you suggested here. For example:

1. For the class Game_Enemy script, for these two lines of code:

  def set_actor_stats(actor_id)
    actor = $game_actors[actor_id]

  Do I replace "actor_id" with the id number of  the actor I want to use? So if I'm wanting to change Enemy 3's stats to that of Actor 5's stats, do I put "5" in place of "actor_id" on those two lines of code?
  Also, where/how do I specify which enemy (in this case enemy 3) I want to change its stats to that of Actor 5?

And...

2. When using "e.set_actor_stats(5)", is "5" the actor ID I want to use to change to base the enemy's stats on? And if so, how do I specify which enemy exactly will have Actor 5's stats?

Please let me know as soon as you can. Thanks very much!
9
Hello everyone, I am making a commercial Tactical RPG similar to Final Fantasy Tactics with RPG Maker XP and I would like some help creating a script which takes the values of a specified Actor's stats, after adding stats from equipment, and applies the same values of stats to a specified Enemy's stats using the Event Script Command. This way, I can simulate Enemys having levels and wearing equipment. For example, using the event's script command to convert Actor #5's stats to the stats of Enemy #10 in the Database, I think it would look something like this:

enemy[10].maxhp = actor[5].maxhp
enemy[10].maxsp = actor[5].maxsp
enemy[10].hp = actor[5].sp
enemy[10].sp = actor[5].sp
enemy[10].str = actor[5].str
enemy[10].dex = actor[5].dex
enemy[10].agi = actor[5].agi
enemy[10].int = actor[5].int
enemy[10].atk = actor[5].atk
enemy[10].pdef = actor[5].pdef
enemy[10].mdef = actor[5].mdef
enemy[10].eva = actor[5].eva

But I know that's not going to work because it doesn't use the correct script codes. However, I'm hoping it will be about as simple in structure. I just need to know what the right script codes are for this... Does anyone here, who's much better at scripting, know what script codes I need to use in order to pull this off? Please let me know, I'd GREATLY appreciate it! And thanks a ton in advance!
10
Thanks very much. It's all working properly now. :haha: I'm learning ruby little by little. I'm more used to C++ but this is totally different.
11
Sorry for the late reply, and thanks very much! That was very helpful. It took a little bit but I've got it working. I only have one problem now. I want to set all of the battlers' temp stats back to zero when a battle ends. I'm using a tactics based custom battle script. So I used this to try to set temp stats back to zero:

   #(I tried using just "actors + enemies" and "$game_system.actors + $game_system.enemies" instead, but both produced errors. Neutrals are a new battler type made by the custom battle system)

    for battler in $game_system.tactics_actors + $game_system.tactics_neutral + $game_system.tactics_enemies
    @tempmaxhp = 0
    @tempmaxsp = 0
    @tempstr = 0
    @tempdex = 0
    @tempagi = 0
    @tempint = 0
    end


And it works when I put in the Game_Battler 3 script with the rest of my custom states, but it won't work when I put it where the script ends the battle in the battle scene script. In the battle system I'm using, it replaces the "def battle_end(result)" in the default scene_battle scripts with "def end_battle(result=0)" in its own battle scene script. I tried putting the above code in there and it doesn't work for some reason. It doesn't produce an error, but when the battle ends, the temporary stat bonuses don't get set back to zero, they just stay the same. I tried making it produce an error just to see if that part of the script is even being used, and it successfully produced that error, so I don't know why it's not working. Here is what it looks like right now:

  #----------------------------------------------------------------------------
  # Exit Battle
  # result: 0-win, 1-lose, 2-escape
  #----------------------------------------------------------------------------
  def end_battle(result=0)
    RPG::BGM.fade(400)
    @battle_exiting = true
    @cursor_active = false
    @tbs_phase = 8
    for window in @windows.values
      unless window == nil
        window.visible = false
        window.active = false
      end
    end
    @result_phase = 0
    if result == 1 and $game_troop.can_lose? == true
      update_scene
    else
      for battler in actors + neutral + enemies
        battler.clear_tbs_actions(true)
      end
      $game_party.remove_states_battle
     
    for battler in $game_system.tactics_actors + $game_system.tactics_neutral + $game_system.tactics_enemies
    @tempmaxhp = 0 #(tried making this = gibberish to make sure it produces an error correctly, and it does)
    @tempmaxsp = 0
    @tempstr = 0
    @tempdex = 0
    @tempagi = 0
    @tempint = 0
    end
     
    end   
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
  end
 


If you could let me know what I'm doing wrong, I'd greatly appreciate it!
12
Hello everyone, I am currently working on a commercial strategy rpg using RPG Maker XP that will be similar to Final Fantasy Tactics. In FFT, there are stats that give temporary stat boosts when you take damage called Speed Save, PA Save, ect. I'm trying to make a state like this where, for example, the state will raise the battler's agility stat by 25% of the damage caused each time it takes damage while afflicted with this state. I am able to script this state, but I only know how to add PERMANENT stat increases rather than TEMPORARY stat increases. In Game_Battler 3 script, I'm adding this code which works, but again, it only gives a permanent stat increase instead of a temporary stat increase:

#if Agility Save State
if self.state?(214) #< Agility Save State ID (I know, my game has a TON of states)
self.animation_id = 635 #< Temporary Agility Gain Animation
self.agi += self.damage / 4 #< Permanently increases agility by 25% of the damage caused, need it to be a temporary increase instead
end


I think I can do this, and please correct me if I'm wrong, if I can make a new local variable for each battler, both actors and enemies, that stores a temporary stay gain, something like this:

#if Agility Save State
if self.state?(214) #< Agility Save State ID (I know, my game has a TON of states)
self.animation_id = 635
self.tempagi += self.damage / 4 #< self.tempagi is the new local variable which stores temporary agility gains/losses
self.agi += self.tempagiplus #< temporary stat increase
else
self.agi -= self.tempagiplus #< I know this won't work properly here since it will only trigger when skills are used and deal damage, but I'm putting this here just to make sure this code will correctly remove the temporary stat gain/losss
end


But when I use code I get a undefined method error for the variable tempagi. How do I make this variable a local variable that can be used in the code self.tempagi? Or if there is a better way to make a temporary stat gain like this, please let me know.

Any advice will be greatly appreciated! Thanks in advance.