Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Call Script Issues

Before anyone gets on my case, I am using the legal version of RMXP, I only use the term "Call Script" because it's clearer what I'm talking about than saying "the 'Script...' button". In fact, it's the legal version that's giving me so many problems.

I'm using a script that SephirothSpawn made for me, shown here:

Code:
class Game_Actor
  Skill_HP_Cost = {}
  Deterioration_State_ID = 017
  Time_To_Deterioration = 5 # In Seconds
  attr_reader :deteriorizing
  attr_accessor :last_deterioration_time
  alias seph_detsys_gmactr_setup setup
  alias seph_detsys_gmactr_states states
  alias seph_detsys_gmactr_scu? skill_can_use?
  alias seph_detsys_gmactr_se skill_effect
  def setup(actor_id)
    seph_detsys_gmactr_setup(actor_id)
    @deteriorizing = false
    @last_deterioration_time = Graphics.frame_count / Graphics.frame_rate
  end
  def states
    states = seph_detsys_gmactr_states
    if @deteriorizing
      states << Deterioration_State_ID
    end
    return states.sort
  end
  def skill_can_use?(skill_id)
    if Skill_HP_Cost.has_key?(skill_id)
      if @hp < Skill_HP_Cost[skill_id]
        return false
      end
    end
    return seph_detsys_gmactr_scu?(skill_id)
  end
  def skill_effect(user, skill)
    seph_detsys_gmactr_se(user, skill)
    if user.is_a?(Game_Actor)
      if user.deteriorizing
        if Skill_HP_Cost.has_key?(skill.id)
          user.hp -= Skill_HP_Cost[skill.id]
        end
      end
    end
  end
  def deteriorizing=(state)
    if state
      @deteriorizing = true
      @last_deterioration_time = Integer(Graphics.frame_count / Graphics.frame_rate)
    else
      @deteriorizing = false
    end
  end
  def update_deterioration
    if @deteriorizing
      current_time = Graphics.frame_count / Graphics.frame_rate
      if @last_deterioration_time + Time_To_Deterioration <= current_time 
        @maxhp_plus -= 1
        @last_deterioration_time = current_time
        @hp = [@hp, maxhp].min
      end
    end
  end
end

module Graphics  
  class << self
    if @stack_update.nil?
      alias orig_update update
      @stack_update = true
    end    
    def update
      orig_update
      unless $game_party.nil?
        $game_party.actors.each {|actor| actor.update_deterioration}
      end
    end
  end
end


To call the script, I've been using "$game_party.actors[001].deteriorizing = true"... But thanks to English RMXP's ridiculously narrow input windows, it puts the "= true" on a line of its own. So I also have to use this script by sandgolem in order to use that call.

Unfortunately, I still recieve this error:
NoMethodError occoured while running script:

undefined method `deteriorizing=' for nil:NilClass

I am not using SDK.

Can anyone point me in the direction of a solution?
 
Your problem isn't even the call script, just the command you are trying to use.

Just use 1 instead of 001.

And you can shorten the call line with:
Code:
actor = $game_party.actors[1]
actor.deteriorizing = true
 
Are you using a 1-person party?

The line

actor = $game_party.actors[1]

fetches the second person in your party.

Use 0 for the first.

If you want it by actor ids, and not their position in the party, you would use

actor = $game_actors[actor_id]
 
Thank you very much! Working flawlessly now.

...makes no sense to be refferring to something that appears with a 0 in front of it in your database, and have rgss throw a fit because the 0 is there.

You rock, Seph. ^^
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top