Actor's level reset to 1 by condition (DIFFICULT SCRIPT PROBLEM)

● ARCHIVED · READ-ONLY
Started by nickfitzgerald3 8 posts View original ↗
  1. So ok I have kind of a mess on my hands this time, I have this script, What it does is when a specified Item is added or removed an actor is removed or added as well, what I need done is that when an actor is removed, his Level is set back to 1, BUT here is the curve ball, I am using TDS Stat Distibution, http://rpgmaker.net/scripts/225/ I also need all the gained and spent PARAM points to be removed or set back to default, This is really a hurdle but I could use help so bad! please I would appreciate it so much



    module EE

      module ActorAsItem

        #---------------------------------------------------------------------------

        ACTORS = [ # Dont edit this line

        #--------------------------------------------------------------------------- 

              #---------------------------------------------------------------------

              # [item_type, item_id, actor_id],

              #   item_type: :item, :weapon, or :armor

              #---------------------------------------------------------------------

              [:item, 24, 8],

              [:item, 23, 7],

              [:item, 18, 1],

              [:item, 19, 3],

              [:item, 20, 4],

              [:item, 21, 5],

              [:item, 31, 9],

              [:item, 32, 11],

              [:item, 33, 10],

              [:item, 34, 13],

              [:item, 35, 12],

              [:item, 39, 14],

              

        #---------------------------------------------------------------------------

        ] # Dont edit this line

        #---------------------------------------------------------------------------

        def self.items

          return ACTORS.select{ |arr| arr.first == :item}      

        end

         

        def self.weapons

          return ACTORS.select{ |arr| arr.first == :weapon}     

        end

        

        def self.armors

          return ACTORS.select{ |arr| arr.first == :armor}     

        end

        

        def self.get_items(item_class)

          return items   if item_class == RPG::Item

          return weapons if item_class == RPG::Weapon

          return armors  if item_class == RPG::Armor

          return []

        end

        

        def self.get_actor_id(item_class, item_id)

          get_items(item_class).each do |arr|

            return arr[2] if arr[1] == item_id

          end

          return nil

        end

      end

    end

     

    class Game_Party

      alias :e222_gp_gi_ias         :gain_item

      def gain_item(item, amount, include_equip = false)

        e222_gp_gi_ias(item, amount, include_equip)

        container = item_container(item.class)

        return unless container

        actor_id = EE::ActorAsItem.get_actor_id(item.class, item.id)

        return unless actor_id

        if item_number(item) > 0

          $game_party.add_actor(actor_id)

        else

          $game_party.remove_actor(actor_id) if $game_party.all_members.size > 1

        end

      end

      

      def actors

        return @actors

      end

    end

     

    class Game_Map

      alias :e222_gm_update_ias     :update

      def update(update_main = false)

        e222_gm_update_ias(update_main)

        check_party_equip

      end

      

      def check_party_equip

        $game_party.all_members.each do |actor|

          actor.equips.each do |item|

            next unless item

            actor_id = EE::ActorAsItem.get_actor_id(item.class, item.id)

            next unless actor_id

            $game_party.add_actor(actor_id) unless $game_party.actors.include?(actor_id)

          end

        end

      end

    end

     

  2. Have you considered not resetting on remove, but resetting on adding the actor?


    Because there is the option "initialize" on adding an actor, that will reset that actor to the database default values from beginning of the game...
  3. Andar said:
    Have you considered not resetting on remove, but resetting on adding the actor?

    Because there is the option "initialize" on adding an actor, that will reset that actor to the database default values from beginning of the game...
    well the only time an actor is added is through the script that I've provided, what your saying would only be done through eventing, in theory that would work well, but I need to know how to "initialize" through the script
  4. Try creating a Common Event set to Parallel Process, with a Conditional Branch that checks whether or not the player is in the party.


    Check: 'Set handling where conditions do not apply', and under Else, set Change Level to Decrease by 1, for each character you want to apply this to.


    I'm not sure about the PARAM points, but it should at least work for the actor's level, hope it helps.
  5. Metalraptor said:
    Try creating a Common Event set to Parallel Process, with a Conditional Branch that checks whether or not the player is in the party.

    Check: 'Set handling where conditions do not apply', and under Else, set Change Level to Decrease by 1, for each character you want to apply this to.

    Hope it helps.
    That wouldn't help the level needs to be descreased to 1 not by 1, and also I'm trying to stay away from parallel processes, I use very detailed attack animations and it causes lag
  6. nickfitzgerald3 said:
    well the only time an actor is added is through the script that I've provided, what your saying would only be done through eventing, in theory that would work well, but I need to know how to "initialize" through the script
    Any event command can also be called by script.
    There is a topic "script equivalents for event commands" where those are collected, check that.
  7. nickfitzgerald3 said:
    That wouldn't help the level needs to be descreased to 1 not by 1, and also I'm trying to stay away from parallel processes, I use very detailed attack animations and it causes lag
    Sorry, I meant to 1.
    When I tested it out it worked fine.
  8. Andar said:
    Any event command can also be called by script.

    There is a topic "script equivalents for event commands" where those are collected, check that.
    But I need to know where to add it into this script

    Metalraptor said:
    Sorry, I meant to 1.

    When I tested it out it worked fine.
    It doesnt help with the "Stat Distribution" script i'm using

    The only sure fire way I've found so far that works through eventing is that when the actor is added to party the "Initialize" works perfectly that Andar suggested, so basically I just need that option to be automatically on when any actor is added