Different AffectTeam results (Read 1132 times)

Started by DingusMB, January 31, 2018, 12:24:36 am
Share this topic:
Different AffectTeam results
#1  January 31, 2018, 12:24:36 am
  • **
  • Déjà vu, mayhap—have you been here as well?
I have a helper that explodes after a while, I want its HitDef to simply damage and knockback the enemy when it hits him, but change my state to a custom one when it hits me.. Whats the best way to do that?
Re: Different AffectTeam results
#2  January 31, 2018, 08:16:07 pm
  • ****
  • Robotics Engineer
    • USA
Here's 2 ways, but there's probably even more.

You can try just using p2stateno in the Helper's HitDef, but if memory serves me right it doesn't behave as documented (using -1 for "do nothing")
The condition statement should only trigger to send P1 to State 1234.

p2stateno = Cond((numtarget && numparent),Cond(((target,ID = parent,ID) && movehit),1234,-1),-1)

If that doesn't work as expected, then instead I think you want to try sticking a TargetState after the Helper's HitDef like so:

type = TargetState
trigger1 = numtarget && numparent
trigger1 = target,ID = parent,ID
trigger1 = movehit
value = 1234
target = 5678

... and in the HitDef you'lll need to assign a specific ID if it hits P1, for TargetState to only affect P1

id = Cond((numtarget && numparent),Cond((target,ID = parent,ID),5678,0),0)

Re: Different AffectTeam results
#3  January 31, 2018, 08:50:42 pm
  • ******
You should NEVER use P1StateNo or P2StateNo parameters in hitdef. They will make attacks completely whiff anything using hitoverride. I'd just make 2 hitdefs. One that does A to your teamside and B to the opponent's.
Re: Different AffectTeam results
#4  February 01, 2018, 12:46:09 pm
  • *****
  • Shame on you!
    • USA
I've tried the 2 hitdef thing in the past and gotten mixed results. My Samus' bomb hits Samus and the enemy in two different ways.

I spawn the bomb. When it goes off it switches to a state that affects the same team. In the 2nd state it spawns a 2nd helper. The current state hits P1 and the helper hits P2. I made the helper invisible with the same clsn boxes as the original helper.

I DO use the P2StateNo in the affect Samus hitdef(s) because Samus needs to react different when she's in the air or on the ground. And as far as I can remember you have to use P2StateNo even though it's the Root's stateno.

Only thing I clearly remember was that when I used 2 hitdefs in the same move it wouldn't work the way I wanted. I had to spawn the helper to hit the other team.
vVv Wheat Stage Released vVv
Re: Different AffectTeam results
#5  February 01, 2018, 04:12:29 pm
  • ******
This is code from our HDBZ focus attack. It has 2 hitdefs.
Spoiler, click to toggle visibilty
This is to hit a char in the air differently than on the ground.

Alternatively I guess the team thing may be an issue if it hits both at the same time? I'm not sure as I haven't tested that. But if that is the case then a helper bound to the attacking helper would probably be best. One hitting opponent and one hitting root. Another thing that can cause issues with hitdefs is the timing of when the hitdef triggers.

An example I discovered with Gotenks. If a  certain explod exists then the fall parameter of his ki blast becomes true. But I noticed that the ki blast would still sometimes knockdown AFTER the explod had vanished. This was due to the fact the hitdef triggered on AnimElem = 1 when the explod existed. Changing the trigger to 1 allowed the hitdef to update it's info each tick.