Aerisetta
Active member
Im using shooter script to shoot bullets. I want to be able to shoot some projectile downwards but for some reason it does not work. It can shoot upwards though. Can anyone see what's wrong?
example
@cmd shooter "bullene2" 210 120 1 18 2 4 (goes up)
@cmd shooter "bullene2" 230 120 1 18 4 2 (goes up)
@cmd shooter "bullene2" 220 120 1 18 0 0 (stays horizontal, ok)
@cmd shooter "bullene2" 240 120 1 18 -5 -2 (stays horizontal, wrong)
@cmd shooter "bullene2" 200 120 1 18 -10 -(stays horizontal, wrong)
The script
The Bullet
example
@cmd shooter "bullene2" 210 120 1 18 2 4 (goes up)
@cmd shooter "bullene2" 230 120 1 18 4 2 (goes up)
@cmd shooter "bullene2" 220 120 1 18 0 0 (stays horizontal, ok)
@cmd shooter "bullene2" 240 120 1 18 -5 -2 (stays horizontal, wrong)
@cmd shooter "bullene2" 200 120 1 18 -10 -(stays horizontal, wrong)
The script
Code:
void shooter(void Shot, float dx, float dy, float dz, float Vx, float Vy, float Vz)
{ // Shooting projectile with speed control
void self = getlocalvar("self");
int Direction = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "a");
int z = getentityproperty(self, "z");
void vShot;
if (Direction == 0){ //Is entity facing left?
dx = -dx; //Reverse X direction to match facing
}
vShot = projectile(Shot, x+dx, z+dz, y+dy, Direction, 1, 0, 0);
changeentityproperty(vShot, "velocity", Vx, Vz, Vy);
changeentityproperty(vShot, "speed", Vx);
}
The Bullet
Code:
name bullene2
type none
health 1
speed 200
noquake 1
remove 0
nolife 1
lifespan 3
candamage enemy obstacle
offscreenkill 50
ondoattackscript data/scripts/variable_damage.c
animationscript data/scripts/player.c
anim idle
forcedirection -1
fastattack 1
loop 1
delay 3
offset 39 55
bbox 0 0 0 0
hitfx data/sounds/hitmarker2.wav
hitflash flash1
attack20 22 23 35 50 8 0 0 0 0 25
noreflect 1
@cmd aniRandom openborconstant("ANI_FOLLOW1")
frame data/chars/misc/bullets/bullet01.gif
anim follow1
fastattack 1
loop 1
delay 3
offset 39 55
bbox 0 0 0 0
drawmethod tintmode 4
drawmethod tintcolor 255_0_0
hitfx data/sounds/hitmarker2.wav
hitflash flash1
attack20 22 23 35 50 10 0 0 0 0 25
frame data/chars/misc/bullets/bullet04.gif