Thegr8test
Member
I'm not sure how to call this function in the players script when I try @cmd shooterm the game crashes, if I drop the m then the mod loads and runs fine but the projectile isn't mapped to the players map.
void shooterM(void Shot, float dx, float dy, float Vx, float Vy)
{ // Shooting special projectile with speed control and matches its map with own's map
void self = getlocalvar("self");
int map = getentityproperty(self,"map");
void Spawn;
Spawn = shooter(Shot, dx, dy, Vx, Vy);
changeentityproperty(Spawn, "map", map);
}
when I try @cmd shooterm the game crashes
name Blob1
health 10
nomove 1
type enemy
cantgrab 1
nodrop 2
death 1
nopain 1
nolife 1
offscreenkill 3000
diesound data/sounds/squish1.wav
animationscript data/scripts/lescript.c
takedamagescript data/scripts/blink.c
palette data/chars/blob/BLime.png
alternatepal data/chars/blob/Bblink.png
alternatepal data/chars/blob/BGreen.png
alternatepal data/chars/blob/BCyan.png
alternatepal data/chars/blob/BBlue.png
...
anim death
delay 30
offset 45 91
@cmd shooterM "Bub" -13 20 -1 2
@cmd shooterM "Bub" -13 40 -0.5 4
@cmd shooterM "Bub" 13 20 1 2
@cmd shooterM "Bub" 13 40 0.5 4
frame data/chars/misc/empty.gif
@cmd suicide
frame data/chars/misc/empty.gif
name Bub
type none
lifespan 3
subject_to_wall 0
subject_to_hole 1
no_adjust_base 0
subject_to_obstacle 0
subject_to_platform 0
palette data/chars/blob/BLime.png
alternatepal data/chars/blob/BBlink.png
alternatepal data/chars/blob/BGreen.png
alternatepal data/chars/blob/BCyan.png
alternatepal data/chars/blob/BBlue.png
anim idle
delay 800
offset 16 32
landframe 1
frame data/chars/blob/bub.png
delay 10
frame data/chars/misc/empty.gif
@cmd shooterM "plasma" 30 65 0 0
palette data/chars/Ironman/j2.png
alternatepal data/chars/Ironman/alt.png
alternatepal data/chars/Ironman/alt2.png
alternatepal data/chars/Ironman/alt3.png
...
void shoot(void Shot, float dx, float dy, float dz)
{ // Shooting projectile
void self = getlocalvar("self");
int Direction = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "a");
int z = getentityproperty(self, "z");
if (Direction == 0){ //Is entity facing left?
dx = -dx; //Reverse X direction to match facing
}
projectile(Shot, x+dx, z+dz, y+dy, Direction, 0, 0, 0);
}
void toss(void Bomb, float dx, float dy, float dz)
{ // Tossing bomb
void self = getlocalvar("self");
int Direction = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "a");
int z = getentityproperty(self, "z");
if (Direction == 0){ //Is entity facing left?
dx = -dx; //Reverse X direction to match facing
}
projectile(Bomb, x+dx, z+dz, y+dy, Direction, 0, 1, 0);
}
void hpcost( int HCost)
{// Spend some life
void self = getlocalvar("self");
void Life = getentityproperty(self,"health"); //get health
if (Life > HCost){ //Does the entity have enough health?
changeentityproperty(self, "health", Life-HCost);//consume health
}
}
void shoot(void Shot, float dx, float dy, float dz)
{ // Shooting projectile
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, 0, 0, 0);
return vShot;
}
...
void shooter(void Shot, float dx, float dy, float dz, float Vx, float Vy, float Vz)
{ // Shooting projectile with speed control
void vShot = shoot(Shot, dx, dy, dz);
changeentityproperty(vShot, "velocity", Vx, Vz, Vy);
changeentityproperty(vShot, "speed", Vx);
}
void shooter2(void vName, float fX, float fY, float fZ, float Vx, float Vy, float Vz)
{//Spawns projectile next to caller and move it with speed
//vName: Model name of entity to be spawned in
//fX: X location adjustment
//fY: Y location adjustment
//fZ: Z location adjustment
//Vx: X speed
//Vy: Y speed
//Vz: Z speed
void self = getlocalvar("self"); //Get calling entity
int Direction = getentityproperty(self, "direction");
void vSpawn; //Spawn object.
vSpawn = spawn01(vName, fX, fY, fZ); //Spawn in projectile
if (Direction == 0){ //Is entity facing left?
Vx = -Vx; //Reverse Vx direction to match facing
}
changeentityproperty(vSpawn, "velocity", Vx, Vz, Vy);
}
void shooterM(void Shot, float dx, float dy, float Vx, float Vy)
{ // Shooting special projectile with speed control and matches its map with own's map
void self = getlocalvar("self");
int map = getentityproperty(self,"map");
void Spawn;
Spawn = shooter(Shot, dx, dy, Vx, Vy);
changeentityproperty(Spawn, "map", map);
}
void shooterM(void Shot, float dx, float dy, float dz, float Vx, float Vy float Vz)
{ // Shooting special projectile with speed control and matches its map with own's map
void self = getlocalvar("self");
int map = getentityproperty(self,"map");
void Spawn;
Spawn = shooter(Shot, dx, dy, Vx, Vy);
changeentityproperty(Spawn, "map", map);
}
void shooter(void Shot, float dx, float dy, float dz, float Vx, float Vy, float Vz)
{ // Shooting projectile with speed control
void vShot = shoot(Shot, dx, dy, dz);
changeentityproperty(vShot, "velocity", Vx, Vz, Vy);
changeentityproperty(vShot, "speed", Vx);
return vShot;
}
@cmd shooterM "plasma" 30 65 1 0 0 0