Solved How to get Enemy throwing Multiple arrows?

Question that is answered or resolved.

machok

Well-known member
Sorry noob question here
how to get the enemy to throw arrows 3 times in a row?

Code:
anim    attack1
    range    10 288
    loop    0
    delay    8
    offset    89 178
    bbox    70 100 40 78
    throwframewait    0
    custknife    arrow+
    throwframe    2 110
    frame    data/chars/belger/a1.gif
    sound    data/sounds/arrow.wav
    frame    data/chars/belger/a2.gif
    delay    20
    frame    data/chars/belger/a1.gif

Code:
name     arrow+
health   1
type    pshot
shootnum  3
remove   1
speed    18
noquake  1
bounce   1
nodieblink  2
flash   flash3
noatflash 1

This one only 1 arrow at a time no matter where I edit
 
Solution
I've got something like this in my Way of Martial Arts game using shooter 2 script :

Code:
void shooter2(void Shot, float dx, float dy, float Vx, float Vy)
{ // Shooting special projectile with speed control
   void self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   void vShot;

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

   vShot = spawn01(Shot, dx, dy, 0);
   changeentityproperty(vShot, "velocity", Vx, 0, Vy);
   changeentityproperty(vShot, "owner", self);
   return vShot;
}

An example on how it's set ingame :
Code:
anim    jumpattack #Static Jump Throw
    fastattack    1
    jugglecost    5
    delay    6
    offset...
You need to use script if you want to have entity shooting arrows/anything more than once in an animation.
You can use this function:
Care to explain more about how to properly use this function?

Code:
projectile(char *name, float x, float z, float a, int direction, int type, int ptype, int map);
~name is projectile's name. For above example, it's "Bullet" (with ").
~x, z and a are starting coordinate for the projectile. x is relative to leftmost level edge, z is relative to 0 and a is relative to ground.
~direction is facing direction of the projectile.
~type is only used if no name is provided and NULL is used instead. 0 for knife or 1 for shot.
~ptype specifies what kind of projectile is fired. 0 for knife or 1 for bomb.
~map specifies if fired projectile copies thrower's remap or not. 0 means it use it's own map while 1 means it use thrower's remap.
~The function itself returns the projectile entity which can be used for many things such as altering speed.


so I don't know exactly what to write here so that the arrow will be fired 3 times
what I'm doing right now is like this and the result are accurate but is this really what you mean?
Code:
anim    attack1
    range    10 288
    loop    0
    delay    8
    offset    89 178
    bbox    70 100 40 78
    throwframewait    0
    custknife    arrow+
    throwframe    2 110
    @cmd    projectile 1 "arrow+" 78 2 110 1 1 0 0
    frame    data/chars/belger/a1.gif
    sound    data/sounds/arrow.wav
    frame    data/chars/belger/a2.gif
    delay    20
    @cmd    projectile 1 "arrow" 78 2 110 1 1 0 0
    frame    data/chars/belger/a1.gif

*Arrow without plus is knockdown attack
 
I've got something like this in my Way of Martial Arts game using shooter 2 script :

Code:
void shooter2(void Shot, float dx, float dy, float Vx, float Vy)
{ // Shooting special projectile with speed control
   void self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   void vShot;

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

   vShot = spawn01(Shot, dx, dy, 0);
   changeentityproperty(vShot, "velocity", Vx, 0, Vy);
   changeentityproperty(vShot, "owner", self);
   return vShot;
}

An example on how it's set ingame :
Code:
anim    jumpattack #Static Jump Throw
    fastattack    1
    jugglecost    5
    delay    6
    offset    86 104
    bbox    68 0 29 67
    cancel    0 5 0 a2 freespecial3
    sound    data/sounds/jumppunch.wav
    hitflash  blood
    frame    data/chars/ninjutsu/shuriken/Jumppunch.gif
    @cmd    aniLimit "ANI_FOLLOW3" 0 20
    frame    data/chars/ninjutsu/shuriken/Jumppunch.gif
    delay    12
    bbox    58 13 40 48
    attack1 12 62 120 30 5 1 1 1 0 0
    forcedirection    -1
    frame    data/chars/ninjutsu/shuriken/Jumppunch1.gif
    delay    20
    @cmd    mpcost 20
    @cmd    shooter2 "shurikenD" 17 25 2 -3
    frame    data/chars/ninjutsu/Jumppunch1.gif
    attack1 0 0 0 0 0 0 0 0 0 0
    bbox    68 0 29 67
    frame    data/chars/ninjutsu/shuriken/Jumppunch.gif
 
Solution
@kimono
At first I didn't expect it to be this difficult but it turned out to be quite challenging to do since we have to think about all the delays, x-y coords of each frame if I want to shoot arrows in sequence and especially with a diagonal position but I've managed to do it
so thank you so much for your help
 
Back
Top Bottom