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

nickfitzgerald3

Villager
Member
Joined
May 5, 2014
Messages
24
Reaction score
3
First Language
english
Primarily Uses
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

 

 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
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...
 

nickfitzgerald3

Villager
Member
Joined
May 5, 2014
Messages
24
Reaction score
3
First Language
english
Primarily Uses
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
 
Last edited by a moderator:

Palsa

General of Aurda
Veteran
Joined
Dec 21, 2012
Messages
343
Reaction score
84
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

nickfitzgerald3

Villager
Member
Joined
May 5, 2014
Messages
24
Reaction score
3
First Language
english
Primarily Uses
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
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
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.
 

Palsa

General of Aurda
Veteran
Joined
Dec 21, 2012
Messages
343
Reaction score
84
First Language
English
Primarily Uses
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.
 

nickfitzgerald3

Villager
Member
Joined
May 5, 2014
Messages
24
Reaction score
3
First Language
english
Primarily Uses
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

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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top