I figured, that if i'm going to torture you with more of my little problems, I shouldn't open a new topic for it everytime...
Here is today's problem. Again lots of hard work, and again, i failed at a minor-extra-noobish thing.
Here's the class:
#-----------------------------------------------------------------------------------------
#this is a simple class describing the runewords-database, and handles the
#runes during every aspect of the game
#-----------------------------------------------------------------------------------------
class Game_RuneWords
attr_reader :runehelpdata
attr_reader :runeknown
attr_reader :castunknown
attr_reader :current5
#making the original database
#-----------------------------------------------------------------------------------------
def initialize
$runehelpdata= {"BaBiLon"=> "A mighty runeword,making the flows of magic unreadable."}
$skillrunes= { "Heal"=> "Ba" , "Warrior" => "Lon", "Decompose" => "Bi" }
$runeknown= { "BaBiLon"=>false }
$castunknown= { "BaBiLon"=>true }
$current5=[]
$current5[6]= " "
$current5[5]=$current5[6]
$current5[4]=$current5[5]
$current5[3]=$current5[4]
$current5[2]=$current5[3]
$current5[1]=$current5[2]
$babilonian = false
end
#learning a rune
#-----------------------------------------------------------------------------------------
def runelearn(name)
$runeknown[name]= true
end
#starting the runes at the beginning of the battles
#-----------------------------------------------------------------------------------------
def runestart
$current5[5]= " "
$current5[4]=$current5[5]
$current5[3]=$current5[4]
$current5[2]=$current5[3]
$current5[1]=$current5[2]
end
#The "What does a certain runeword?" database.
#-----------------------------------------------------------------------------------------
def runeaction(name)
if name == "BaBiLon"
$babilonian= true
end
end
#casting a runeword
#-----------------------------------------------------------------------------------------
def runecast
#3 elements
$current5[6] = $current5[3] + $current5[4] + $current5[5]
if $runeknown[$current5[6]] == false
if $castunknown[$current5[6]] == true
$data_rune.runelearn($current5[6])
runeaction($current5[6])
else
end
else
runeaction($current5[6])
end
end
#when using a skill with a runeword
#-----------------------------------------------------------------------------------------
def runicskill(skillname)
$current5[4]=$current5[5]
$current5[3]=$current5[4]
$current5[2]=$current5[3]
$current5[1]=$current5[2]
$current5[5]=$skillrunes[skillname]
print $current5[5]
runecast
end
end
A minor description of "what the whole thing does?":
In the game I'm tying to make, every skill has a little syllable attached to it. If you use a skill in battle, a chain of syllables will evolve, everytime adding the current skills syllable to it ( if you had BiBa so far, and use "Heal", you will have BiBaBa). These are called "runes"
The script remembers the last five rune only. So if you had BiBaBiBaBi and use "heal" you will have BaBiBaBiBa.
There are certain "runewords". If you build one, you trigger the effect. So far i have only one, you know, I'm just trying the have the whole thing work...
So, if you use Heal-Decompose-Warrior in chain, you will have "BaBiLon", and uhm...that's good.
Well, life is not so easy. As you guessed already, it doesn't work...
After initializing the whole thing with "$data_rune = Game_RuneWords.new" (working fine), and clearing the five runes (running "$data_rune.runestart" - fine as well ), it should go like:
skill->common event->runicskill method->runecast method->runeaction method
After printing some variables, I found out, that every "$current[]" is "nil". The common event that should give the skills name to the runicskill method, gives nill.
I tried this:
"@>Script: $data_rune.runicskill(@skill)"
because in the battle scene processing the @skill variable holds the currently used skill... but after printing it, i got some horrible hexadecimal value... so it's not what i need.
Okay, after all this useless babbling of mine:
Question: How could I give my method the name of that skill, which called it through a common event?
And i'm not sure about the hash-usage either...