[Ace] Achievement Script Help

● ARCHIVED · READ-ONLY
Started by Bloodmorphed 10 posts View original ↗
  1. I think the script is pretty self explanatory, I'm having errors out the butt and I have no idea why.

    Code:
    module BoodAachievepointvar = 100    module Achievement       Achievements = {           1 => {        :trigger => 100,        :item => [1, 1],        :weapon => [1, 1],        :gold => 100,        :points => 10,        :message => "Achievement Get! Slime Exterminator.",           }     }   endend    if $game_switches[BloodA::Achievement::Achievements()[:trigger]] == true  $game_message.add(BloodA::Achievement::Achievements()[:message])  $game_party.gain_item($data_items[BloodA::Achievement::Achievements()[:item]])  $game_party.gain_item($data_weapons[BloodA::Achievement::Achievements()[:weapon]], amount)  $game_party.gain_gold(BloodA::Achievement::Achievements()[:gold])  $game_variables[BloodA::achievepointvar] += BloodA::Achievement::Achievements()[:points]  $game_switches[BloodA::Achievement::Achievements()[:trigger]] = falseend
  2. Normally I would say "what errors" as saying "I'm having errors" without providing any further detail doesn't really give us much to go on.


    But in this case ... take another good, close look at the name of your outer module. ;)
  3. you'll also need to put in an amount for your first gain_items call

    like this

    $game_party.gain_item($data_items[*BloodA::Achievement::Achievements[:item]])the notice the * in front of your info call. This will get the id and amount from your customize section and pass them as arguments.
  4. module BloodAachievepointvar = 100    module Achievement       Achievements = {           1 => {        :trigger => 100,        :item => [1, 1],        :weapon => [1, 1],        :gold => 100,        :points => 10,        :message => "Achievement Get! Slime Exterminator.",           }     }   endend    if $game_switches[BloodA::Achievement::Achievements()[:trigger]] == true #line 21  $game_message.add(BloodA::Achievement::Achievements()[:message])  $game_party.gain_item(*$data_items[BloodA::Achievement::Achievements()[:item]])  $game_party.gain_item($data_weapons[BloodA::Achievement::Achievements()[:weapon]], amount)  $game_party.gain_gold(BloodA::Achievement::Achievements()[:gold])  $game_variables[BloodA::achievepointvar] += BloodA::Achievement::Achievements()[:points]  $game_switches[BloodA::Achievement::Achievements()[:trigger]] = falseendOkay so I've fixed my misspelling of my module hehe, and I did what you said. But I'm getting a undefined method on line 21. I'm guessing its the () part at the end. 
  5. double check the location of your * :) It should be before the variable call and not before the method call. I have no idea if the ()'s are giving errors, they might be
  6. Okay I fixed it, I also removed the ", amount" from the weapons one and did the same thing with the "*" they are in the right place now. But I still get a undefined methond '[]' on line 21, and I'm guessing thats not the only line ill get that error. 
  7. ok fixed some more typos and stuff. And it still gives me an error, but that's because your if statement isn't defined inside of a class.

    Spoiler
    module BloodAachievepointvar = 100 module Achievement Achievements = [] Achievements[1] = { :trigger => 100, :item => [1, 1], :weapon => [1, 1], :gold => 100, :points => 10, :message => "Achievement Get! Slime Exterminator.", } endend if $game_switches[BloodA::Achievement::Achievements[1][:trigger]] $game_message.add(BloodA::Achievement::Achievements[1][:message]) $game_party.gain_item($data_items[*BloodA::Achievement::Achievements[1][:item]]) $game_party.gain_item($data_weapons[*BloodA::Achievement::Achievements[1][:weapon]]) $game_party.gain_gold(BloodA::Achievement::Achievements[1][:gold]) $game_variables[BloodA::achievepointvar] += BloodA::Achievement::Achievements[1][:points] $game_switches[BloodA::Achievement::Achievements[1][:trigger]] = false end
    the probelm is all the global variables aren't yet defined when you place code outside of a class because when the program runs, it checks this code before it checks all the classes. I'm assuming you have it in a class on your end. So see if it works
  8. I do not have a class yet. I figured I'd need to but with so many thing going on here I didn't know what to do.

    Also the way you have it here is quite weird. The whole reason I had it it the way I had it is I wanted only one part to do all the checking, and not have to do that for EACH one. So I could have 5 achievements running off that one snippet. I wanted to have it set-up kind of like Vlues Weapon/Armor/Item affixes script

    EDIT:

    Also instead of a trigger I may use a variable. Mainly because I can use a variable almost an unlimited amount of times, while 1 trigger per achievement could get a little hectic.
  9. well there's ways of checking stuff only when you need to, but your way was looking for info in the wrong spot. It was looking for all your info in your "Achievements" variable instead of in the 1 slot. And since it was a has, you could search the hash by 1 because it was the only entry.. it was really 0. This is why I change that first hash into an array.

    Hope that make sense.

    So if you want to look through your array then do something like this:

    BloodA::Achievement::Achievements.each do |info| # This skips the info unless the switch is on next unless $game_switches[info[:trigger]] $game_message.add(info[:message]) $game_party.gain_item($data_items[info[:item][0]], info[:item][1]) $game_party.gain_item($data_weapons[info[:item][0]], info[:item][1]) $game_party.gain_gold(info[:gold]) $game_variables[BloodA::achievepointvar] += info[:points] $game_switches[info[:trigger]] = false endedit: I just took the * character out.. I just read the code and saw some errors in it. This is what I get for trying to code while tired
  10. Ehhh, thanks for the help.

    But I think Imma give up on this for now. I'll just use a simple eventing system for it or something.