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
34,763
Reaction score
8,971
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
34,763
Reaction score
8,971
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
 

Latest Profile Posts

SF_People3_1 added!
index.php

Micro rant. The worst part of working from home when you live with your family is seeing how inconsiderate they are. "Hey, you're sitting in front of your computer, that means you're not doing anything! I want to put the TV at 200 decibels!"

If I was working in the office would you still talking me like that?
It's definitely discouraging when streamers give a try-to-say-it-nicely (i.e. bad) review of your game demo. It's like jumping into a cold pool. Bad initally, but it gets better with time. And you are now more alert and see better.
Some screenshots of the pub and lodging with the beginnings of clutter taking shape
TTp8uCw.png

jtC202e.png

bSXgyVl.png

eRx9PUF.png
Backgrounds are not my strong suit... :kaodes:
DazI8jt.jpg

Just realized I forgot doing the clouds... woops

Forum statistics

Threads
118,507
Messages
1,116,468
Members
155,505
Latest member
annas2n
Top