Closed ghost closed 8 years ago
so many errors, the idea is not bad, for example u can't use game.hasPokemonWithMove(sleepMove)
sleepMove is a table and game,hasPoemonWithMove() require a string game.hasPokemonWithMove(sleepMove[0]) is ok u need write some custom function for parse the right move
"So many errors" :laughing: I know I know, I'm still new.
So what you are suggesting is creating 2 separate functions for each set of moves?
game.hasPokemonWithMove(sleepMove)
and game.hasPokemonWithMove(hp1Move)
?
I'm not sure what's your point with game.hasPokemonWithMove(sleepMove[0])
:confused:
u need create a function for parse every move on the table, and for every move parse all team, when is found return the move name or pokemon index
for move in sleepMove do
Oh dear, I think it's gotten way out of my league. I'll try fixing it later. thank you for your input.
function game.hasPokemonWithMove(Move)
if type(Move) == "string" then
for pokemonId=1, getTeamSize(), 1 do
if hasMove(pokemonId, Move) then
return true
end
end
return false
elseif type(Move) == "table" then
for pokemonId=1, getTeamSize(), 1 do
for i, v in ipairs(Move) do
if v == Move then
if hasMove(pokemonId, v) then
return true
end
end
end
end
return false
end
end
This is a far as I can go trying to crate the appropriate function, not even sure if I'm in the right path, syntax is "ok" but it returns false
when I actually have a pokemon with the move "False Swipe", it attempts to catch the pokemon with weakAttack()
to reduce opponent's health below 50%. If anyone can help me with this function it would be much appreciated.
Have a look at some simple classes like Dialog.lua to understand how to create a class.
I just did and like a said before, I still don't now what else I need to do or fix, this is honestly beyond me, I can't make any more progress about it without REAL guidance, thank you all for the input anyways, I may push this a bit more when I have a better understanding of the language overall and way more time in my plate, but for now I'm closing this thread.
I've been trying to develop a more generic/comprehensive way of catching pokemon in Questing.lua: I added these lines of code to the "Quests/Quest.lua" file:
So I would like to use the functions
game.hasPokemonWithMove(Move)
,game.isActivePokemonwithMove(Move)
andgame.sendPokemonWithMove(Move)
.The 1st one is already stated in "Libs/gamelib.lua" but I doesn't work if
Move
is stated as a table with more than 1 move, and also add one more condition to return true if the specific move (or moves from a table) has more than 0 remaining PPs.The other 2 functions I've tried writing:
But I think it also need some fixing. Could anyone help me please?