You are not logged in.
In pokecrystal, there are places where what happens in the game is conditional upon the pokemon in your party. For instance, if you show Elm that you have Togepi in your party, you can get an item. If you show the Battle Tower clerk that your party doesn't duplicate items, you can enter. These pre-existing functions can search your party for a particular species or for the items they are holding.
But what I want to do is create a function that searches your party for particular types, like the rock type, grass type etc. The idea here is that I want the player to have certain battles they can only enter if they do not bring with them particular pokemon types. E.g., there might be a hard version of Falkner you can only face if you don't have any rock, electric, or ice types in your party.
I'm still quite new to assembly, so I was hoping to be able to base the code off a pre-existing search script. For instance, the script for searching your party for a particular species is found in engine/pokemon/search2.asm, and it begins like this:
ld hl, wPartyMon1Species
Sadly, I'm getting stuck at the first hurdle. I'm not aware of any pre-existing equivalent of wPartyMon1Species for types. And I can't find where wPartyMon1Species is defined to try and create an equivalent.
Would anyone be able to help with at least some of the first steps of creating this search function?
Much appreciation in advance for any help offered.
One approach I thought of was to create a manual list of, say, Rock Types, like:
Then I could compare the species of the player's party mon to this list. I thought the following script might work in engine/events/specials.asm:
ld a, [wPartyMon1Species]
ld hl, RockMons
ld de, 1
jr nc, FoundNone
Or at least, it would check the first pokemon in the player's party for the rock type, and then I could figure out how to check the rest of the party from there.
But having tested it, the script doesn't seem to work.
Any ideas where it might be going wrong?
Last edited by nightbringer (2021-10-20 19:52:37)