Different blood color / hitflashes for different enemies?

MysticalMist

Active member
I was wondering how you could efficiently program or set up hitflashes / blood to where when an certain enemy is hit, they bleed blue or green for example, instead of red like another enemy would. I reckon that's where pain animations could come in but it admittedly feels overwhelming to do.

I know that there's noatflash, but I feel like there would be times where the attackers' flash would be needed (ex: for a energy projectile or a punch instead of a slice or hit that warrants blood loss).

Any examples or advice out there regarding that?
 
@MysticalMist

i have been wondering the same , especially since the module i work on has a Stone golem character that should not bleed and a couple of Metal Armors, in the original game the golem would have dust flying and a "punched stone" sound, and the Armors had sparks and a "clanky" noise when hit.

now that i thnk about it ,the last boss might need his own custom blood and hitflashes...

eventually i would like to add more monsters that bleed green or purple, so this either means directly editing each pain animation texts or soem kind of script that tells the flash entities to change model if they are genereated by a certain entity...
 
Howdy, I don't know exactly how your blood is made, so this script may not work for you. However, I came up with something like this.
The script itself is really simple, and all it does is spawning blood in the enemy's position, and change the color of that blood.
The command itself looks as follows:

C++:
@cmd Blood BLOOD_NAME BLOOD_COLOR X Y

So as you can see, first you have to give the program the name of your blood.
Because I don't know if you use different blood appearances or just the same one for all enemies.
Nevertheless, I decided to add such an option.
Next, you need to define the color of the blood. Because the script changes the color by manipulating the map value.
You need to add more color palettes to your blood entity first.
Finally, you can change the position of the spawned blood. If you see that your blood appears weird and too much on the right side, for example.
Then you can just add, for example, -50 and move it more to the enemy.
Okay, now about the script. It presents itself as follows:

Code:
#define BLOOD1 "..."
#define BLOOD2 "..."
#define BLOOD3 "..."

#define RED 0
#define BLUE 1
#define GREEN 2

void Blood(void Name, int Color, int NewX, int NewY)
{
    void Self = getlocalvar("self");
    int X = getentityproperty(Self, "x");
    int Z = getentityproperty(Self, "z");
    
    void vSpawn;

    clearspawnentry();
    loadmodel(Name);
    setspawnentry("name", Name);
    setspawnentry("map", Color);
    
    vSpawn = spawn();
    
    changeentityproperty(vSpawn, "position", X + NewX, Z + NewY, 0);
    
    return vSpawn;
    
    spawn();
}

As you can see, I have added some #define variables. The only change to be made here is to add the blood name after #define BLOOD{#}.
This way you don't have to tell the program the name of the blood in your enemy file, but you can just use #define name. For example, BLOOD1, BLOOD2, etc.
Also, don't forget to kill your blood after it is spawned. You can put @cmd killentity getlocalvar("self") at the end of the animation to kill it.

I hope It will help you :)
 
@danno and @RedEye Samurai

here is the only thing i dislike about spawning things on the animation itself, if im not mistaken the hitflashes are little bit adaptive, the "sparks" are generated depending on where the attack box and the hit boxes meet, so if a kick connects on an area where a shoulder is, it makes no sense to see teeth flying,
this problem is kinda itself resolved if a character's pain animations are different depending on the area where the body was hit
example, a pain animation that only happens if the area that is hit it the head...

unfortunately on the module i work on , different pain animations seem to be related only to attack intensity and not to areas hit, but the current hit flashes at least have a good level of accuracy in relation to the area affected.
because of this i was thinking of spawning the different blood using the hitflash itself as the origin, teeth and other stuff will probably only be spawned on the animation itself but only if relates to the type of common reaction and if it is even possible to differentiate damage to the head from damage to the torso....

another issue is the sound of the punches connecting, the module might need an entire overhaul of how the sound works , because the original game had clear different sound for hitting metal vs hitting flesh...
 
My solution to special flash effects is the same as hitfx. Let the flash do the work.

I still have flash entities, and a few unique models for different effects, but inside them are scripts that adapt the flash as needed.

This lets OpenBOR take care of position and boilerplate spawn work, and my scripts can handle things from there.

@danno's is still on point for what he does though. For stuff like teeth flying, you need to take manual control of the position. If I were to do anything different, it would be setting up offsets as a constant in the model my teeth script could read. Then could put the teeth spawn in an event instead of @cmd.

DC
 
Back
Top Bottom