- 6
- Posts
- 9
- Years
- Seen Sep 11, 2015
EDIT: I think I've figured out the problem, I changed the code in the original line to && instead of ||. I'm not sure if this is the complete fix but it fixed my problem. Since you will probably read this FL you should change this part of your guide if it is incorrect so other people don't have the same problems. I also had to comment the 'HiddenMoveHandlers::UseMove' part, but I could be doing it wrong but it fixed the problem for me. Cut now works only when I have the item. I'd still appreciate confirmation that I will not run into future errors :-)
EDIT: I have all the HM's I want in my game as items working so if the code is needed just ask. I have Cut, Flash, Rock Smash, Fly, Surf, Strength
So I've looked around a bit for the answer to my problem and I can't find it.
Also, before you tell me to use the guide by FL, I did, and it helped me a lot.
Thank you FL. (you should update\write it easier to understand :-) )
I followed the guide as best as I could and pretty much do not understand why the script is not working properly.
I'm pretty new at reading code for whatever language this is but I have experience in other languages so I find it easier than someone who has never done anything related.
Now I might be an idiot and it will work properly in game and it's just debug mode. I am trying to change all HM's to items and add their usage with 'use' in the items bag, but here's one example of the problem (I assume it's for all of them because it's doing it for the other HMs code I haven't touched).
First off I set all of the badge requirements in the Settings scripts to 0 so that you could just use them when you receive the item.
I added this for the item in .txt file. I assume it's okay. The item name for cut is going to be Tree Zapper
526,TREEZAPPER,Tree Zapper,8,0,"An invention from a crazy scientist used to remove small trees.",2,0,6
I added the handlers in ItemEffects scripts
ItemHandlers::UseFromBag.add(:TREEZAPPER,proc{|item|
next canUseMoveCut? ? 2 : 0
})
ItemHandlers::UseInField.add(:TREEZAPPER,proc{|item|
useMoveCut if canUseMoveCut?
})
And this is all of the code I have for cut in the HiddenMoves scripts including comments
def Kernel.pbCut
movefinder=Kernel.pbCheckMove(:CUT)
if $DEBUG || $PokemonBag.pbQuantity(PBItems::TREEZAPPER) > 0
Kernel.pbMessage(_INTL("This tree looks like it can be cut down!"))
if Kernel.pbConfirmMessage(_INTL("Would you like to cut it?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("{1} used the Tree Zapper!\1",speciesname))
pbHiddenMoveAnimation(nil)
return true
end
else
Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))
return false
end
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(nil)
# Kernel.pbMessage(_INTL("{1} used {2}!",$trainer.name,Cut(move)))
# end
# facingEvent=$game_player.pbFacingEvent
# if facingEvent
# facingEvent.erase
# $PokemonMap.addErasedEvent(facingEvent.id)
# end
# return true
#})
def canUseMoveCut?
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
end
def useMoveCut
if !pbHiddenMoveAnimation(nil)
Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"the Treezapper!"))
end
facingEvent=$game_player.pbFacingEvent
if facingEvent
facingEvent.erase
$PokemonMap.addErasedEvent(facingEvent.id)
end
return true
end
I included the comments because it was part of the original code.
Also the HIDDENMOVESCOUNTBADGES where it checks for badges was in the top part but I took it out because it seemed unnecessary and was confusing me, as well as having no difference in-game being there.
Where did I go wrong? The result is that no matter what it will cut the tree. If it is a different problem, strength is working without any code being changed and having no pokemon with strength. However, the 'use' item (from bag)command works fine but I barely tested once I saw it working and had the bigger problem.
So basically something is wrong, maybe I changed something and I need help because that code looks like it would work to me and it's not :[ we've all been frustrated at one point or another coding. I barely even ask for help but this is actually wasting too much of my time. All replies appreciated.
Sorry if it's the wrong section. I didn't post this as a reply to the topic because it was an old topic and a long post. Also sorry it's long as finuck.
First, in PokemonHiddenMoves script section comment the 'HiddenMoveHandlers::CanUseMove' proc (all the code, inclusive the '})'). Change the line 'if $DEBUG || movefinder' (there's one for each move) to 'if $DEBUG || ($PokemonBag.pbQuantity(PBItems::YOURITEMINTERNALNAME)>0'. There's a item example for item.txt PBs:
EDIT: I have all the HM's I want in my game as items working so if the code is needed just ask. I have Cut, Flash, Rock Smash, Fly, Surf, Strength
So I've looked around a bit for the answer to my problem and I can't find it.
Also, before you tell me to use the guide by FL, I did, and it helped me a lot.
Thank you FL. (you should update\write it easier to understand :-) )
I followed the guide as best as I could and pretty much do not understand why the script is not working properly.
I'm pretty new at reading code for whatever language this is but I have experience in other languages so I find it easier than someone who has never done anything related.
Now I might be an idiot and it will work properly in game and it's just debug mode. I am trying to change all HM's to items and add their usage with 'use' in the items bag, but here's one example of the problem (I assume it's for all of them because it's doing it for the other HMs code I haven't touched).
First off I set all of the badge requirements in the Settings scripts to 0 so that you could just use them when you receive the item.
I added this for the item in .txt file. I assume it's okay. The item name for cut is going to be Tree Zapper
526,TREEZAPPER,Tree Zapper,8,0,"An invention from a crazy scientist used to remove small trees.",2,0,6
I added the handlers in ItemEffects scripts
ItemHandlers::UseFromBag.add(:TREEZAPPER,proc{|item|
next canUseMoveCut? ? 2 : 0
})
ItemHandlers::UseInField.add(:TREEZAPPER,proc{|item|
useMoveCut if canUseMoveCut?
})
And this is all of the code I have for cut in the HiddenMoves scripts including comments
def Kernel.pbCut
movefinder=Kernel.pbCheckMove(:CUT)
if $DEBUG || $PokemonBag.pbQuantity(PBItems::TREEZAPPER) > 0
Kernel.pbMessage(_INTL("This tree looks like it can be cut down!"))
if Kernel.pbConfirmMessage(_INTL("Would you like to cut it?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("{1} used the Tree Zapper!\1",speciesname))
pbHiddenMoveAnimation(nil)
return true
end
else
Kernel.pbMessage(_INTL("This tree looks like it can be cut down."))
return false
end
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(nil)
# Kernel.pbMessage(_INTL("{1} used {2}!",$trainer.name,Cut(move)))
# end
# facingEvent=$game_player.pbFacingEvent
# if facingEvent
# facingEvent.erase
# $PokemonMap.addErasedEvent(facingEvent.id)
# end
# return true
#})
def canUseMoveCut?
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
end
def useMoveCut
if !pbHiddenMoveAnimation(nil)
Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"the Treezapper!"))
end
facingEvent=$game_player.pbFacingEvent
if facingEvent
facingEvent.erase
$PokemonMap.addErasedEvent(facingEvent.id)
end
return true
end
I included the comments because it was part of the original code.
Also the HIDDENMOVESCOUNTBADGES where it checks for badges was in the top part but I took it out because it seemed unnecessary and was confusing me, as well as having no difference in-game being there.
Where did I go wrong? The result is that no matter what it will cut the tree. If it is a different problem, strength is working without any code being changed and having no pokemon with strength. However, the 'use' item (from bag)command works fine but I barely tested once I saw it working and had the bigger problem.
So basically something is wrong, maybe I changed something and I need help because that code looks like it would work to me and it's not :[ we've all been frustrated at one point or another coding. I barely even ask for help but this is actually wasting too much of my time. All replies appreciated.
Sorry if it's the wrong section. I didn't post this as a reply to the topic because it was an old topic and a long post. Also sorry it's long as finuck.
Last edited: