So, in KotOR 1 &2 in combat you'll sometimes get a lucky hit with a critical strike or a certain upgrade and your enemy will be stunned for a few rounds of combat? How would I make an enemy be stunned by a script in KotOR 1, rather than combat?
It would look something like this:
ApplyEffectToObject(2, EffectStunned(), oTarget, 0.0);
To unstun them:
AssignCommand(oTarget, ClearAllEffects());
I don't know if this would work in cutscenes; there appears to be another function in the code, but there is a lot of stuff that either doesn't work or is redundant in the code, so that might not mean anything.
Well, it's not for use in a cutscene so I shouldn't have a problem there (at least for now). When it states: ApplyEffectToObject(2, What does the 2 represent?
Thanks for the script by the way.
The 2 represents the duration type. 0 = instantaneous (like death), 1 = temporary (like stun if you want to set a specific length, which you would do by changing the 0.0 to a length), 2 = permanent (stays on until you clear the effect).
Alright, that makes sense. Thanks again for the script!
EDIT: Is there a way to set a conditional to check if an NPC is stunned? Say if I wanted to start a conversation after 5 NPC's are stunned, what would I do?
Hmm... I think the easiest thing would be to set a local boolean at the same time you trigger the stun. It would go something like:
SetLocalBoolean(oTarget, 21, TRUE);
21 is the boolean number - anything between 20 and 63 should be safe.
And then for the script to check whether all of of the NPCs have been stunned, something like:
if(
GetLocalBoolean(oTarget1, 21) &&
GetLocalBoolean(oTarget2, 21) &&
GetLocalBoolean(oTarget3, 21) &&
GetLocalBoolean(oTarget4, 21) &&
GetLocalBoolean(oTarget5, 21) ) {
return TRUE;
}
else return FALSE;
There's probably a more elegant way to do it, but that should get the job done. And of course if you wanted to be able to do this more than once, you'd have to set all the booleans back to false afterwards.
No problemo. Good practice for me too. :)
I'm afraid I don't know much about scripting, but I've been curious about this. Does anybody know where to find the stun scripts used when you are in combat? So the on-hit properties?
Mainly, is there a way to modify or make new on-hit effects?
Thanks,
Ӄhrizby
I'm not sure... I think that stuff is hard coded. But it might be possible to do what you want with a heartbeat script; the only catch is it would only affect whatever NPCs you apply it to - unless you modify the generic heartbeat script, but of course that's risky. Not saying it's impossible... but the engine is very sensitive.
Alright, that's what I was afraid of. Maybe someday. Thanks!
Edit: I almost have it! And you're right, I used the heartbeat script, it did exactly what I needed, thank you! Perhaps you could help me out here, finishing it up?
http://www.lucasforums.com/showthread.php?p=2799334#post2799334)