How to Display Enemy Icons Every Time a Projectile Hits Them Without Gaining MP

maxman

Well-known member
I use either shoot or shooter function to shoot enemies and it's fine when players' MP gains. However, I need something to not allow their MP gain as an exception. I'd like to make it act like shooter when it shows enemy icons every time it hits except the MP gain. How can I do it?

C:
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 self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   void vShot;
   int Dx = Vx;

   if (Direction == 0){ //Is entity facing left?                 
      Dx = -Dx; //Reverse Dx direction to match facing
   }

   vShot = shoot(Shot, dx, dy, dz);
   changeentityproperty(vShot, "velocity", Dx, Vz, Vy);
   changeentityproperty(vShot, "speed", Vx);
}

Code:
anim freespecial #POWER WAVE
    offset 140 188
    delay 6
    bbox 114 89 51 98
    load powave
    sound data/sounds/heroes/terry/06_terry_00010.wav
    frame data/chars/heroes/Terry/148_0.png
    frame data/chars/heroes/Terry/148_1.png
    frame data/chars/heroes/Terry/148_2.png
    frame data/chars/heroes/Terry/148_3.png
    delay 3
    bbox 114 107 51 81
    frame data/chars/heroes/Terry/148_4.png
    bbox 116 120 64 71
    frame data/chars/heroes/Terry/148_4.png
    delay 6
    @cmd shooter "powave" 51 0 0 2 0 0
    bbox 131 120 53 71
    frame data/chars/heroes/Terry/148_5.png
    frame data/chars/heroes/Terry/148_6.png
    frame data/chars/heroes/Terry/148_7.png
    frame data/chars/heroes/Terry/148_8.png
    frame data/chars/heroes/Terry/148_9.png
    frame data/chars/heroes/Terry/148_10.png
    frame data/chars/heroes/Terry/148_11.png
    bbox 123 124 54 64
    frame data/chars/heroes/Terry/148_12.png

 
Yes, I am using typemp 1.

I declared didhitscript to try to cancel MP gain with mpset (not declared in the header, but didhitscript), but it doesn't cancel it.

Code:
name powave #Power Wave
health 0
type pshot
remove 1
#nolife 1
speed 20
gfxshadow 1
#candamage enemy obstacle
didhitscript @script
void main(){
 void self = getlocalvar("self");
 changeentityproperty(self, "mpset",NULL(),NULL(),NULL(),0,NULL(),NULL());
 //mpset - mp, stable type, stable, recovery rate, drop rate, charge rate
}
@end_script

anim idle

    offset 122 195
    delay 6
    loop 1 1
    attack9 116 157 44 39 12 0 0 0 0 0
    followanim 1
    followcond 2
    #jumpframe 0 0 3 0
    sound data/sounds/heroes/terry/06_terry_00026.wav
    frame data/chars/heroes/Terry/effects/902_0.png
    attack9 116 157 44 39 12 0 0 0 0 0
    frame data/chars/heroes/Terry/effects/902_1.png
    frame data/chars/heroes/Terry/effects/902_2.png
    frame data/chars/heroes/Terry/effects/902_3.png
    frame data/chars/heroes/Terry/effects/902_4.png
    frame data/chars/heroes/Terry/effects/902_5.png
    frame data/chars/heroes/Terry/effects/902_0.png

anim follow1
    delay 2
    offset 1 1
    frame data/chars/misc/empty.gif
    move 10000
    frame data/chars/misc/empty.gif
 
I mean didhitscript should deduct the gained mp from each hit.
It's supposed to, but it doesn't deduct it. It just gains no matter I try to use didhitscript. Even when I use shooter2, it doesn't gain MP at all, which is a good thing, but it doesn't display the enemy icons every time a projectile attacks enemies.

C:
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);
//   changeentityproperty(vSpawn, "speed", Vx);
//   changeentityproperty(vSpawn, "owner", self);
   return vSpawn;
}

Code:
anim freespecial23 #POWER WAVE 2
    offset 140 188
    delay 6
    bbox 114 89 51 98
    sound data/sounds/heroes/terry/06_terry_00010.wav
    frame data/chars/heroes/Terry/148_0.png
    frame data/chars/heroes/Terry/148_1.png
    frame data/chars/heroes/Terry/148_2.png
    frame data/chars/heroes/Terry/148_3.png
    delay 3
    bbox 114 107 51 81
    frame data/chars/heroes/Terry/148_4.png
    bbox 116 120 64 71
    frame data/chars/heroes/Terry/148_4.png
    delay 6
    @cmd shooter2 "powave" 51 0 0 3 0 0
    #@cmd shoot "powave" 51 0 0
    bbox 131 120 53 71
    frame data/chars/heroes/Terry/148_5.png
    frame data/chars/heroes/Terry/148_6.png
    frame data/chars/heroes/Terry/148_7.png
    frame data/chars/heroes/Terry/148_8.png
    frame data/chars/heroes/Terry/148_9.png
    frame data/chars/heroes/Terry/148_10.png
    frame data/chars/heroes/Terry/148_11.png
    bbox 123 124 54 64
    frame data/chars/heroes/Terry/148_12.png

- shooter lets the enemy icon show every time a projectile hit and it still gains MP as usual. However, using it with didhitscript doesn't work.
- shooter2 doesn't show enemy icon and gain MP at all.

I'm not using mprate for it at all. Do I need to use mprate for this?
 
Back
Top Bottom