Quantcast
Channel: LucasForums - Holowan Laboratories
Viewing all articles
Browse latest Browse all 507

Need Help with AI editing (TSL, make Nihilus use Force Powers)

$
0
0
Hello Modders,

I am attempting to make some changes to the behavior of the bosses in both KotoR 1 and Kotor 2. The first thing I'd like to do is modify the frequency with which the bosses use force powers -- yet I'm confused about the logic governing this. I will begin with Darth Nihilus, since he seems to never use any force powers -- though it applies to the other bosses as well (Traya seems to use them sometimes but not nearly as much as the code suggest she should...)

So, based on my understanding of the AI Script, this is what happens vs. Nihilus/Traya:

1: After their on_perception event fires in k_ai_master, the include method GN_DetermineCombatRound() is called. It is then called at the end of every Round. This function serves as main() for all behavior, enemy and ally alike.

DetermineCombatRound()
Show spoiler


2: Since they use the Boss Script, the subroutine GN_RunAiBossRoutine() is called. It looks like it should always be called. This subroutine looks like this:

Show spoiler


So this should always run one of GN_RunBossGrenadeAI(), GNRunBossAOEPowerRoutine(), or GN_RunBossTargetedRoutine() unless they all fail for some reason -- or unless he's under 50% health prompting him to spam drain. Here you will fine all three in the sequence they should run... if any of them return true, then BossAI() should stop running.

Grenade
Show spoiler

AOE
Show spoiler

Targeted
Show spoiler


For Darth Nihilus, then means he should Run the GrenadeAI, which will fail because Nihilus doesn't know any grenade moves. Then the AOE one should run, which should generally succeed, because he does know AOE moves.

The most important function called by these is from the gensupport include, It gets the bosses next move. Here is the code

Get Boss Move Helper routine:
Show spoiler

However, he never uses them. Ever. All he does is randomly hit people with his lightsaber until it's time to start spamming life drain. Even if he were following the targeted AIScript because AOEPowerRoutine() failed (Because he couldn't find the right AOE target with GN_FindAOETarget();), he should still use force powers 50% of the time, since The Helper method GetBossCombatMove does a DCroll() and if it's >50 picks a force powers when called with nBossAttackType == SW_BOSS_ATTACK_TYPE_PC, But he doesn't.

What the hell is wrong with this boss? have I misunderstood something?

I want to make him actually use force powers (I want to do this for all enemies by giving them the Boss AI, but first I've got to make the Boss AI work...) Any idea why he's not exhibiting the expected behavior... or more accurately, why no enemy in the game seems to actually use force powers the way these functions suggest?

EDIT: Added in important subroutines

Viewing all articles
Browse latest Browse all 507

Trending Articles