This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
How do I set it so that if I spawn an arrow entity it will launch and not just drop?
Quote from Joel2782» How do I set it so that if I spawn an arrow entity it will launch and not just drop?
If modpe,here you go:
function shoot(damage){
var Dir = rot(getYaw(), getPitch());
var arrow = Level.spawnMob(getPlayerX() + (Dir.x * 2), getPlayerY() + (Dir.y * 2), getPlayerZ() + (Dir.z * 2), 80);
setVelX(arrow, Dir.x * damage);
setVelY(arrow, Dir.y * damage);
setVelZ(arrow, Dir.z * damage);
}
function rot(yaw, pitch){
var direction = new Vel(0, 0, 0);
direction.y = -Math.sin(java.lang.Math.toRadians(pitch));
direction.x = -Math.sin(java.lang.Math.toRadians(yaw)) * Math.cos(java.lang.Math.toRadians(pitch));
direction.z = Math.cos(java.lang.Math.toRadians (yaw)) * Math.cos(java.lang.Math.toRadians(pitch));
return direction;
function Vel(x, y, z){
this.x = x;
this.y = y;
this.z = z;
When you use it,you do shoot(damage); like
shoot(100);//This shoot a 200 damage arrow(the damage you want÷2 is the number you write in the bracket)
How do I set it so that if I spawn an arrow entity it will launch and not just drop?
If modpe,here you go:
function shoot(damage){
var Dir = rot(getYaw(), getPitch());
var arrow = Level.spawnMob(getPlayerX() + (Dir.x * 2), getPlayerY() + (Dir.y * 2), getPlayerZ() + (Dir.z * 2), 80);
setVelX(arrow, Dir.x * damage);
setVelY(arrow, Dir.y * damage);
setVelZ(arrow, Dir.z * damage);
}
function rot(yaw, pitch){
var direction = new Vel(0, 0, 0);
direction.y = -Math.sin(java.lang.Math.toRadians(pitch));
direction.x = -Math.sin(java.lang.Math.toRadians(yaw)) * Math.cos(java.lang.Math.toRadians(pitch));
direction.z = Math.cos(java.lang.Math.toRadians (yaw)) * Math.cos(java.lang.Math.toRadians(pitch));
return direction;
}
function Vel(x, y, z){
this.x = x;
this.y = y;
this.z = z;
}
When you use it,you do shoot(damage); like
shoot(100);//This shoot a 200 damage arrow(the damage you want÷2 is the number you write in the bracket)