Solved Hitspark spawning script? target/parent localvars?

Question that is answered or resolved.
Greetings, fellow developers!

I would like to know if, when a hitspark is spawned normally by the engine, it stores it's parent or target, and what  kind of script could be used to change  the  hitspark  behaviour based in these  local variables?

I'm interested in making hitsparks changing their animation based on the target that was hit (e.g.: metallic enemies spawning sparks when slashed, instead of blood spurs, or aliens spawning green blood instead of red blood).

I know that i could set custom pain animations for this, but this method doesn't spawn hitsparks where the attacks hit, and I would like to achieve this through alternative methods.
 
Solution
Paulo HP Bender said:
Greetings, fellow developers!

I would like to know if, when a hitspark is spawned normally by the engine, it stores it's parent or target, and what kind of script could be used to change the hitspark behaviour based in these local variables?

Paulo HP Bender,

Hit spark scripts are a fantastic way to code custom effects. Tip: Put hitsounds into the hitspark instead of using hitfx sound. However, in this particular case you're overthinking. This is one of those read the manual moments - the engine allows models to natively override an attack's hitspark with their own. No scripts required.

For scripting more advanced functionality, hit flashes have no relationship with anything. They're just ordinary models spawned as...
I was thinking the same thing, - it is true that you can give enemies a script for different color blood when hit - example , you can tkae nightslashers & give some zombies the ability to bleed green (it would take duplicating & modifiying the current blood files & script) to produce green blood, but how about sparks for when there is actual metal to metal contact like in Killer instinct Gold?

(see any fighting involving Tusk & Jago or Jago vs Jago)

one method for the sparks would be a script based on the hit boxes, if you hit a hitbox that contains a metal object, like a sword, then sparks are generated, if your hit box has "flesh" it bleeds...

IF there is no way to isolate/differentiate the hitboxes, then the other option is to make & bind another entity to your character, this other entity contains the hitboxes for the metal parts (be it armor or swords)

so imagine this: your character is made up of 2 entities, the main body which is mostly flesh, so his hitboxes will always bleed, but your character has a metal arm, & a metal Kneepads which are another entity itself that is overlayed on top of your main sprite, this entity sparks or bleeds "oil" when hit.

UNfortunately i stink & making scripts & characters, but if i am not mistaken , you can make characters out of multiple entities, (comes in handy for arms that need to stay on only one side)
 
Paulo HP Bender said:
Greetings, fellow developers!

I would like to know if, when a hitspark is spawned normally by the engine, it stores it's parent or target, and what kind of script could be used to change the hitspark behaviour based in these local variables?

Paulo HP Bender,

Hit spark scripts are a fantastic way to code custom effects. Tip: Put hitsounds into the hitspark instead of using hitfx sound. However, in this particular case you're overthinking. This is one of those read the manual moments - the engine allows models to natively override an attack's hitspark with their own. No scripts required.

For scripting more advanced functionality, hit flashes have no relationship with anything. They're just ordinary models spawned as an entity with an autokill flag (entity kills itself when current animation completes), and that's it. So no, there's no parent you can get. But you can use global variables to pass whatever information into them you want.

There's also the "lasthit" system variables, accessible through openborvariant(). They're exactly what they say - data about the last occurring hit. Current stable build supports the following:

  • lasthitc - Confirmed. Used for the doattack() script event. If you set it to 0 in the doattack event, the engine skips hit native hit behavior, allowing you to run your own custom hitcode without interference.
  • lasthitt - Attack type.
  • lasthitx - X position.
  • lasthity - Y position.
  • lasthitz - Z position.

HTH,
DC
 
Solution
Back
Top Bottom