Jump to content

Pokemon A - Problem with Cut Script


ego

Recommended Posts

Hello there,

 

I just started creating my own Pokemon Fan-Game.... or more like a demo.... actually atm I'm just trying out stuff to learn how things work and if it works the way I imagine.

So I started to modify the script for the HM Cut, so that it would allow other moves except cut to be used. I followed this tutorial: http://pokemonessentials.wikia.com/wiki/Tutorial:Adding_new_move_effects_outside_battle

I changed the script accordingly, so at you could use ember as well (for testing reasons only). In game it allows me to cut trees without a pokemon knowing cut, but with my Litwick knowing Ember. Here's the twist: When I confirm that I want to use cut it says "[Player] used cut.". No Pokemon moving over the screen. Just that message and a cut tree. If I hit "No" it asks me again if I'd like to cut the tree and if I confirm, it tells me "[Pokemon] used Ember" and it also plays the animation the way its supposed to.

Anyone an idea what the problem might be?

 

Thanks for your help.

 

Here's my modified script

Spoiler

def Kernel.pbCut
  possiblemoves=[:CUT,:EMBER]
  if $DEBUG ||
     (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
    for i in possiblemoves
      move=getID(PBMoves,i)
     movefinder=Kernel.pbCheckMove(move)
    if $DEBUG || movefinder
      Kernel.pbMessage(_INTL("This tree looks like it can be cut down!\1"))
      if Kernel.pbConfirmMessage(_INTL("Would you like to cut it?"))
        speciesname=!movefinder ? $Trainer.name : movefinder.name
        Kernel.pbMessage(_INTL("{1} used {2}.",speciesname,PBMoves.getName(move)))
        pbHiddenMoveAnimation(movefinder)
        return true
      end
    else
      Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))if i==possiblemoves[possiblemoves.lenght-1]
    end
    end
  else
    Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))
  end
  return false
end

HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn|
   if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
     return false
   end
   facingEvent=$game_player.pbFacingEvent
   if !facingEvent || facingEvent.name!="Tree"
     Kernel.pbMessage(_INTL("Can't use that here."))
     return false
   end
   return true
})

HiddenMoveHandlers::UseMove.add(:CUT,proc{|move,pokemon|
   if !pbHiddenMoveAnimation(pokemon)
     Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   facingEvent=$game_player.pbFacingEvent
   if facingEvent
     facingEvent.erase
     $PokemonMap.addErasedEvent(facingEvent.id)
   end
   return true
})

 

Link to comment
Share on other sites

Hello o/

 

Basically why you're getting that is because you're testing it in DEBUG mode via rpg maker (when you do it like that your character will be able to use all hms by itself).

 

Best way to test hm changes and most of the changes in the game is by playing the game without the debug mode.

 

Also you'll have to change the script in the beginning a bit so you won't get errors, should be something like these:

 

Quote

def Kernel.pbCut
  possiblemoves=[:CUT,:EMBER]
     if $DEBUG || $Trainer.badges[BADGEFORCUT]
    for i in possiblemoves
   move=getID(PBMoves,i)
   movefinder=Kernel.pbCheckMove(move)
    if movefinder

 

also you can add these 2 lines so you can also use the move from the pokemon tab

HiddenMoveHandlers::CanUseMove.copy(:CUT,:EMBER)

HiddenMoveHandlers::UseMove.copy(:CUT,:EMBER)

 

add them so it looks like this

Spoiler

926f096f866b41e2b1ffa71d999d1118.png

 

also when testing make sure to add gym badge that is required for you to use cut (by default it is set to 1) or change the requirement to 0 in setting script section

jsut add a event with this script, and make sure to talk to it before trying cut :]

$Trainer.badges[1]=true

 

 

Have fun and good luck with your game o/

Link to comment
Share on other sites

Hey thanks for your help.

I found another problem when trying to test cut in the normal game. Was just a typo.

 

Anyway another 2 problems occured. First, when I talk to the tree while not having any batches it works the way it's supposed to BUT it will let me cut the tree if I use ember from the party screen. And there's the second problem: the animation of the tree being cut down isn't playing and it just disappears. This is still true if I got enough batches. Talking to the tree and cutting it works perfectly fine but not when doing so using the party screen.

