< >
Hello, guest! Please log in or register.

The PokéCommunity

Go Back     The PokéCommunity Forums > Create & Discover > Game Development > Pokémon Essentials Question Scripting trouble.

Notices

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 Post Reply
 
Thread Tools
  #1    
Old December 25th, 2012 (2:06 AM). Edited December 25th, 2012 by WinterKirby.
WinterKirby's Avatar
WinterKirby WinterKirby is offline
 
Join Date: Dec 2012
Age: 4
Gender: Male
Nature: Mild
Posts: 152
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

Relevant Advertising!

  #2    
Old December 25th, 2012 (11:08 AM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,041
Quote:
Originally Posted by WinterKirby View Post
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 Post 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

Forum Jump


  All times are GMT -8. The time now is 12:48 PM.


Contact Us Archive Privacy Statement Terms of Service Top