#resolved
1 messages · Page 1 of 1 (latest)
Intro to ScriptAPI
https://aka.ms/startwithmcscript
Intro to Tests
https://docs.microsoft.com/en-us/minecraft/creator/documents/gametestgettingstarted
Doc Index
https://docs.microsoft.com/en-us/minecraft/creator/scriptapi/
Community Docs
https://wiki.bedrock.dev/scripting/game-tests
Script API examples
https://github.com/JaylyDev/ScriptAPI
is there any other way? i am not really good with scripting
Not sure 😦
can you give me a exemple of what it would look like?
import * as mc from '@minecraft/server'
mc.world.afterEvents.entityDie.subscribe(data => {
if (data.deadEntity.typeId == "minecraft:pig"){
mc.world.sendMessage("Pig has been slain");
}
})
Not sure this will work cuz haven't tested it
But if it works it will print "Pig has been slain" in chat every time a pig was killed (no matter what was the source of damage)
You can specify the source using data.damageSource.typeId
why the subcribre tho?
To get the event every time it is happening
Data is data grabbed from the event
okay
can i add this to my addon, or do i have to make a seperate one?
Yes you can add it to your addon, just mention the dependencies in your manifest and create the main.js file in /scripta
Yep
np