• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Being able to read the encounters.txt to show icons (16.2)

465
Posts
7
Years
  • Age 24
  • Seen yesterday
So first off heres a mock of what i plan to do (just not complete but to a showable standard)

s2HV2zG.png


basically wanting to make a encounter table device, that shows what encounters you can get on that route and from what method.

my issue is i know no way to read the encounter table of said map your on, translate that for scripting to use it (being Species ID or Species name) then get it to call the icon like above (i do plan to have a "if seen" check but that shouldnt be too hard)

any help of being able to read it as an array or something as stated above would be great! ^^
 

#Not Important

All hail the wishmaker
910
Posts
4
Years
I would make an array
seen=[]
And in the encounter method:
seen+=[species]
That should work but I dont have a PC to test it right now
 
465
Posts
7
Years
  • Age 24
  • Seen yesterday
I would make an array
seen=[]
And in the encounter method:
seen+=[species] That should work but I dont have a PC to test it right now[/QUOTE] So that'd help see if they were seen? surely you could just check if say i.isseen? i being that specific pokemon? and was moreso on an array or check for the encounters than an array for seen, but if isseen? or whatever doesnt work ill try that out ^^
 

#Not Important

All hail the wishmaker
910
Posts
4
Years
So that'd help see if they were seen? surely you could just check if say i.isseen? i being that specific pokemon?

and was moreso on an array or check for the encounters than an array for seen, but if isseen? or whatever doesnt work ill try that out ^^

But I.isseen would need you to have a separate check for all the mons

EDIT: The array should be made into a game variable: $game_variables[999]
 
465
Posts
7
Years
  • Age 24
  • Seen yesterday
edit: was using the wrong call for the icons so fixed.

main issue now is the script hanging;

using the code mentioned above (from vendily)

it checks every encounter down the list, this is ofc causing alot of hanging (atleast with test it seems to be)

is there anyway to force the "for j in 0...encounter.length" to cut of at a certain point (Say 20) and stop going through each encounter?
 
Last edited:

#Not Important

All hail the wishmaker
910
Posts
4
Years
Add this right after the for loop
Code:
  if j>=20
    break
  end
That stops the code right after the encounter count reaches 20
 
465
Posts
7
Years
  • Age 24
  • Seen yesterday
Add this right after the for loop
Code:
  if j>=20
    break
  end
That stops the code right after the encounter count reaches 20

definetly a right step forward and works to an extent.

the script part seems to work as 0,1 0,2 etc. being first the encounter type then the encounter.

so if i want to only show 3 of the encounter types on the screen id do
if i>=4
break
end
but while this mostly works it instead only counts upto the defined 4th encounter type, not the 4th encounter type of the map.
 
465
Posts
7
Years
  • Age 24
  • Seen yesterday
Yes, you would do that, but before for j in 0...encounter[i].length

thats the thing though, it gives the same results. like on the encounter list its (in their id form): 0,2,4,5 and so on and doing that will just show 0 and 2 being land and water

is it that the i isnt set like 0,1,2,3 with the data in them but 0,2,4? if so shouldnt i add an extra like value counting up? thats seeming to be the case with the prediction.~

edit: with testing using i and the species name (encounter[j][0]) it returns each encounter and jumps from 0 to 2.
 
Last edited:
465
Posts
7
Years
  • Age 24
  • Seen yesterday
so hopefully final issue, after converting into its own script it works fine except for issues after closing, the background goes away and the text sometimes but the icons hang around for a few seconds before disappearing.

Code:
  def endScene
    pbFadeOutAndHide(@sprites) { update }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
Thats the last bit of code before ending the script, not sure why it hangs though.

edit:
discovered a slight issue with pages;

my original idea (which technically works) was
Code:
pagecount = 0 if pagecount = nil
pagecount=($game_variables[104]*3)
then
Code:
for i in pagecount...encounter.length

issue is, again, encounter.length is the order of the id's (0,2,4) not 0,1,2,3 etc. that i thought it was so on page 1 it'd not show any of the encounter ids lower than pagecount.
 
Last edited:
465
Posts
7
Years
  • Age 24
  • Seen yesterday
Could you post the full code?
It might be easier to find out what's happening like that

right yea sorry xP shoulda really done that from the start.

Spoiler:


Should be it all.
(made changes for additions but the page issue is just for the j and i that dont mention outbreak, radar or weather)
 
Back
Top