RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Custom Script Help Please

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 75
What the...?
I've been trying to create the following script to help someone with a problem, and it should be simple.  Yet, I keep getting a Syntax Error at the last end of the script:

Code: [Select]
#-------------------------------------------------------------------------
#                 IXFURUs_MIMIC_SKILLS
#                     By: Ixfuru
#
#--------------------------------------------------------------------------
#
#
#This script basically allows one actor to learn all the skills learned by another party member
#Originally, this idea was given to me by summonduel whose intent
#was to use the script in order to create a Transformed (Alter-Ego) of sorts
#which could learn skills while transformed, and when transformation ended, these
#skills would be given to the original character automatically to use in the
#character's normal form.  That said, I could think of several more uses for this
#script.
#------------------------------------------------------------------------------
#
#
module Ix_Mimic_Skills
#EDITTABLE
#
#1) This is the ID of the original actor in database.  This is the actor
#which will automatically learn all the given skills of the other actor,
#automatically.
Original_Actor = 1
#2)  This is the ID of the alter ego actor from the database, whose learned
#skills will automatically be added to the list of skills for the other actor.
Alter_Ego = 2
#3) This is the number of Switch which enables the script.  If switch is ON, then
# the script is enabled.
Mimic_Switch = 1
# In this scenario, the original actor only gains skills learned by alter ego when
#this switch is ON.  This will help with creating a common event to run parallel
#and/or causing other things to happen during transformation (if that's what you
#use it for) like changing actor graphic, time check for transformation active,
#and other things which may incur as a result of the switch being active.  Please
#note that this script only deals with the skills adding part and you'll have to
#add this extra stuff by yourself in events/common events.

end

#END EDITTABLE REGION
----------------------------------------------------------------------------------
class Mimic_Skills
  def initialize
    original = actor_id[Original_Actor]
    alter = actor_id[Alter_Ego]
    x = $game_switches[Mimic_Switch]
    y = skill.id[Mimic_Skill]  end
  def refresh
    while x == false
      if alter.learn_skill[y]
      original.learn_skill[y]
    else
      return
    end
  return
end

Is this script expecting another return of some sort?
« Last Edit: July 13, 2011, 03:59:42 PM by IXFURU »

**
Rep:
Level 82
Your missing some "ends". If you use proper indenting it would stand out more for you.
Also the end for the methods need to be on a new line, or at the very least us a ; before them.

It looks more like you are writing Python code than Ruby.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Add a line break between y = skill.id[Mimic_Skill] and end. Also, you need two more ends at the end (one for refresh and one for the class Mimic_Skills).

Edit: Ninja'd : (

***
Rep:
Level 75
What the...?
Good Lord!   I can't stand that I'm unable to do this simple script.  As many tutorials as I've watched.  This should be a simple one.

I just really suck at it, I reckon.

Anyway, thanks for the input, folks.  I just tried it a new way.  I got to thinking, that a) the "if" line isn't really checking anything.  So, I decided to try to rewrite the script.  This time, I placed in a bit of code to 'iterate' through a loop.  I don't want, after all, the loop to repeat infinitely.  Just once when a new skill is learned.  So, anyway, here's my third attempt, though this one makes it through alright, I get a No method Error '-@' for nil:NilClass when I run th program:

Code: [Select]
#-------------------------------------------------------------------------
#                 IXFURUs_MIMIC_SKILLS
#                     By: Ixfuru
#
#--------------------------------------------------------------------------
#
#
#This script basically allows one actor, who is not in party
# to gain the skills learned by another actor who is in the party.
#Originally, this idea was originally given to me by summonduel whose intent
#was to use the script in order to create a Transformed (Alter-Ego) of sorts
#which could learn skills while transformed, and when transformation ended, these
#skills would be given to the original character automatically to use in the
#character's normal form.  That said, I could think of several more uses for this
#script.
#------------------------------------------------------------------------------
#
#
module Ix_Mimic_Skills
#EDITTABLE
#
#1) This is the ID of the original actor in database.  This is the actor
#which will automatically learn all the given skills of the other actor,
#automatically.
ORIGINAL_ACTOR = 1
#2)  This is the ID of the alter ego actor from the database, whose learned
#skills will automatically be added to the list of skills for the other actor.
ALTER_EGO = 2
#3) This is the number of Switch which enables the script.  If switch is ON, then
# the script is enabled.
MIMIC_SWITCH = 1
# In this scenario, the original actor only gains skills learned by alter ego when
#this switch is ON.  This will help with creating a common event to run parallel
#and/or causing other things to happen during transformation (if that's what you
#use it for) like changing actor graphic, time check for transformation active,
#and other things which may incur as a result of the switch being active.  Please
#note that this script only deals with the skills adding part and you'll have to
#add this extra stuff by yourself in events/common events.

end

#END EDITTABLE REGION
----------------------------------------------------------------------------------
class Mimic_Skills < Game_Interpreter
  def initialize
    @original = 0
    @alter = 0
    @msw = 0
    mimic_skill = 0
  end
  def original
    original = actor.actor_id[ORIGINAL ACTOR]
  end
  def alter
    alter = actor.actor_id[ALTER_EGO]
  end
  def msw
    msw = $game_switches[MIMIC_SWITCH]
  end
  def mimic_skill
  mimic_skill = actor.learn_skill[skill_id]
  end
  def update
    while msw == true
      if alter.learn_skill = true
        mimic_skill = skill.skill_id[learn_skill]
        original.learn_skill[mimic_skill]
        else
          return 0
        end
        return 0
      end
      return
    end
end


« Last Edit: July 14, 2011, 02:58:25 AM by IXFURU »