#How to make a sell
1 messages · Page 1 of 1 (latest)
You're probably going to need to wait for custom components. With them, you can make a script trigger with the on_step_on component to clear them of dirt and adds to whatever scoreboard you're using for money based on that amount. I don't have example code for that btw, it's just an idea b
you can do that with just commands though
Ah, right. Don't know why you had to ping me though, I wasn't the one asking the question
No I want to have it with no command blocks only srcipting?
I’ve seen someone do something like it with bridge
It technically can be done with block events, but those will be removed soon so it is 100% not recommended and not really worth learning
As you'll just need to switch it over to custom components when they release from beta anyway
With block event can I just type in the name of the scoreboard or is there something else I have to do?
There's more to block events, they're pretty similar to entity events. But again, I would recommend just waiting for custom components, or using some kind of command substitute
Like running something like this in tick.json: execute as @a[hasitem={item=minecraft:dirt}] at @s if block ~~-1~ beacon run function sell_dirt
Where sell dirt looks like this: scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=64..}] money 64 clear @s[hasitem={item=minecraft:dirt,quantity=64..}] dirt 0 64 scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=32..}] money 32 clear @s[hasitem={item=minecraft:dirt,quantity=32..}] dirt 0 32 scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=16..}] money 16 clear @s[hasitem={item=minecraft:dirt,quantity=16..}] dirt 0 16 scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=8..}] money 8 clear @s[hasitem={item=minecraft:dirt,quantity=8..}] dirt 0 8 scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=4..}] money 4 clear @s[hasitem={item=minecraft:dirt,quantity=4..}] dirt 0 4 scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=2..}] money 2 clear @s[hasitem={item=minecraft:dirt,quantity=2..}] dirt 0 2 scoreboard players add @s[hasitem={item=minecraft:dirt,quantity=1..}] money 1 clear @s[hasitem={item=minecraft:dirt,quantity=1..}] dirt 0 1 execute as @s[hasitem={item=minecraft:dirt}] run function sell_dirt
thanks im hoping that this works you are a life saver
oone last question what part of bridge should i put this on
I've never used bridge, so no idea
ok
What do you use?
Just vscode
With the blockception extension for autocomplete
And node.js for scripting
Ooh I might try that thanks
Are you sure that suite is even safe?
You're downloading it from with in the app, correct?
Yes
It should be safe then
Oh also is it really easy to put use the scripting
Or does it use { , : etc
The node.js is more difficult than blockception. Check out machinebuilders intro to scripting for how to download that (it's what I used)
Oh, I see
you're still editing text
Like, it's the actual json you're modifying
blockception tells you what your options are though
Hmm would it be new friendly do you think?
Depends on the person
I kinda know the basics
I don't really know what experience you have beyond add-on making. A lot of it is how fast of a learner you are, which I don't know
I know every minecraft bedrock command
But I’m stating coding so I can make my server better
Gotcha. Yeah, you can try it if you want, or keep using bridge if you want
Whatever works for you
I'm sure there's a way to make mcfunctions with bridge; I just don't know how you would
Also one last question before I probably don’t type in this. Is there a specific way I should start the code or do I just paste it in?
For functions you just paste them into a .mcfunction file. tick.json has a json structure htough. Here's an intro to functions and tick.json: https://wiki.bedrock.dev/commands/mcfunctions.html
Thanks for all the help and tips I appreciate it
@ripe roost im using vscoode but im not suure if im doing it quite right do yoou have any idea ho to start this type of code and finish it?
Like, how to do functions?
I can't really explain them any better than the links I sent
Ah
there is more aboce it
but im sure its not right
Just type the list of commands
where do i find preset files?
Like, a valid mcfunction would look like this:
say hi
Tp ~~~
There are no presets for functions
You need to make a folder called functions in your bp
Then put the .mcfunction files in there
I generally create a .txt file and rename the extension to .mcfunction, as they're stored in the same way
is it this easy?
well i wouldnt say easy
Other than that, it's right
hmm
At least if it's in the right folder
me trying to figure out how to do that
so if i go into the file somehow it will work
What platform are you on? Windows, Mac linux?
windows
imm in luck lol
File explorer should have an option to view file extensions, which lets you change them
I'll send some screenshots in a second
Yeah, just go to the file directory for your addon. It should be in com.mogang
when i open it there is no com.mojang only minecraft and it leads me back too vscode
ohhh
i dont have com.mojang i called it minecraaft
Ok, so what you do for the file extensions is select the 3 dots at the top of file explorer. Then, go to options. Under view, one of the checkboxes should say something about hiding file extensions. Uncheck that. From there, you should be able to see the extension of files and change them to .mcfunction files
Wait, where's your addon being stored?
As that's the folder you need to be in
i have iy on my desktop in my files
So like, that's the files mc is reading from?
the code is in function
As addons should be in com.mojang, which is created automatically when mc bedrock is installed
so should i add a file called com.mojang ?
would it go in here?
What's that minecraft file?
i made it myself
Also, is your addon showing up ingame?
wait i can do that
oh yh im only creating it rn
Have you gone through the beginner's guide on the wiki? It talks quite a bit about creating the files and such in the first part
That might be helpful
ill have a look at that and ill ask ifyu if i have any problems
Ok, sounds good
Once you have the addon set up in mc, add a folder to the root of the pack called "functions"
Then put your mcfunction files in there
i cant find anything that shows how to do that?
So, it's in the development_behavior_pack folder but isn't showing up in mc?
Also, the .mcfunction is still in the file; it needs to be the extension, not a part of the file
ity only has one
do i neeed any of the plugins they offer?
Wait, I thought you went through the tutorial to get your addon setup?
It needs to be in the folder for your addon in com.mojanf
There's no point doing anything with it before it's there
the thing that im getting stuck on is to import it into minecraft
Ah, i see. You don't need to make a .Mcaddon file. Yoh just need to open the folder using the path given in the tutorial, go to the folder development_behavior_packs, and put it in there
can you put the page where it shows how to do that
Ah, mb, for some reason I thought you had the link
Here it is : https://wiki.bedrock.dev/guide/
That was the one that showed how to do it
It only explained basic stuff but not how to link it to mc
The folders it mentions here https://wiki.bedrock.dev/guide/project-setup.html#the-com-mojang-folder are how you link it to mc. I can see where the confusion comes from, but all addons are is mc reading those folders
.mcpack and .mcaddon files just add the json to those folders
You must be looking in the wrong place. Minecraft needs that to run
It's where it stores all of your worlds and other data
wait i have the com.mojang folder now with this in it - .mcfunction sell_dirt
That doesn't go in com.mojang directly. It goes in the folder for your addon, under functions
Just like how the beginner guide has entities and items you put into folders under the addon's folder
this is staarting too make less and less mor sense
I'd recommend going through the full beginner's guide and get that addon working
I think it will help it make more sense
ive been lookihng at some videos but i just cant understand how to test it and nothing even the wiki didnt help me
Like, testing the addon overall? It should just show up in game if everuthing is implemented correctly
You might also want to check out the vanilla packs as an example
Downloadable from: https://github.com/Mojang/bedrock-samples/releases
bedrock.dev archive: https://bedrock.dev/packs
GitHub (RP & BP) : https://github.com/bedrock-dot-dev/packs
Example particles: https://aka.ms/MCParticlesPack
Java Edition's Vanilla Packs: https://mcasset.cloud/
I showed you it and you said it was right though
Well, I said that it was mostly right except for the fact .mcfunction was in the file rather than the extension. And the function can be right with your addon still being broken
I meant the addon format as a whole, as the manifest might be wrong
i got the com.mojang file in now i think im starting to understand
Nice! Have you had any success with the vanilla packs as well?
Yh im able to watch as I edit them now and I think I’m getting close to figuring out how to get the sell block 👍
Nice!
ive fiigured out basically everything now but i just need to makee this function actualy function
All you should need to do is add it to the list of functions in tick.json. Learn more about it here: https://wiki.bedrock.dev/commands/mcfunctions.html
What should I be adding to the tick.json
its says therer is something wrong with money
Can you send the full content log?
what is the content log?
ooh
like when you goo into minecraft
and it shows the glitchs
?
The content log gives you live feedback for most errors that could occur while developing your add-on.
https://wiki.bedrock.dev/guide/troubleshooting.html#content-log
So is there a money item then?
Item well i did /scoreboard objective add money dummy
I did money because that was the scoreboard you used that is should give the money to
Can you send your tick.json?
as in a picture of it?
thid is what i put in my tick.json
if you are wondering what firstfunction is, it is the name of my function
{
"values": ["firstfunction"]
}
Ah, ok. Maybe try putting a /say into firstfunction to make sure it's running