The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

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
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old August 30th, 2013, 08:48 AM
TACHAN
 
Join Date: Jan 2010
Gender: Female
Hi!
I want to do that something happens if I take one Celebi and five pokemon Water type in the team. (To open the entry to a cave.)

I tried to do this, but it me did not work:

Condition and effect--> $Trainer.ablePokemonCount<=1
Condition and effect--> pbHasSpecies?(PBSpecies::CELEBI)
Condition and effect--> $Trainer.ablePokemonCount<=2
Condition and effect--> pbHasType?(PBTypes::WATER)
Condition and effect--> $Trainer.ablePokemonCount<=3
Condition and effect--> pbHasType?(PBTypes::WATER)
Condition and effect--> $Trainer.ablePokemonCount<=4
Condition and effect--> pbHasType?(PBTypes::WATER)
Condition and effect--> $Trainer.ablePokemonCount<=5
Condition and effect--> pbHasType?(PBTypes::WATER)
Condition and effect--> $Trainer.ablePokemonCount<=6
Condition and effect--> pbHasType?(PBTypes::WATER)

Have I been wrong in something?
Reply With Quote
  #2    
Old August 30th, 2013, 10:22 AM
Nickalooose
--------------------
 
Join Date: Mar 2008
Gender: Female
I would use this instead... Paste this in to a new script section above Main.
Code:
  def countType?(type)
    $game_variables[90]=0
    $game_variables[90]+=1 if $Trainer.party[0].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[1].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[2].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[3].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[4].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[5].hasType?(type)
  end
Change 90 to another variable number or don't, whatever.

Last edited by Nickalooose; August 30th, 2013 at 10:51 AM.
Reply With Quote
  #3    
Old August 30th, 2013, 10:37 AM
Umbreon's Avatar
Umbreon
Community Supporter
 
Join Date: Aug 2009
Location: Nearby my feet.
Age: 17
Gender: Male
Nature: Calm
Quote:
Originally Posted by Nickalooose View Post
I would use this instead... Paste this in to a new script section above Main.
Code:
  def countType?(type)
    $game_variables[90]+=1 if $Trainer.party[0].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[1].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[2].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[3].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[4].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[5].hasType?(type)
  end
Change 90 to another variable number or don't, whatever.
you have a small error:

Code:
  def countType?(type)
    $game_variables[90]=0
    $game_variables[90]+=1 if $Trainer.party[0].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[1].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[2].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[3].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[4].hasType?(type)
    $game_variables[90]+=1 if $Trainer.party[5].hasType?(type)
  end
without that extra line activating the function multiple COULD (not saying will as it could get reset elsewhere) get the variable to 6+ which would be a bad glitch
Reply With Quote
  #4    
Old August 30th, 2013, 10:51 AM
Nickalooose
--------------------
 
Join Date: Mar 2008
Gender: Female
Forgot to mention that I use this for something similar and the Variable is changed in the event to something else lol. Thanks.
Reply With Quote
  #5    
Old August 30th, 2013, 04:13 PM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Personally I'd put the call to the method in the parameter of a Conditional Branch, and have the method return true if all the conditions match and false otherwise. It saves mucking around with a variable.

Also, the code provided above doesn't answer the question as stated, as it will neither count Celebi (which isn't Water type) nor will it ignore eggs. The method may as well be tailored specifically to this use.

Code:
def pbCanOpenCelebiCave
  return false if !pbHasSpecies?(:CELEBI)
  count=0
  for poke in $Trainer.pokemonParty
    next if isConst?(poke.species,PBSpecies,:CELEBI)
    count+=1 if poke.hasType?(:WATER)
  end
  return (count==5)
end
I believe that'll work without fail. It doesn't matter which position the Celebi is in, just as long as there's one in there. Eggs are ignored, and both pure-Water and half-Water Pokémon are counted. Fainted Pokémon can also be counted, which I'm guessing is acceptable since fainted Pokémon can do other things in the overworld anyway (i.e. use HMs).
__________________
Reply With Quote
  #6    
Old August 31st, 2013, 12:08 AM
Nickalooose
--------------------
 
Join Date: Mar 2008
Gender: Female
That's nice code there Maruno, and just to let you know, the code I wrote is part of a bigger class, and does something in my game where variable 90 needs to be something, then is changed to something else, however, it pretty much does what he wanted :D so I shared... Which is why it doesn't check for Celebi.

But the reason I am commenting was, I couldn't find on wiki or in the scripts (because I didn't know what I was searching for), how to search an entire party... Is the $Trainer.pokemonParty, what checks a whole party?
Reply With Quote
  #7    
Old August 31st, 2013, 03:26 AM
TACHAN
 
Join Date: Jan 2010
Gender: Female
Quote:
Originally Posted by Maruno View Post
Personally I'd put the call to the method in the parameter of a Conditional Branch, and have the method return true if all the conditions match and false otherwise. It saves mucking around with a variable.

Also, the code provided above doesn't answer the question as stated, as it will neither count Celebi (which isn't Water type) nor will it ignore eggs. The method may as well be tailored specifically to this use.

Code:
def pbCanOpenCelebiCave
  return false if !pbHasSpecies?(:CELEBI)
  count=0
  for poke in $Trainer.pokemonParty
    next if isConst?(poke.species,PBSpecies,:CELEBI)
    count+=1 if poke.hasType?(:WATER)
  end
  return (count==5)
end
I believe that'll work without fail. It doesn't matter which position the Celebi is in, just as long as there's one in there. Eggs are ignored, and both pure-Water and half-Water Pokémon are counted. Fainted Pokémon can also be counted, which I'm guessing is acceptable since fainted Pokémon can do other things in the overworld anyway (i.e. use HMs).
Thank you very much. It works perfectly.
Reply With Quote
  #8    
Old August 31st, 2013, 08:44 AM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Quote:
Originally Posted by Nickalooose View Post
But the reason I am commenting was, I couldn't find on wiki or in the scripts (because I didn't know what I was searching for), how to search an entire party... Is the $Trainer.pokemonParty, what checks a whole party?
$Trainer.pokemonParty is the same as $Trainer.party but without the eggs.
$Trainer.ablePokemonParty is the same as $Trainer.pokemonParty but without the fainted Pokémon.

You check through them by using a for poke in $Trainer.pokemonParty loop.

I've added some information to the Party page.
__________________
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 07:28 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.