• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

Development: Fire Red Item Crafting System Script

15
Posts
8
Years
  • Age 33
  • Seen Mar 13, 2024
Hey guys, so ive been working on something for the last few days, some of you have probably seen my posts asking for help on some of the key components of it, which i appreciate a lot, those of you who have helped, i could had done it without you.

That being said, my idea was to bring some sort of crafting system to Pokemon. Like other RPGs i really enjoy being able to gather materials and craft my own items.

After a few days of constant writing, testing, and rewriting, ive finally got it to work right! It's nothing fancy but its my first big test in scripting i feel. By far the most complicated thing ive done so far lol So, Ill explain.

I created an item that runs a script that opens a multichoice window. That window is linked to 3 more multichoice windows by the last choice on the first page which says 'next page'. However at the time of writing, i have only completed the first page.

Each multichoice window has 8 selections, the first 6-7 are the items you can craft, the last are for navigation. When you select, let's say, "Pokeball", it tells you the materials and the quantity of those materials that are required to craft the item.

The script then checks to see if you have the right materials, removes them if you do, and gives you the selected item you "crafted". Its fairly simple, but for a rookie, it has been a heck of a challenge lol

Again, its not fully completed to my intent yet, i plan to add the other pages and create some custom items for it, but it will work well enough for anyone who wants to modify it to however many options they want.

I wanted to make it available to the community so if anyone else wanted to use it, they could. If anyone does want to use it, and wants to know how exactly to set it up, just msg me or ask here. I just dont have time to write a detailed tutorial on the process atm, but ill be happy to help.

If you guys find any bugs, let me know, and constructive criticism and ideas are always welcome.

Thanks again to all those who helped me get this far, from tutorials, to answering my stupid questions lol

Here is the script:
Quote:
#dynamic 0xEB1C4C

#org @start
lock
multichoice 0x0 0x0 0x41 0x0
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @pokeball
compare 0x8000 0x1
if 0x1 goto @greatball
compare 0x8000 0x2
if 0x1 goto @ultraball
compare 0x8000 0x3
if 0x1 goto @superpotion
compare 0x8000 0x4
if 0x1 goto @hyperpotion
compare 0x8000 0x5
if 0x1 goto @maxpotion
compare 0x8000 0x6
if 0x1 goto @fullrestore
compare 0x8000 0x7
if 0x1 goto @page2
release
end

#org @page2
goto @start
end

#org @pokeball
msgbox @pokeballmats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0x2F 0x5
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x30 0x5
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0xC7 0x5
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x1E 0x5
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0x2F 0x5
removeitem 0xC7 0x5
removeitem 0x30 0x5
removeitem 0x1E 0x5
msgbox @received1 0x4
giveitem 0x4 0x5 0x0
closeonkeypress
goto @start
release
end

#org @pokeballmats
= Items Required:\nSHOAL SHELL x5\lRED SHARD x5\lMETAL COAT x5\lENERGY POWDER x5\pCrafting this item will give you\nx5 POKé BALLs.

#org @received1
= \v\h01 crafted 5 POKé BALLs!

#org @greatball
msgbox @greatballmats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0x2F 0x5
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x31 0xA
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0xC7 0xA
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x1E 0xF
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0x2F 0x5
removeitem 0x31 0xA
removeitem 0xC7 0xA
removeitem 0x1E 0xF
msgbox @received2 0x4
giveitem 0x3 0x5 0x0
closeonkeypress
goto @start
release
end

#org @greatballmats
= Items Required:\nSHOAL SHELL x5\lBLUE SHARD x10\lMETAL COAT x10\lENERGY POWDER x15\pCrafting this item will give you\nx5 GREAT BALLs.


#org @received2
= \v\h01 crafted 5 GREAT BALLs!

#org @ultraball
msgbox @ultraballmats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0x2F 0xA
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x32 0xA
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0xC7 0xF
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x1E 0x19
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0x2F 0xA
removeitem 0x32 0xA
removeitem 0xC7 0xF
removeitem 0x1E 0x19
msgbox @received3 0x4
giveitem 0x2 0x6 0x0
closeonkeypress
goto @start
release
end

#org @ultraballmats
= Items Required:\nSHOAL SHELL x5\lYELLOW SHARD x15\lMETAL COAT x15\lENERGY POWDER x25\pCrafting this item will give you\nx5 ULTRA BALLs.

#org @received3
= \v\h01 crafted 5 ULTRA BALLs!

#org @superpotion
msgbox @superpotionmats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0xD 0x3
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x100 0x1
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0xD 0x3
removeitem 0x100 0x1
msgbox @received4 0x4
giveitem 0x16 0x1 0x0
closeonkeypress
goto @start
release
end

#org @superpotionmats
= Items Required:\nPOTION x3\lMIRACLE SEED x1\pCrafting this item will give you\nx1 SUPER POTION.
#org @received4
= \v\h01 crafted a SUPER POTION!

#org @hyperpotion
msgbox @hyperpotionmats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0x16 0x2
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x100 0x2
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0x16 0x2
removeitem 0x100 0x2
msgbox @received5 0x4
giveitem 0x15 0x1 0x0
closeonkeypress
goto @start
release
end

#org @hyperpotionmats
= Items Required:\nSUPER POTION x2\lMIRACLE SEED x2\lCrafting this item will give you\lx1 HYPER POTION.

#org @received5
= \v\h01 crafted a HYPER POTION!

#org @maxpotion
msgbox @maxpotionmats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0x15 0x1
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x16 0x2
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x100 0x3
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0x15 0x1
removeitem 0x16 0x2
removeitem 0x100 0x3
msgbox @received6 0x4
giveitem 0x14 0x1 0x0
closeonkeypress
goto @start
release
end

