The answer to both of those questions is yes!
The catch is the code is slightly spread out, but it's not too complex, we aren't going poking around anywhere.
So, first thing first, you can change the value of a game switch or game variable in the scripts by setting $game_switches[XXX] or $game_variables[XXX] for switch XXX and variable XXX respectively.
There are also two Event handlers that we are interested in. The first is Events.onStartBattle. It gives us a pokemon object, which we can look at and possibly modify, or nil if it's a trainer battle. There's an example in Script Section PField_EncounterModifiers.
Now we just want to store the species, so here's a little quick thing that does it for us.
Code:
Events.onStartBattle+=proc {|sender,e|
pokemon=e[0]
$game_variables[XXX]= (pokemon)? pokemon.species : 0
}
This just stores the species in variable XXX or 0 if it was a trainer battle. If you wanted form too, you could store an array ([pokemon.species,pokemon.form]) or use multiple variables.
The other bit is in Events.onEndBattle. This tells us the decision made for the battle.
Code:
# Results of battle:
# 0 - Undecided or aborted
# 1 - Player won
# 2 - Player lost
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 4 - Wild Pokémon was caught
# 5 - Draw
That's what the numbers mean, and one of those is the decision.
You'll want to look at that for how you want your script to turn out.
Code:
Events.onEndBattle+=proc {|sender,e|
decision = e[0]
canlose = e[1]
if (decision == 1 || decision == 4) # fainted or caught the pokemon
if $game_variables[XXX]!=0 # was it a wild battle?
# do something
end
end
}
Not really sure what you want to do, but this is a start I'd suppose.
This sounds pretty similar to my rescue chain script if you want to take a look at that. I wouldn't blame you for rolling your own though, it's good to learn how to script.
Good luck and have fun!