Solved enemies leaving after attack?

Question that is answered or resolved.
hello. I ask if is possible ,like happen in Tmnt 4 where a foot soldier came, throws a bomb or shoots an arrow and leaves,not being necessary defeat them to go to next screen or stage.
thanks.
 
ah, a striker.

You can make an animation for that attack and for the enemy to spawn into that animation:

spawn Putty_Bomber
@script void main() {
performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW11"));
} @end_script

coords -140 190 10
at 528

On my case, its the FOLLOW11 animation.

For that animation, you need to add this command on the last line, so the enemy will be killed in the end:

@cmd killentity getlocalvar("self")
frame data/scenes/conti/zero1.png

Also, I would set his HP to 1 on the spawn, so he will be killed (if) on a single hit.
 
I named this kind of enemies as strikers. Their actions are divided into 3 phases: enter, action and leave.
They could do anything in each phase. Usually they walk during Enter phase but they could jump in, fly in or teleport in. Same goes during Leave phase, they could redo what they do in Enter phase in opposite direction or do something different. They could anything during Action phase either attacking, shooting or tossing.

Here's an example of Gnoll Bowman Striker from Rise of Warduke:
Code:
anim    spawn
    loop    1 16 24
    delay    12
    offset  220 166
    bbox    203 111 32 57
    frame    data/chars/gnollb/wk00.gif # Enter phase
    @cmd    dasher 1.5 0 0
    frame    data/chars/gnollb/wk01.gif
    frame    data/chars/gnollb/wk02.gif
    frame    data/chars/gnollb/wk03.gif
    frame    data/chars/gnollb/wk04.gif
    frame    data/chars/gnollb/wk05.gif
    frame    data/chars/gnollb/wk06.gif
    frame    data/chars/gnollb/wk07.gif
    delay    10
    @cmd    dasher 0 0 0
    frame    data/chars/gnollb/idle00.gif # End of Enter phase
    delay    40
    frame    data/chars/gnollb/a101.gif # Action phase
    delay    8
    frame    data/chars/gnollb/a102.gif
    delay    30
    @cmd    shoot "ArrowE" 43 55 1
    sound    data/chars/gnollb/sounds/a1sw.wav
    frame    data/chars/gnollb/a103.gif
    delay    40
    frame    data/chars/gnollb/a101.gif
    delay    8
    frame    data/chars/gnollb/a102.gif
    delay    60
    @cmd    shoot "ArrowE" 43 55 1
    sound    data/chars/gnollb/sounds/a1sw.wav
    frame    data/chars/gnollb/a103.gif # End of Action phase
    delay    12
    @cmd    flip
    frame    data/chars/gnollb/wk00.gif # Leave phase
    @cmd    dasher 1.5 0 0
    frame    data/chars/gnollb/wk01.gif
    frame    data/chars/gnollb/wk02.gif
    frame    data/chars/gnollb/wk03.gif
    frame    data/chars/gnollb/wk04.gif
    frame    data/chars/gnollb/wk05.gif
    frame    data/chars/gnollb/wk06.gif
    frame    data/chars/gnollb/wk07.gif
    frame    data/chars/gnollb/wk00.gif
    frame    data/chars/gnollb/wk01.gif # End of Leave phase

This Gnoll walks in, shoots 2 arrows then leaves. To ensure this enemy is gone offscreen, it has offscreenkill 150 in its header.
It's possible not to use scripts to create strikers but it's recommended to use script.
 
Hello, I also wanted to try help with this problem.
I came up with a script that allows you to shoot the selected projectile, and also move the enemy from the scene after that.
If your enemies are already using sscript, you can just put both functions in the existing ones.

==--==--== Commands ==--==--==

The script itself have only two functions which are:

Code:
EndAnimation Direction Speed OffScreenKill Flip Animation

Direction - The direction in which enemy should be moving.
Speed - The speed of the moving enemy.
OffScreenKill - The position off screen the enemy need to be to be killed.
Flip - Which direction the sprite should facing when moving.
Animation - Define which animation should be run after this command.

Code:
Shoot Name NewX NewY

Name - The name of the projectile to shoot.
NewX - Variable which be sum with enemy position in X axis.
NewY - Variable which be sum with enemy position in Y axis.

==--==--== Script ==--==--==

In this script, you can use the "#define" command to define the names of the weapons you use in the game. If all enemies use the same weapon, you can get rid of that and add the name of your weapon in the script.

Code:
#define WEAPON1 weapon1
#define WEAPON2 weapon2
#define WEAPON3 weapon3

#define LEFT 0
#define RIGHT 1

void EndAnimation(int Direction, float Speed, int OffScreen, int Flip, void Animation)
{  
    void Self = getlocalvar("self");

    if(Direction == 0) Speed = -Speed;
   
    changeentityproperty(Self, "offscreenkill", OffScreen);
   
    changeentityproperty(Self, "facing", Flip);
   
    changeentityproperty(Self, "velocity", Speed, 0, 0);
   
    performattack(Self, openborconstant(Animation));
}

void Shoot(void Name, float NewX, float NewY)
{
    void Self = getlocalvar("self");
   
    int X = getentityproperty(Self, "x");
    int Y = getentityproperty(Self, "a");
    int Z = getentityproperty(Self, "z");
   
    int Direction = getentityproperty(Self, "direction");
   
    if(Direction == 0) NewX = -NewX;
 
    projectile(Name, X + NewX, Z, Y + NewY, Direction, 0, 0, 0);
}

==--==--== Implementation ==--==--==

First you need to add a shoot command and define the position of the projectile. Remember that the starting position are your enemy.
Next you need to add EndAnimation command that will tell your enemy in which direction and speed they should go.
The last thing you need to do is make an anim follow. It's only an animation that will appear after running the EndAnimation command.
For example you can make an anim follow1 with walking animation.

Code:
anim spawn
   
    loop    0
    offset    ... ...
   
    delay    20
   
    @cmd    Shoot WEAPON1 0 0

    frame    ...

    @cmd    EndAnimation RIGHT 1 100 RIGHT

    frame    ...

I hope it will help you :)
 
Back
Top Bottom