Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Multiple auto-states on weapons and armors

Save-Point

Full Version: Multiple auto-states on weapons and armors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey everyone.

I'm looking for a simple way to add multiple auto-states on weapons and armors.
Example: A cursed Sword which gives a permanent barrier but also a poison state on the wielder.

Right now I'm doing it like this in Scene_Battle

Content Hidden

I know that's very rough but its works so far.
But I'm 100% sure there are better scripts for this, I just can't find any.  
I will only tell you that an iterator would make it simple and short, look for information regarding how to use iterators in Ruby.
I'm honest and I have no clue how to use that right to make my code short and simple.
Okay now I got this:

Content Hidden

I think this is way better than before.
But not nearly "good".
The array "actors" is not necessary. $game_party.actors is already an array.

Code:
$game_party.actors.each do |actor|
   if actor.weapon_id == 21
      actor.add_state(60)
      actor.add_state(61)
   end
end
Noting your original post. I will make the following suggestion.

Set your weapon states to constants.

Example

Code:
CURSED = [60,61]
ANCIENT = [59]
HOLY = [18]

This way you can assign them easier with little limit to the number.

Code:
if actor.weapon_id == ??? #(whatever weapon)
  for state_id in CURSED
    actor.add_state(state)
  end
end
Thank you.

I will add this to the code.