View Single Post
Old 04-26-2013, 04:09 PM   #292
Taunger
Rookie
 
Taunger's Avatar
 
Join Date: Oct 2010
Location: Mos Eisley
Posts: 46
Current Game: KotOR
Fallen Guardian, your code makes calls for one attacker, then the other, then the first one again and so on. This is how fighting in-game works as well; it's turn based. I think that's why making a call for the attacker to repeatedly attack doesn't work (which is what I was trying to do), it's waiting for the victim to fight back, which it doesn't, because I've not programmed it to do so.

After some more tinkering I think I've found the solution, which is to use:

Code:
ChangeToStandardFaction(oVictim, STANDARD_FACTION_PREY);
ChangeToStandardFaction(oAttacker, STANDARD_FACTION_PREDATOR);
This, apparently, makes the attacker ignore the turn-taking rules.

There's one weird caveat with this, however. If I use something like this:

Code:
AssignCommand(oAttacker, CutsceneAttack(oVictim, 197, ATTACK_RESULT_MISS, 0));
AssignCommand(oAttacker, CutsceneAttack(oVictim, 197, ATTACK_RESULT_CRITICAL_HIT, 1000));
The animation of the first attack will play, but not the second time. The attack does succeed, because the victim dies. The animation for any attacks after the first one will only play if the CutsceneAttack call is made after the previous attack has already finished. So, it needs to be something like this:

Code:
AssignCommand(oAttacker, CutsceneAttack(oVictim, 197, ATTACK_RESULT_MISS, 0));
DelayCommand(3.5, AssignCommand(oAttacker, CutsceneAttack(oVictim, 197, ATTACK_RESULT_CRITICAL_HIT, 1000)));
I just tested this myself and it works!
Still, it seems rather... curious.
Taunger is offline   you may: quote & reply,