Sign in to follow this  
turbinejk

Logic for a new feat script - Kotor 1

Recommended Posts

I'm working on a process for coding feats from Kotor 2 that aren't in Kotor 1 over to the original (Superior Lightsaber Specialization, Deflect, Superior Two Weapon Fighting, Close Combat, etc.), and I've been having trouble with a logic issue. Maybe I just don't know the right function to call, but I'm only an amateur scripter and have only recently picked up C/NWScript.

 

I'm planning on incorporating most of the code in the heartbeat script, but am running into an issue with trying to work out the logic to mimic Close Combat as accurately as possible.

 

As a preliminary matter, in order to script a conditional based on distance, I have to come up with a specific distance required to trigger the script. Does anyone know if there is a set distance that counts as melee distance vs. ranged distance that's used in other portions of the game? I was thinking two meters, because womp rats aren't much bigger than two meters. I'm open to suggestions.

 

My bigger issue is with the attack bonus given to attackers when a character is wielding a ranged weapon. I think the game hard codes a +6 bonus automatically, so I need to do a negative attack bonus for each attacker based on which tier of the feat the character has. The only way I know how to do that for sure is to stack a load of if - then statements:

 

if (GetHasFeat("CloseCombat", oPC), GetFirstAttacker(oPC))  && /*attacker distance check*/ {

//     Apply the negative attack bonus to counteract the hard-coded bonus
}
if (GetHasFeat("CloseCombat", oPC), GetNextAttacker(oPC)) && /*attacker distance check*/ {
//     Attack Bonus
}
// Repeat ad nauseum
if (GetHasFeat("CloseCombat", oPC), GetLastAttacker(oPC)) && /*attacker distance check*/ {
//     Attack Bonus
}

Is there a more efficient way to do that? I'm thinking of situations like when you're on the Star Forge fighting a horde of enemies all at once, that's a lot of code for the game to read every six seconds. I could place the code in the OnAttacked script, but I'm still not sure that would be much more efficient during battles as the heartbeat script.

Thoughts? Help? Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this