The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: Therilith on January 03, 2012, 03:19:38 PM

Title: Some variables not changing properly (+other newb questions)
Post by: Therilith on January 03, 2012, 03:19:38 PM
Also, instead of starting another thread:

2. Is there some (non-manually-script-every-single-enemy) way of "tagging" certain enemies to make them the only viable targets for certain skills?
I know that you can make all enemies except the proper targets immune to any custom states inflicted by the skill, but I was hoping for an easier way to make an incorrect target completely immune to all aspects of the skill (including damage).
For example:
Let's say I've created a spell that's only supposed to hurt dragons. Is there an easy way for me to designate certain enemies (and actors) as "dragon" and have every other monster/actor be completely immune?

3. How do I create a skill/spell that can be used on any ally except the caster?
Out-of-combat only healing spell in this particular case (if that matters).



SOLVED:The top one prints my level (10), as you'd expect.
The bottom one (and several others I tested), however, always returns 0.
I have no scrips or events (common or otherwise) that would interfere with with either one.
I even tested it on a completely fresh project with nothing but the above events.

I'm probably missing something painfully obvious here, but I figured I'd ask anyway.

(http://i868.photobucket.com/albums/ab241/Therilith/wtf.jpg)

SOLVED: 1. Is there an easy way to reset and update your characters skills after a class change?
Basically, I want a class change to remove all your old class skills and give you all the skills of your new class up to your current level.
Title: Re: Some variables not changing properly (+a class change question)
Post by: pacdiggity on January 03, 2012, 03:52:16 PM
You don't have to use preceding 0s when specifying an ID. You can just use \v[61] and $game_variables[61]. I don't know if that'll fix the problem though.

As for your other problems, this should fix it. Follow the instructions, and paste this above Main.
Code: [Select]
# To not forget a skill upon class change, put either the tags:
# \DON'T FORGET
# \DONT FORGET
# case insensetive.

class RPG::Skill
  def dont_forget?
    return @dont_forget if !@dont_forget.nil?
    @dont_forget = self.note[/\\DON'?T FORGET/i]
  end
end

class Game_Interpreter
  def command_321
    actor = $game_actors[@params[0]]
    if actor != nil and $data_classes[@params[1]] != nil
      for i in actor.class.learnings
        s = $data_skills[i.skill_id]
        actor.forget_skill(i.skill_id) unless s.dont_forget?
      end
    end
    actor = $game_actors[@params[0]]
    if actor != nil and $data_classes[@params[1]] != nil
      actor.class_id = @params[1]
      for i in actor.class.learnings
        actor.learn_skill(i.skill_id) unless i.level > actor.level
      end
    end
    return true
  end
end
Title: Re: Some variables not changing properly (+a class change question)
Post by: Therilith on January 03, 2012, 04:02:23 PM
You don't have to use preceding 0s when specifying an ID. You can just use \v[61] and $game_variables[61]. I don't know if that'll fix the problem though.
I think it did. Odd...

The code worked great too. Thanks!  :)