[partially Solved]Need a new Database Category: Chants

Started by shintashi, March 27, 2011, 12:50:53 pm

Previous topic - Next topic

shintashi

so you have weapons, items, skills, and so on that are accessed through the database. They have Array like features, like name, power, description, damage, etc, but the data is saved externally in an rxdata file. I'm trying to make a new category called "chants". They would resemble "skills" but have only five relevant attributes:

I. id number
II. name string
III. description string
IV. power (1,2, or 3)
V. fragment id

I then need a place to input the data, so for example, the following data,

chant[0].name = "pyramid"
chant[0].description = "five sided geometric shape"
chant[0].power = 2
chant[0].fragment = 27

might be inserted by typing something like

chant[0] = ["pyramid", "five sided geometric shape", 2, 27]

I've tried messing with Hashes and Classes, but since this is a foreign object rather than an existing actor, item, skill, or weapon, I'm not sure what to do.

P.S. If I can do this with an array or a class, that's cool too.

nathmatt

i used a secound project to generate the new rxdata file i created a new RPG class so in your instance i would use skills as a base then choose something to represent the fragment id that way its ezier to configure if tell me what you want the fragment to pe represented as i can make the project 4 u
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


shintashi

I need about 250+ chants, and the Fragment is 'what it does',

since the only other game mechanic is "power" on a 1-3 scale.

if the Fragment was a tiny array like chant[6].fragment = [2,5,8]
or a single number, like chant[6].fragment = [238], either would work. 

Basically I just need something with a name, an id number, and some constants attached to it so I can fiddle with them later.

nathmatt

what i ment was i was going to make a project a let the skills be the chants the the skills name, id, description and power would be used so i just need to know what you want to be used as the fragment in can be sp cost , variance any thing but the id name discription and power of the skills
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


shintashi

Quote from: nathmatt on March 27, 2011, 04:52:23 pm
what i ment was i was going to make a project a let the skills be the chants the the skills name, id, description and power would be used so i just need to know what you want to be used as the fragment in can be sp cost , variance any thing but the id name discription and power of the skills


you could go with variance. I'm curious to see how this will turn out.

nathmatt

March 27, 2011, 05:11:04 pm #5 Last Edit: March 27, 2011, 05:32:29 pm by nathmatt
ok give me a min

edit ok here is the project just make a skill for every chant you want and it will use the information from the skills in the database to make your chants data
chant.name = the name of the skill
chant.description = the discription of the skill
chant.power = the power of the skill
chant.fragment = the variance of the skill

now you need to add

Spoiler: ShowHide
module RPG
 class Chants
   def initialize(skill)
     @id              = skill.id
     @name            = skill.name
     @icon_name       = skill.icon_name
     @description     = skill.description
     @power           = skill.power
     @fragment_id     = skill.variance
   end
   
   attr_accessor :id
   attr_accessor :name
   attr_accessor :icon_name
   attr_accessor :description
   attr_accessor :power
   attr_accessor :fragment_id
   
 end
 
end


to your main project id suggest at the top then you just load the chants in your main project the same way it loads the skills

edit i forgot to mention to create the data just play the game it will create the data and close
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


shintashi

March 27, 2011, 06:50:24 pm #6 Last Edit: March 27, 2011, 06:59:08 pm by shintashi
How do I add or edit a new chant?

Do I edit the skills in "chant", then save the chant datafile to my original file and add the modifications to my main?

edit: also, how do I access data from this new data file? I tried

p $data_chant[1]

and only got an error.

nathmatt

Edit the skills in the project I made the test play take the chant.rxdata and add it to ur data folder now in scene title look for where they load the other data and load the chants the same way
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


shintashi

March 27, 2011, 07:23:08 pm #8 Last Edit: March 27, 2011, 07:34:28 pm by shintashi
Quote from: nathmatt on March 27, 2011, 07:09:24 pm
Edit the skills in the project I made the test play take the chant.rxdata and add it to ur data folder now in scene title look for where they load the other data and load the chants the same way


right right,

but when I did that, and renamed the skill (in the chants document) to something like "Rei" (japanese for Zero), then saved, ran it, and then copypasted the data file into my original game's data folder,

when I used a common event to test if it existed, using the script


p data_chants[1].name


instead of getting "Rei' I get an error claiming "undefined local variable or method for "data_chants".


Edit:

My bad. Working on external monitor with broken laptop, hard to see,  but basically I omitted "$" and forgot array began at 0. Ok, works perfectly now ^_^

nathmatt

did you do this

class Scene_Title
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # If battle test
    if $BTEST
      battle_test
      return
    end
    # Load database
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    $data_chants        = load_data("Data/Chants.rxdata")
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


shintashi

May 10, 2011, 09:51:35 pm #10 Last Edit: May 10, 2011, 09:59:10 pm by shintashi
Quote from: nathmatt on March 27, 2011, 07:35:26 pm
did you do this

class Scene_Title
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # If battle test
   if $BTEST
     battle_test
     return
   end
   # Load database
   $data_actors        = load_data("Data/Actors.rxdata")
   $data_classes       = load_data("Data/Classes.rxdata")
   $data_skills        = load_data("Data/Skills.rxdata")
   $data_items         = load_data("Data/Items.rxdata")
   $data_weapons       = load_data("Data/Weapons.rxdata")
   $data_armors        = load_data("Data/Armors.rxdata")
   $data_enemies       = load_data("Data/Enemies.rxdata")
   $data_troops        = load_data("Data/Troops.rxdata")
   $data_states        = load_data("Data/States.rxdata")
   $data_animations    = load_data("Data/Animations.rxdata")
   $data_tilesets      = load_data("Data/Tilesets.rxdata")
   $data_common_events = load_data("Data/CommonEvents.rxdata")
   $data_system        = load_data("Data/System.rxdata")
   $data_chants        = load_data("Data/Chants.rxdata")



Recently ran into bizarre error in which all my graphics are missing and the program refuses to compile. (I haven't gone back into it in a while to edit the terms). I'll try to see if I can start from your original, but if not this could be disastrous.

Edit: Problem resolved: my game exe file was missing so I copy pasted a stock version. ^_^