#How would i create custom weapons using VSC
1 messages · Page 1 of 1 (latest)
you would use an item componenet and use an effect for the playerinteract event
do you have an example?
so you have your item right?
{
"format_version": "1.21.90",
"minecraft:item": {
"description": {
"identifier": "ns:custom_weapon",
"menu_category": {
"category": "items"
}
},
"components": {
"ns:custom_weapon": {}
}
}
}```
this applies the component `ns:custom_weapon` which you would then register
```js
import { world, system } from "@minecraft/server";
const CustomWeaponComponent = {
onUse(event) {
event.source.addEffect(/*...*/)
}
};
system.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
itemComponentRegistry.registerCustomComponent("ns:custom_weapon", CustomWeaponComponent);
});```
okay but how would i add effects to it on right click with a cooldown
so you want there to be a cooldown?
you would add the cooldown componeent and the use_modifier componenet
{
"format_version": "1.21.90",
"minecraft:item": {
"description": {
"identifier": "ns:custom_weapon",
"menu_category": {
"category": "items"
}
},
"components": {
"minecraft:use_modifiers": {
"use_duration": 0.1 // time for the weapon to use in secs
},
"minecraft:cooldown": {
"category": "effect_use", // you can put anything in here
"duration": 2 // time for the weapon to cooldown in seconds
},
"ns:custom_weapon": {}
}
}
}```
and in the script turn the `onUse` to `onCompleteUse`
so script would look like this:
import { world, system } from "@minecraft/server";
const CustomWeaponComponent = {
onCompleteUse(event) { // changed
event.source.addEffect(/*...*/)
}
};
system.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
itemComponentRegistry.registerCustomComponent("ns:custom_weapon", CustomWeaponComponent);
});```
@untold heron
wdym
you know, in the com.mojang folder
no i dont think so
oh no
oh yeah
no
you;re not??
i change the zip to .mcpack and download it like that
you should put your BP and RP in them
it basically loads faster
and no need to import .mcpack
put your BP and RP directories respectovely in them
cuz importing makes it go to behavior_packs and not the development version
wdym
its still not in minecraft
are you putting the .mcpack or the actual directory?
first of all
put it in DEVELOPMENT, not the normal
and second of all
unzip ot
its supposed to be the raw directory
ye
i cant vc rn sry
its not supposed to be liek that]
theres like 3 of them in one
oh damn
okay i took it out
it should be once you see inside the folder it should be like scripts, items, manifest right?
try now
i am
yessss its here now
okay lemme check if i updated it
yo has anyone told you your hella smart
idk cause your helpin me!
its giving me this error
what mc version u using
its 2.1.0-beta for server-ui
yea i just changed it to that someone in off topic told me to change it to 2.2.0 😭
oh lol
same error?
uea
i did /reload all
still same error
@young dome
yup
that says that server-ui is wrong
i fixed it
i wanna work on a custom item
@young dome so can you give me a full example on a custom sword so i could copy and paste it and work on from it please?
use this and it shud work https://wiki.bedrock.dev/items/items-intro