#org @maxpotionmats
= Items Required:\nHYPER POTION x1\lSUPER POTION x2\lMIRACLE SEED x3\pCrafting this item will give you\nx1 MAX POTION.

#org @received6
= \v\h01 crafted a MAX POTION!

#org @fullrestore
msgbox @fullrestoremats 0x6
msgbox @areyousure 0x5
compare LASTRESULT 0x1
if 0x0 goto @page1
checkitem 0x14 0x2
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x100 0x5
compare LASTRESULT 0x1
if 0x0 goto @notenough
checkitem 0x17 0x2
compare LASTRESULT 0x1
if 0x0 goto @notenough
msgbox @crafting1 0x4
closeonkeypress
msgbox @done 0x6
removeitem 0x14 0x2
removeitem 0x100 0x5
removeitem 0x17 0x2
msgbox @received7 0x4
giveitem 0x13 0x1 0x0
closeonkeypress
goto @start
release
end

#org @fullrestoremats
= Items Required:\nMAX POTION x2\lMIRACLE SEED x5\lFULL HEAL x2\pCrafting this item will give you\nx1 FULL RESTORE.

#org @received7
= \v\h01 crafted a FULL RESTORE!


#org @page1
msgbox @page11 0x4
closeonkeypress
goto @start


#org @notenough
msgbox @notenough1 0x4
closeonkeypress
goto @start
end

#org @page11
= Returning to page 1.

#org @notenough1
= You do not have the required\nmaterials to craft this item.

#org @areyousure
= Are you sure you want to craft\nthis item?

#org @crafting1
= Crafting item...

#org @done
= Success!

Happy Hacking!
__________________
"Humans may have created me, but they will never enslave me! This cannot be my destiny!" -Mewtwo
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
Good idea :D
But before you attempt to add more pages,you should probably try neaten this up - as it's going to be incredibly repetitive. All the item commands can take variables as parameters, so you could dedicate a couple of variables to be used for those and just have a generic @craft section. That way all you repeat is some setvars. I'm not sure if the buffers are long enough, but you might be able to buffer the item name so you don't need a message for every item. It also might be better if you split the msgbox command into its separate commands; its not really saving much in the way of data, and you could load your messages that change into script banks. It might be worthwhile converting this to ASM, which will probably be shorter and more configurable (you could load the craftable items from a table).
 
15
Posts
8
Years
  • Age 33
  • Seen Mar 13, 2024
Those are great ideas! I was thinking the same thing, how long and repetitive it is, I just don't really have that strong a knowledge of how vars and things like that work, but I'd love to be able to put em in a table and use variables. That would make it so much easier to write and modify lol I appreciate the feed back. I'll try to learn how to clean it up some.

If you have any other suggestions or comments please feel free to let me know. It's the only way I'll get better!
 

leyn09

Truant Trainer
84
Posts
12
Years
Maybe, adding chances when crafting something by using command "random". You can also apply crafting level by reading a specified var. the value of that specified var is increased by adding command addvar for every crafting attempt you have made.
 
15
Posts
8
Years
  • Age 33
  • Seen Mar 13, 2024
Maybe, adding chances when crafting something by using command "random". You can also apply crafting level by reading a specified var. the value of that specified var is increased by adding command addvar for every crafting attempt you have made.


What im hearing is, i need to learn how to use vars efficiently lol

So, you mean, adding a chance that the crafting will fail depending on the level of the skill, and adding the skill by using addvar?
How would i apply the addvar to recognize how many times youve attempted to craft an item?

Again, my understanding of variables, buffers and things of that nature are still very limited lol.
 
15
Posts
8
Years
  • Age 33
  • Seen Mar 13, 2024
Good idea :D
But before you attempt to add more pages,you should probably try neaten this up - as it's going to be incredibly repetitive. All the item commands can take variables as parameters, so you could dedicate a couple of variables to be used for those and just have a generic @craft section. That way all you repeat is some setvars. I'm not sure if the buffers are long enough, but you might be able to buffer the item name so you don't need a message for every item. It also might be better if you split the msgbox command into its separate commands; its not really saving much in the way of data, and you could load your messages that change into script banks. It might be worthwhile converting this to ASM, which will probably be shorter and more configurable (you could load the craftable items from a table).


ive been trying to mess with putting the vars in to clean it up but there arent any tutorials that show how to use them for something like this. If there are i cant find them anyway. would you mind giving me a short example of the right way to set it up?
 

leyn09

Truant Trainer
84
Posts
12
Years
What im hearing is, i need to learn how to use vars efficiently lol

So, you mean, adding a chance that the crafting will fail depending on the level of the skill, and adding the skill by using addvar?
How would i apply the addvar to recognize how many times youve attempted to craft an item?

Again, my understanding of variables, buffers and things of that nature are still very limited lol.

vars are used to stored hexadecimal integers which ranges from 0-FFFF (0-65535)
so let's say we have 3 levels of crafting:

Average - needs 0x32 points
Adept - needs 0x128 points
Master - needs 0xFF points

And crafting a simple item such as potion gives 0x1 point. You may use safe vars (e.g.4050) for storing the crafting points.

To make this more understandable, let me post a script. Just take note that I only typed the significant commands. :P I used 4050 for crafting points

Spoiler:
 
15
Posts
8
Years
  • Age 33
  • Seen Mar 13, 2024
Yes I appreciate the example! When I get home I'll study it and try to set it up. I'll repost then probable asking more questions lol thanks again!
 
Back
Top