wwwwwwzx / gsclua

Lua scripts for GSC games
MIT License
34 stars 22 forks source link

Add item finding script and modify wild viewer. #20

Closed Storm-Eagle20 closed 6 years ago

Storm-Eagle20 commented 6 years ago

There's now a script that allows you to find Pokemon with Held Items, making finding Lucky Eggs much easier, or even just farming Berries like Gold Berry.

The Wild Viewer has been updated accordingly to support Hold Items.

wwwwwwzx commented 6 years ago

Thanks

Storm-Eagle20 commented 6 years ago

No problem. I have one request. Could you change a specific piece of code for me?

In the Wild Viewer on line 311...

gui.text (2,10, "Enemy Hold Item: "..items_table[item])

Could you change that to this?

if items_table[item] ~= nil then gui.text (2,10, "Enemy Hold Item: "..items_table[item]) else gui.text (2,10, "Enemy Hold Item: None") end

After you merged the pull request I found a bug where items_table[item] tries to concatenate a nil value, usually after using Thief or capturing a Pokemon with a held item, and then crashing the script.

I'd like to apologize though since I didn't think items_table[item] could possibly become nil, which is why I didn't implement it in the first place.