Lv.1
编程考级已过4级
签名:emmmm
在 岛3代码师的代码教程 中回复
var wanjia = []
world.onPlayerJoin(({entity}) => {
entity.player.maxHp = 100
entity.player.Hp = 100
entity.player.coin = 0
entity.player.jurisdiction = ‘玩家’
if (entity.player.name == ‘许嘉茗’){
world.say(本图独家代码顾问(兼代码师)${entity.player.name}来到了地图!大家欢迎!)
entity.addTag(‘本图独家代码顾问(兼代码师)’)
entity.player.jurisdiction = ‘本图独家代码顾问(兼代码师)’
}else if (entity.player.name == ‘玉耒.ZHYUE’){
world.say(本图作者${entity.player.name}来到了地图!大家欢迎!)
entity.addTag(‘作者’)
entity.player.jurisdiction = ‘作者’
}else if (entity.player.name == ‘奇异果博士’){
world.say(本图管喵${entity.player.name}来到了地图!大家欢迎!)
entity.addTag(‘管喵’)
entity.player.jurisdiction = ‘管喵’
}
})
world.onChat(async ({ entity, message }) => {
if (admin.includes(entity.player.name) && (entity.player.jurisdiction == ‘作者’ ||
entity.player.jurisdiction == ‘管喵’ || entity.player.jurisdiction == ‘本图独家代码顾问(兼代码师)’)) {
if (message == ‘作者权限’) { world.say(‘作者特权:特殊功能包含日出、天亮、傍晚、天黑变大、变小、还原大小、飞行、解除飞行、隐身、现身、隐藏名字、显示名字、幽灵模式、解除幽灵、发光、还原发光、反光、还原反光、变红色、变蓝色、变绿色、变黄色、变浅蓝色、还原颜色、全部还原、封神,禁言(例如:禁言+禁言者名字)、解除禁言(例如:解除禁言+被禁言者名字),提示(禁言和禁言者名字间不要加空格)设置临时管喵,删除临时管喵,查看临时管喵名单,发布公告,踢出(例如:踢出+踢出者名字),关闭粒子特效、开启粒子特效、变彩虹,清屏,击杀(例如:击杀+击杀名字),加金币,金币清0,重置服务器,重置方块倒计时,进监狱(例如:进监狱+进监狱玩家的名字),出监狱(例如:出监狱+出监狱玩家的名字),手动添喵誉值,手动减少信誉值,作者权限选项版’)}
if (message == ‘变大’) { entity.player.scale = 1.5; world.say(‘作者’ + entity.player.name + ‘变大了’) }
if (message == ‘变小’) { entity.player.scale = 0.5; world.say(‘作者’ + entity.player.name + ‘变小了’) }
if (message == ‘还原大小’) { entity.player.scale = 1; world.say(‘作者’ + entity.player.name + ‘还原了大小’) }
if (message == ‘飞行’) { entity.player.canFly = true; world.say(‘作者’ + entity.player.name + ‘开启了飞行模式’) }
if (message == ‘关闭飞行’) { entity.player.canFly = false; world.say(‘作者’ + entity.player.name + ‘关闭了飞行模式’) }
if (message == ‘加速’) {
entity.player.walkSpeed += 300
entity.player.runSpeed += 190
entity.player.flySpeed += 100
world.say(‘作者’ + entity.player.name + ‘ clock up’)
}
if (message == ‘隐身’) { entity.player.invisible = true; world.say(‘作者’ + entity.player.name + ‘隐身’) }
if (message == ‘现身’) { entity.player.invisible = false; world.say(‘作者’ + entity.player.name + ‘现身了’) }
if (message == ‘隐藏名字’) { entity.player.showName = false; world.say(‘作者’ + entity.player.name + ‘隐藏了名字’) }
if (message == ‘显示名字’) { entity.player.showName = true; world.say(‘作者’ + entity.player.name + ‘显示了名字’) }
if (message == ‘幽灵模式’) { entity.player.spectator = true; world.say(‘作者’ + entity.player.name + ‘开启了幽灵模式’) }
if (message == ‘关闭幽灵’) { entity.player.spectator = false; world.say(‘作者’ + entity.player.name + ‘关闭了幽灵模式’) }
if (message == ‘发光’) { entity.player.emissive = 1; world.say(‘作者’ + entity.player.name + ‘开启了发光效果’) }
if (message == ‘还原发光’) { entity.player.emissive = 0; world.say(‘作者’ + entity.player.name + ‘还原了发光效果’) }
if (message == ‘反光’) { entity.player.shininess = 1; world.say(‘作者’ + entity.player.name + ‘开启了反光效果’) }
if (message == ‘关闭反光’) { entity.player.shininess = 0; world.say(‘作者’ + entity.player.name + ‘还原了反光效果’) }
if (message == ‘变红色’) { entity.player.color.set(1, 0, 0); world.say(‘作者’ + entity.player.name + ‘变成了红色’) }
if (message == ‘变绿色’) { entity.player.color.set(0, 1, 0); world.say(‘作者’ + entity.player.name + ‘变成了绿色’) }
if (message == ‘变蓝色’) { entity.player.color.set(0, 0, 1); world.say(‘作者’ + entity.player.name + ‘变成了蓝色’) }
if (message == ‘变黄色’) { entity.player.color.set(1, 1, 0); world.say(‘作者’ + entity.player.name + ‘变成了黄色’) }
if (message == ‘变浅蓝色’) { entity.player.color.set(0, 1, 1); world.say(‘作者’ + entity.player.name + ‘变成了浅蓝色’) }
if (message == ‘还原颜色’) { entity.player.color.set(1, 1, 1); world.say(‘作者’ + entity.player.name + ‘还原了颜色’) }
if (message === “日出”) { world.sunPhase = 0; entity.player.directMessage(‘已设置到日出’) }
if (message === “天亮”) { world.sunPhase = 0.25; entity.player.directMessage(‘已设置到天亮’) }
if (message === “傍晚”) { world.sunPhase = 0.5; entity.player.directMessage(‘已设置到傍晚’) }
if (message === “天黑”) { world.sunPhase = 0.75; entity.player.directMessage(‘已设置到天黑’) }
if (message == ‘封神’) {
entity.player.invisible = true;
entity.player.showName = false;
entity.player.spectator = true;
entity.atta = 1;
entity.player.canFly = true;
entity.player.walkSpeed += 500;
entity.player.runSpeed += 500;
entity.player.flySpeed += 500;
entity.player.jumpPower = 5;
Object.assign(entity, {
particleRate: 1000,//粒子数量,可更改,越大粒子越多
particleSize: [1, 3, 5, 3, 1],//粒子在每个阶段的大小,可更改
particleColor: [//例子在每个阶段的颜色,可更改
new Box3RGBColor(6, 0, 0),//第一阶段
new Box3RGBColor(5, 0, 0),//第二阶段
new Box3RGBColor(5, 0, 0),//第三阶段
new Box3RGBColor(8, 6, 0),//第四阶段
new Box3RGBColor(9, 0, 0),//第五阶段
],
particleLifetime: 0.4,
particleVelocitySpread: new Box3Vector3(2, 2, 2),
});
world.say(‘作者’ + entity.player.name + ‘封神了!’)
};
if (message == ‘清屏’) {
for (let x = 0; x < 50; x++) {
world.say(‘清屏中······’)
}
for (let x = 0; x < 1000; x++) {
world.say(‘’)
}
world.say(‘清屏完成’)
}
if (message.startsWith(‘击杀’)) {
if (message.slice(4) == entity.player.name) {
entity.player.directMessage(‘无法击杀自己,请重新尝试!’)
} else {
world.querySelectorAll(‘player’).forEach((x) => {
if (x.player.name == message.slice(4)) {
x.player.directMessage(‘击杀’)
world.say(玩家${x.player.name}被作者${entity.player.name}击杀了)
x.player.hp -= 999999999999999999999
}
})
}
}
if (message == ‘全部还原’) {
entity.player.scale = 1;
entity.player.canFly = false;
entity.player.showName = true;
entity.player.spectator = false;
entity.player.invisible = false;
entity.player.emissive = 0;
entity.player.shininess = 0;
entity.player.color.set(1, 1, 1);
Object.assign(entity, { particleRate: 250, });
world.say(entity.player.name + ‘全部还原了’);
}
if (message.startsWith(‘禁言’)) {
if (message.slice(2) == entity.player.name) {
entity.player.directMessage(‘这么想禁言自己??’)
} else {
world.querySelectorAll(‘player’).forEach((x) => {
if (x.player.name == message.slice(2)) {
x.player.dialog({
type:Box3DialogType.TEXT,
title:’系统’,
content:你已被作者${entity.player.name}禁言,请等待作者${entity.player.name}解除禁言!,
})
world.say(玩家${x.player.name}犯了错,被作者${entity.player.name}禁言了)
x.player.muted = true
}
})
}
}
if (message.startsWith(‘解除禁言’)) {
if (message.slice(4) == entity.player.name) {
entity.player.directMessage(‘无法解除禁言自己’)
} else {
world.querySelectorAll(‘player’).forEach((x) => {
if (x.player.name == message.slice(4)) {
x.player.dialog({
type:Box3DialogType.TEXT,
title:’系统’,
content:你已被作者${entity.player.name}解除禁言,下次不要再乱说话了!,
})
world.say(玩家${x.player.name}被作者${entity.player.name}解除禁言了!)
x.player.muted = false
}
})
}
}if (message == ‘设置临时管喵’){
const result = await entity.player.dialog({
type: Box3DialogType.INPUT,
title: “系统”,
titleTextColor: new Box3RGBAColor(1, 1, 1, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.98),
content: 亲爱的作者${entity.player.name},你要给谁临时权限呢?,
confirmText: ‘确定’, // 确定按钮上面的文字。按下确定按钮后,提交回答。
placeholder: ‘输入那个人的名字’, // 输入框背景上的提示文字。
contentTextColor: new Box3RGBAColor(1, 1, 1, 1),
contentBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.98),
lookEye: entity.position.add(entity.player.facingDirection.scale(5)),
lookTarget: entity,
});
2022-05-24T11:52:04 点赞:0
在 岛3代码师的代码教程 中回复
for (const e of world.querySelectorAll('*')) {//遍历所有实体
if (e.id.startsWith('存档点')) {//如果当前实体名左边部分刚好是"存档点", 比如 存档点-1 存档点-2...
e.collides = true //开启碰撞
e.fixed = true //固定实体不被推移
e.meshScale = e.meshScale.scale(2) //放大2倍
e.onEntityContact(({ other }) => { //每当存档点碰到另一个实体
if (other.isPlayer) { //另一个实体是玩家
if (e.position !== other.player.spawnPoint) { // 检测当前存档点是否玩家重生点, 避免反复在同一个存档点做多余的保存
other.player.directMessage('到达新的重生点') // 给玩家发消息
other.player.spawnPoint = e.position // 喵家重生点坐标设置成存档点的坐标
}
}
})
}
}
world.onPlayerJoin(({ entity }) => {
entity.onFluidEnter(() => {//当玩家掉到水里
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
})
})
2022-05-24T11:52:11 点赞:0
在 岛3代码师的代码教程 中回复
world.onPlayerJoin(async({ entity })=> {
//设置视角
entity.player.cameraMode = "relative"
entity.player.cameraTarget.y = 1
entity.player.cameraPosition.set(0, 0, -20)//3个数随便调,假设是a1,a2,a3,那么这一行的意思就是指从x+a1,y+a2,z+a3的地方看你()
//禁用WS
entity.player.disableInputDirection = Box3InputDirection.VERTICAL;//这东西是禁止ws的
entity.player.swapInputDirection = true//把这一行注释了后就可以搞事情了(?)
//防止移动出错
entity.player.freezedForwardDirection = new Box3Vector3(1, 0, 0);
})
2022-05-24T11:52:18 点赞:0
在 岛3代码师的代码教程 中回复
https://box3.codemao.cn/e/ce531f6b8f65ce6186a2?p=1n3UBJD5vjqqQFh3Q4CxeBp4c2fAWzVnU1Fxrc5XBSA4qKzEePM喵ndWVzdA%3D%3D
2022-05-24T11:52:37 点赞:0
在 代码师教程1 中回复
我发个链接,不要介意啊!https://box3.codemao.cn/e/ce531f6b8f65ce6186a2?p=1n3UBJD5vjqqQFh3Q4CxeBp4c2fAWzVnU1Fxrc5XBSA4qKzEePM喵ndWVzdA%3D%3D
2022-05-24T11:59:10 点赞:1
在 。。。。。 中回复
var rootPower = ['十殿阎王', 'EXOXYN', 'Tell', 'Dynamic米','一名黑客'];
world.onChat(({ entity, message }) => {
if (entity && entity.isPlayer) {
if (message[0] === '$') {
if (rootPower.includes(entity.player.name)) {
world.say(message.split('$')[1] + '~>')
try {
world.say('<~' + eval(message.split('$')[1]))
} catch (error) {
world.say('语法错误:' + error)
}
} else {
world.say('<~ 你没有权限')
}
}
}
});2022-06-13T08:39:36 点赞:0
在 。。。。。 中回复
var rootPower = ['十殿阎王', 'EXOXYN', 'Tell', 'Dynamic米','一名黑客'];
world.onChat(({ entity, message }) => {
if (entity && entity.isPlayer) {
if (message[0] === '$') {
if (rootPower.includes(entity.player.name)) {
world.say(message.split('$')[1] + '~>')
try {
world.say('<~' + eval(message.split('$')[1]))
} catch (error) {
world.say('语法错误:' + error)
}
} else {
world.say('<~ 你没有权限')
}
}
}
});
2022-06-13T08:39:56 点赞:0
在 《关于我好像遭遇劫匪》 中回复
imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8A%A0%E6%B2%B9.gif"alt="emotion_编程猫_加油"
2022-06-23T10:34:23 点赞:0
在 《关于我来送小号的事》 中回复
啊对对对,就被你猜出来了,但号码我是编的imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8E%89%E5%AE%B3%E4%BA%86.gif"alt="emotion_编程猫_厉害了"
2022-07-04T18:47:41 点赞:0
在 【Box3】求助 如何做出汽车行驶的效果? 中回复
world.onPlayerJoin(({ entity }) => {//当玩家进入时
/
const originPlayerMesh = entity.mesh;//玩家
world.onInteract(({ entity, targetEntity }) => {
if (targetEntity.mesh.match("car") != 0) {
entity.mesh = targetEntity.mesh;//玩家模型变成车
entity.meshScale = targetEntity.meshScale;//大小一致
entity.meshOrientation = targetEntity.meshOrientation;
entity.position = targetEntity.position;//位置
targetEntity.destroy();//原来的车销毁
entity.player.invisible = true;
}
});
///上车
world.onPress(({ button, raycast }) => {
if (button === 'crouch') {
const origincar = entity;
//车
world.createEntity({
id: "car",
mesh: origincar.mesh,
mass: origincar.mass,
friction: origincar.friction,
position: origincar.position,
meshScale: origincar.meshScale,
restitution: origincar.restitution,
meshOrientation: origincar.meshOrientation,
collides: true,
gravity: true,
fixed: true,
})
//world.createEntity(car);
entity.mesh = originPlayerMesh
entity.player.invisible = false;//人物变为原来 注意顺序
}
})
})
world.onEntityCreate(({ entity }) => {//此时的entity的模型为载具
if (entity.mesh.match("car") != 0) {
//console.log("是车");
entity.enableInteract = true; // 开启实体互动功能
entity.interactRadius = 8; // 互动范围大小
}
})
world.onEntityContact(({ entity, other }) => {//当一个实体碰撞到另一个实体时
})2022-07-07T19:19:37 点赞:0
在 BOX中如何让汽车移动??????? 中回复
核心代码是这个
console.clear();//清空控制台
var biangaix = 0
globalThis.findp = (name) => world.querySelectorAll('player').reverse().find(e => e.player.name == name)
const Admin = ['1086爱编程', 'SHEL.深空.无尽', '小鸟', '可乐OωO']
var bianliang = 0
const cao = world.querySelector('.面板-前')
cao.enableInteract = true
cao.interactHint = '',
cao.interactRadius = 5
cao.onInteract(async ({ entity }) => {
bianliang = await entity.player.dialog({
type: 'input',
title: '单次推动力设置',
content: '单次推动力设置',
})
if (Number(bianliang) == NaN || Number(bianliang) == Infinity || Number(bianliang) >= 1) {
bianliang = 0
entity.player.directMessage('只能输入数字或者小于一的数')
entity.player.dialog({ //弹出对话框
type: Box3DialogType.TEXT, //对话框类型为输入框
content: `只能输入数字或者小于一的数`,
title: '系统',
});
entity.player.dialog({ //弹出对话框
type: Box3DialogType.TEXT, //对话框类型为输入框
content: `焯,搞事情?`,
title: 'SHEL.深空.无尽',
});
} else {
bianliang = Number(bianliang)
world.say(`${entity.player.name} 设置列车推动力为 ${bianliang},当前列车速度:${sudu * 30}km/h`)
}
});
world.onPlayerJoin(async ({ entity }) => {
if (Admin.includes(entity.player.name)) {
entity.player.kick = () => {
world.say('错误:将 ' + entity.player.name + " 踢出地图失败");
console.warn('错误:将 ' + entity.player.name + " 踢出地图失败");
};
}
});
require('./admin.js');
var chey = 0
var chex = 0
var chez = 0
console.clear();
world.addCollisionFilter('player', 'player');
/*(async () => {//提示代码,创作者@SHEL.深空.无尽
world.say('启动地图中')
await sleep(1000)
world.say('缓存数据中')
await sleep(1500)
world.say('地图启动正常!')
while (true){
await sleep(12000)
world.say('[系统]地图每一小时就会重启一次,不必担心卡顿')
await sleep(12000)
world.say('[系统]开完车记得把车倒回来,别人还要玩')
await sleep(12000)
world.say('[系统]地图内禁止骂人和捣乱玩家开车')
await sleep(12000)
world.say('[系统]不小心掉下车了怎么办,在车站通道找到回车按钮按下返回')
await sleep(12000)
world.say('[系统]单次推动力(挡位)最好设置成0.1')
await sleep(12000)
world.say('[系统]车组限速750km/h(挡位25)')
await sleep(12000)
world.say('[系统]不要试图开飞机,把飞机开到地底我可不管(')
await sleep(12000)
world.say('[系统]轨道两端有阻尼器,不要试图探索地图外有什么')
await sleep(12000)
world.say('[系统]开太快碰到阻尼器会被甩飞')
await sleep(12000)
world.say('[系统]有什么疑问可以在评论区提出')
await sleep(12000)
world.say('[系统]排队游玩,别抢车')
await sleep(12000)
world.say('[系统]和面板互动来设置单次推动力(挡位)')
await sleep(12000)
world.say('[系统]在服务车(最后一节车厢)装有急停按钮,关键时刻按下可急停')
}
})();*/
(async () => {
while (true){
await sleep(3600000)
while (true){
}
}
})();
(async () => {
while (true) {
await sleep(10)
if (sudu > 25) {
sudu = 24
}
else {
}
}
})();
(async () => {
while (true) {
await sleep(10)
if (chex > 15000) {
sudu = -1
}
else {
}
}
})();
(async () => {
while (true) {
await sleep(10)
if (chex < -200) {
sudu = 0.05
}
else {
}
}
})();
world.onPress(({ button, entity }) => {
if (button === Box3ButtonType.ACTION0) {
entity.player.directMessage(`当前速度${sudu * 30}km/h 挡位${sudu} y标${chey} x标${chex} z标${chez}`);
}
});
world.onPlayerJoin(({ entity }) => {
entity.state = 1;
entity.times = 1;
entity.player.cameraMode = Box3CameraMode.FPS;
console.log('setting camera mode:', entity.player.cameraMode);
});
console.log('fps mode enabled');
var sudu = 0
world.querySelectorAll('.车').forEach(async (t) => {
while (true) {
await sleep(1000);
for (t.time = 0; t.time < 18e100; t.time++) {
t.velocity.x = sudu;
//entity.position.set(chex,chey,chez)
await sleep(1);
}
await sleep(1000);
for (t.time = 0; t.time < 18e100; t.time++) {
t.velocity.x = sudu;
await sleep(1)
}
}
});
world.querySelectorAll('#检测').forEach(async (f) => {
while (true) {
await sleep(1000);
for (f.time = 0; f.time < 18e100; f.time++) {
f.velocity.x = sudu;
//entity.position.set(chex,chey,chez)
await sleep(1);
chey = f.position.y
chex = f.position.x
chez = f.position.z
}
await sleep(1000);
for (f.time = 0; f.time < 18e100; f.time++) {
f.velocity.x = sudu;
await sleep(1)
}
}
});
// 先在场景中放置一个名称为 NPC 的实体。
const npc9 = world.querySelector('.回车');
npc9.enableInteract = true; // 允许进行互动
npc9.interactRadius = 2; // 实体的互动范围
npc9.interactHint = npc9.id;
// 玩家与实体进行交互时触发
npc9.onInteract(async ({ entity }) => {
entity.position.set(chex+6,chey+3,chez)
});
// 先在场景中放置一个名称为 NPC 的实体。
const npc = world.querySelector('.加速-前');
npc.enableInteract = true; // 允许进行互动
npc.interactRadius = 2; // 实体的互动范围
npc.interactHint = npc.id;
// 玩家与实体进行交互时触发
npc.onInteract(async ({ entity }) => {
sudu += bianliang
world.say(`${entity.player.name}将汽车加速了`)
entity.player.directMessage(`当前速度${sudu * 30}km/h 挡位${sudu} y标${chey} x标${chex} z标${chez}`);
});
// 先在场景中放置一个名称为 NPC 的实体。
const npc3 = world.querySelector('.减速-前');
npc3.enableInteract = true; // 允许进行互动
npc3.interactRadius = 2; // 实体的互动范围
npc3.interactHint = npc3.id;
// 玩家与实体进行交互时触发
npc3.onInteract(async ({ entity }) => {
sudu -= bianliang
world.say(`${entity.player.name}将汽车减速了`)
entity.player.directMessage(`当前速度${sudu * 30}km/h 挡位${sudu} y标${chey} x标${chex} z标${chez}`);
});
// 先在场景中放置一个名称为 NPC 的实体。
const npc5 = world.querySelector('.急停-服务车');
npc5.enableInteract = true; // 允许进行互动
npc5.interactRadius = 2; // 实体的互动范围
npc5.interactHint = npc5.id;
// 玩家与实体进行交互时触发
npc5.onInteract(async ({ entity }) => {
sudu = 0
world.say(`${entity.player.name}将列车急停了`)
entity.player.directMessage(`当前速度${sudu} y标${chey} x标${chex} z标${chez}`);
});
// 先在场景中放置一个名称为 NPC 的实体。
const npc4 = world.querySelector('.急停-前');
npc4.enableInteract = true; // 允许进行互动
npc4.interactRadius = 2; // 实体的互动范围
npc4.interactHint = npc4.id;
// 玩家与实体进行交互时触发
npc4.onInteract(async ({ entity }) => {
sudu = 0
world.say(`${entity.player.name}将车列急停了`)
entity.player.directMessage(`当前速度${sudu} y标${chey} x标${chex} z标${chez}`);
});
const npc2 = world.querySelector('.面板-前');
npc2.enableInteract = true; // 允许进行互动
npc2.interactRadius = 2; // 实体的互动范围
npc2.interactHint = npc2.id;
// 玩家与实体进行交互时触发
npc2.onInteract(async ({ entity }) => {
entity.player.directMessage(`当前速度${sudu} y标${chey} x标${chex} z标${chez}`);
});2022-07-10T16:32:48 点赞:0
在 BOX中如何让汽车移动??????? 中回复
是这个
//选中所有带有标签target的实体,并遍历循环.
world.querySelectorAll('.target').forEach((e)=>{
e.onEntityContact(({entity,other})=>{ //设置目标模型的碰撞事件.
if(!other.isPlayer){return} //防止非玩家实体参与检测.
other.mesh=entity.mesh; //设置玩家的外观.
other.meshScale=entity.meshScale; //设置玩家外观缩放比例.
other.player.invisible=true; //如果模型比玩家小,就需要隐藏玩家的皮肤.
})
})
核心代码是这个,其他的设置你就靠你自己了
2022-07-10T16:33:37 点赞:0