Link to comment
Share on other sites

I don't understand your first problem.

 

For 2nd problem I get the animation when using ember from party screen. Could you post whole script again and try to explain it more?

Link to comment
Share on other sites

For the first problem...are you saying that you can cut down trees with ember, but it won't show up in the party screen (like cut would) or is it that it works from the Pokemon party screen showing the move, but won't show up in the menu. Those are two very, very different problems with different fixes for each.

 

For the animations issue, you either didn't add a property in, but I feel like it's more than likely a specific line of coding was deleted. I'm sure Njab has this covered from the looks of it, but when you have a problem you need to be very specific and upload the code so that we can look at it to figure out what is wrong. But since it functions but the animation is missing, we need to look at the animation code section itself.

Link to comment
Share on other sites

Sorry forgot the script.

Here's the updated script

Spoiler

#===============================================================================
# Cut
#===============================================================================
def Kernel.pbCut
  possiblemoves=[:CUT,:EMBER]
  if $DEBUG || $Trainer.badges[BADGEFORCUT]
     (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
    for i in possiblemoves
      move=getID(PBMoves,i)
     movefinder=Kernel.pbCheckMove(move)
    if $DEBUG || movefinder
      Kernel.pbMessage(_INTL("This tree looks like it can be cut down!\1"))
      if Kernel.pbConfirmMessage(_INTL("Would you like to cut it?"))
        speciesname=!movefinder ? $Trainer.name : movefinder.name
        Kernel.pbMessage(_INTL("{1} used {2}.",speciesname,PBMoves.getName(move)))
        pbHiddenMoveAnimation(movefinder)
        return true
      end
    else
      Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))if i==possiblemoves[possiblemoves.length-1]
    end
    end
  else
    Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))
  end
  return false
end

HiddenMoveHandlers::CanUseMove.add(:CUT,proc{|move,pkmn|
   if !$DEBUG &&
      !(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORCUT : $Trainer.badges[BADGEFORCUT])
     Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
     return false
   end
   facingEvent=$game_player.pbFacingEvent
   if !facingEvent || facingEvent.name!="Tree"
     Kernel.pbMessage(_INTL("Can't use that here."))
     return false
   end
   return true
})
HiddenMoveHandlers::CanUseMove.copy(:CUT,:EMBER)

HiddenMoveHandlers::UseMove.add(:CUT,proc{|move,pokemon|
   if !pbHiddenMoveAnimation(pokemon)
     Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
   end
   facingEvent=$game_player.pbFacingEvent
   if facingEvent
     facingEvent.erase
     $PokemonMap.addErasedEvent(facingEvent.id)
   end
   return true
})
HiddenMoveHandlers::UseMove.copy(:CUT,:EMBER)

 

9 hours ago, Commander said:

you either didn't add a property in

What do you mean?

 

9 hours ago, Commander said:

But since it functions but the animation is missing, we need to look at the animation code section itself.


These are the event commands I'm using for the tree. They are excactly like the ones from Essentials.

 


 

Spoiler

@>Set Move Route: This event
:               : $>Turn Down
@>Conditional Branch: Script: Kernel.pbCut
  @>Set Move Route: This event
   :              : $>Wait: 2 frame(s)
   :              : $>Turn Left
   :              : $>Wait: 2 frame(s)
   :              : $>Turn Right
   :              : $>Wait: 2 frame(s)
   :              : $>Turn Up
   :              : $>Wait: 2 frame(s)
  @>Wait for Move's Completion
  @>Script: pbEraseThisEvent
  @>
 :  Branch End
@>

 

 

The first problem I was talking about:
You know in the original games, when a Pokemon knows cut it will show the move in the party screen. However if you don't have the requiered badge it will tell you "Sorry a new badge is required.". In my game it shows Ember in the party screen, just as it's supposed to be. But when I don't have the requiered badge, and choose to use Ember from the party screen, it will cut the tree even though I shouldn't be able to do so. I think it skipps the badge check.

 

Link to comment
Share on other sites

Turns out that in pokemon essentials there too is no animation for the tree if you use it from the party screen. So that one is solved. Kind of

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...