Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials

Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.



Reply
 
Thread Tools
  #1    
Old December 25th, 2012 (02:06 AM). Edited December 25th, 2012 by WinterKirby.
WinterKirby's Avatar
WinterKirby
 
Join Date: Dec 2012
Age: 2
Gender: Male
Nature: Mild
So, I'm trying to add in effects for new moves, but I've run into some trouble.

Here's the code:
Code:
class PokeBattle_Move_138 < PokeBattle_Move
  def pbEffect(attacker,opponent)
    if attacker.hp==attacker.totalhp
      @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
      return -1
    end
    if attacker.pbTooHigh?(PBStats::DEFENSE) &&
       attacker.pbTooHigh?(PBStats::SPDEF)
      @battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis))
      return -1
    end
    @battle.pbAnimation(@id,attacker,nil)
      hpgain=(attacker.totalhp/2).floor
      attacker.pbRecoverHP(hpgain)
      @battle.pbDisplay(_INTL("{1} regained health!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::DEFENSE)
      @battle.pbCommonAnimation("StatUp",attacker,nil)
      attacker.pbIncreaseStatBasic(PBStats::DEFENSE,1)
      @battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPDEF)
      @battle.pbCommonAnimation("StatUp",attacker,nil)
      attacker.pbIncreaseStatBasic(PBStats::SPDEF,1)
      @battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
    end
      return 0
    end
  end
end
The move is supposed to raise the user's Defense and Sp. Defense, and restores 1/2 of the user's max HP. However, when I run, I'm told that that there's a syntax error at line 7589. Which is the second to last "end." So I tried a little more tweaking, into this:

Code:
class PokeBattle_Move_138 < PokeBattle_Move
  def pbEffect(attacker,opponent)
    if attacker.hp==attacker.totalhp ||
      attacker.pbTooHigh?(PBStats::DEFENSE) &&
      attacker.pbTooHigh?(PBStats::SPDEF)
      @battle.pbDisplay(_INTL("But it failed!",attacker.pbThis))
      return -1
    end
    @battle.pbAnimation(@id,attacker,nil)
      hpgain=(attacker.totalhp/2).floor
      attacker.pbRecoverHP(hpgain)
    end
    if !attacker.pbTooHigh?(PBStats::DEFENSE)
      @battle.pbCommonAnimation("StatUp",attacker,nil)
      attacker.pbIncreaseStatBasic(PBStats::DEFENSE,1)
      @battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPDEF)
      @battle.pbCommonAnimation("StatUp",attacker,nil)
      attacker.pbIncreaseStatBasic(PBStats::SPDEF,1)
      @battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
    end
    return -1
  end
end
And again, there's a syntax error, which is now on the last "end" (line 7585)

I honestly have no idea what I'm doing. Someone help me.
Reply With Quote
  #2    
Old December 25th, 2012 (11:08 AM).
Luka S.J.'s Avatar
Luka S.J.
S.J.Ware HD
 
Join Date: Dec 2008
Age: 21
Gender: Male
Nature: Adamant
Quote originally posted by WinterKirby:
So, I'm trying to add in effects for new moves, but I've run into some trouble.

Here's the code:
Code:
class PokeBattle_Move_138 < PokeBattle_Move
  def pbEffect(attacker,opponent)
    if attacker.hp==attacker.totalhp
      @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
      return -1
    end
    if attacker.pbTooHigh?(PBStats::DEFENSE) &&
       attacker.pbTooHigh?(PBStats::SPDEF)
      @battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis))
      return -1
    end
    @battle.pbAnimation(@id,attacker,nil)
      hpgain=(attacker.totalhp/2).floor
      attacker.pbRecoverHP(hpgain)
      @battle.pbDisplay(_INTL("{1} regained health!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::DEFENSE)
      @battle.pbCommonAnimation("StatUp",attacker,nil)
      attacker.pbIncreaseStatBasic(PBStats::DEFENSE,1)
      @battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPDEF)
      @battle.pbCommonAnimation("StatUp",attacker,nil)
      attacker.pbIncreaseStatBasic(PBStats::SPDEF,1)
      @battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
    end
      return 0
    end
  end
end
These two ends shouldn't be there.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 10:39 AM.