// 341: A creature can have up to three classes. This function determines the
// creature's class (CLASS_TYPE_*) based on nClassPosition.
// - nClassPosition: 1, 2 or 3
// - oCreature
// * Returns CLASS_TYPE_INVALID if the oCreature does not have a class in
// nClassPosition (i.e. a single-class creature will only have a value in
// nClassLocation=1) or if oCreature is not a valid creature.
int GetClassByPosition(int nClassPosition, object oCreature=OBJECT_SELF);

I know this probably seems like a really wierd question but I assure you there is good reason for it. Now to the question: would it be possible to make a force power (buff) never go away after you cast it? And if that is possible would it be possible to remove the blue arrow it makes?

I know this probably seems like a really wierd question but I assure you there is good reason for it. Now to the question: would it be possible to make a force power (buff) never go away after you cast it? And if that is possible would it be possible to remove the blue arrow it makes?

Thanks in advance

You might experiment with the "DURATION_TYPE_PERMANENT" option in the ApplyEffect function. Though I would have to assume that it is gone when dispelled and/or you change areas. Still, experimentation may prove me wrong. Hope you have a good run and remember:

Show spoiler

(hidden content - requires Javascript to show)

"Scripting is fun!"~~ said some random modder as others attacked him for his insanity.

"Scripting is fun!"~~ said some random modder as others attacked him for his insanity.

Well it would be easier if one could program such things in one contiguous file. Kinda stinks having so many separate files to go through. Sure, you could include a lot of scripts that define functions.

Well it would be easier if one could program such things in one contiguous file. Kinda stinks having so many separate files to go through. Sure, you could include a lot of scripts that define functions.

You could include a check in the creature's OnHeartbeat script to reapply the script. It wouldnt quite be permanent - there'd be a few seconds at the start of each module where it wouldn't be active - but it would be close.

The CutsceneAttack function is often mentioned and works, but I run into the problem that was also discussed here without a solution coming up, which is that it works for only one attack. For that reason, I don’t think this function is used in the scenes above; I can clearly see an NPC attack more than once in a single dialog node.

So, my question is, what other method is there to create these fight sequences? I’d like them to be identical every time. Should I use the ActionPlayAnimation or PlayAnimation functions? In that case, would I have to “manually” call the attacker’s and defender’s animation, plus any effects like sparks or lasers from blasters?

The CutsceneAttack function is often mentioned and works, but I run into the problem that was also discussed here without a solution coming up, which is that it works for only one attack. For that reason, I don’t think this function is used in the scenes above; I can clearly see an NPC attack more than once in a single dialog node.

So, my question is, what other method is there to create these fight sequences? I’d like them to be identical every time. Should I use the ActionPlayAnimation or PlayAnimation functions? In that case, would I have to “manually” call the attacker’s and defender’s animation, plus any effects like sparks or lasers from blasters?

Have you tried putting the CutsceneAttack function in a for loop? Like this:

(I'm pretty sure this script won't compile, it's just an example of what you could do.)

I remember when I made a cutscene I just used the attack function, made two NPC's attack each other and then let them have it for a few seconds. Then I would end it did with the use talent feat function. I don't know if these function names are correct, I'm on my phone at the moment. I'll check back later when I'm on my computer.

The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

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:

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:

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:

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:

When not, yeah, it has to be done. Here for example Kreia vs. Hanharr in the Jekk Jekk Tar. One solution actually has him attack, the other version uses animations to 'fake' it. Had to be done that way considering it works differently if he's a teammate, and damage will break the cutscene.

Need some help. Here's a script to make Atton and the PC get Pazaak cards in their hand. All good, and it works... but the PC's cards are invisible. Atton works fine, just not the PC.
If the convo ends I find the cards in my hand, still invisible. Swapping with other weapon and back makes visible, so tried unequipping and re-equipping... didn't work. Tried adding a specific "render" to the pazaak cards, didn't work. Not quite sure what more to try.
I'd rather use the real player than a fake dummy, as that complicates things down the road for what I want... so, anyone got a clue what to do?

Hmm... I just executed it and I didn't end up with invisible cards. Tried it with various weapons in hand, always seemed to do what it's meant to do. Sorry, I got nothing more than that, other than I did it outside of a conversation.

Aaaaaaaand... fixed it. It was stupidly simple to boot.
Even with each getting their own pazaak cards, they both tried to equip the same one pair from the inventory (somehow). Which bugged out the game.

So instead of giving them cards and letting them equip them, spawned them straight into their hands, and this time they didn't try to share the same one item and it worked!

Well I might be about to make your life harder but what I was wondering is if you can make a certian dialog only fire if person B is Alive otherwise just a generic dialog will fire.

Assuming what I've already assumed... It'd be a tad tricky.

You see, for two party members to be down(automatically making Person B the party leader), you'd have to be in combat or just out of it. Also you want this in the OnDeath Script, so the game might just yank the plug on the game when the script fires...

However, if you wanted it tested on people who aren't in your party, then this is entirely possible, you'll just have to specify who person B is with GetObjectByTag.

Thanks Fair Strides 2 you have been helping a lot thanks for that. Now I have a theory; thereticly I could make both of the party members henchmen in the dialog right before the fight and then use the same script with person A=Henchman 1(Party member 1) B=Henchman 2 (Part member 2) and C=the guy were fighting. And then use that to fire unique dialog based on who's still alive?

Thanks Fair Strides 2 you have been helping a lot thanks for that. Now I have a theory; thereticly I could make both of the party members henchmen in the dialog right before the fight and then use the same script with person A=Henchman 1(Party member 1) B=Henchman 2 (Part member 2) and C=the guy were fighting. And then use that to fire unique dialog based on who's still alive?

You might experiment with ChangeStandardFaction and setting it to Friendly 2(Friendly 1 I believe is what party members already are. Could you perhaps discuss by PM what happens before, during, and after the fight?

Aarrggghhh!!! My laptop's been getting "fixed" for almost 3 weeks, and I can't actually fire up K1 or TSl until it is. Maybe not even then, it depends on the graphics card...

You might experiment with ChangeStandardFaction and setting it to Friendly 2(Friendly 1 I believe is what party members already are. Could you perhaps discuss by PM what happens before, during, and after the fight?

Aarrggghhh!!! My laptop's been getting "fixed" for almost 3 weeks, and I can't actually fire up K1 or TSl until it is. Maybe not even then, it depends on the graphics card...

So I've been attempting to use the DisplayMessageBox function in KotOR 2, yet once I click okay on the message box that pops up the menu doesn't return. I can't move and none of the buttons work. Is this just because Obsidian never actually made this a working function?

The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

So I've been attempting to use the DisplayMessageBox function in KotOR 2, yet once I click okay on the message box that pops up the menu doesn't return. I can't move and none of the buttons work. Is this just because Obsidian never actually made this a working function?

Hello all! I have been away too long, and I am so happy to find most of you still right here, plugging away!

I am not familiar with this function, but I would say that if you can find it in Kotor2's nwscript.nss, then it should work the same way. If it is not in there, you know that is the issue.

Should be simple to "fix" but it would require you shipping your "new" version of the nwscript.nss be shipped with your mod, and then of course there would be the problem of making sure everything is getting compiled with the new version. Maybe not such a simple fix.

Perhaps easier is to make a new function that works the same way, and use that. Do you have the source for the DisplayMessageBox function code?

The problem is not in modifying the nwscript.nss. It is that the game may not use nwscript.nss to compile the files... Of course we use it when we compile with KTool or something else, but we are using the nss portion. I suspect that the engine has its own version of a compiled nwscript that is exactly a match for the .nss that we can access. It is a problem of universality... modifying it is a Pandora's box.

Say, can anyone enlighten me on the exact difference between the ActionDoCommand and AssignCommand functions (in K1)?

I found someone saying that ActionDoCommand works for assigning actions, and AssignCommand for non-actions. If that is true, then what exactly is an action and what is a non-action (that is still assignable)?

Say, can anyone enlighten me on the exact difference between the ActionDoCommand and AssignCommand functions (in K1)?

I found someone saying that ActionDoCommand works for assigning actions, and AssignCommand for non-actions. If that is true, then what exactly is an action and what is a non-action (that is still assignable)?

I'm pretty certain you have to always use AssignCommand whenever you're making an object do something. However, ActionDoCommand is used to add commands to the object's action queue that would not be added just by using an AssignCommand. For example, in a script like this:

Say, can anyone enlighten me on the exact difference between the ActionDoCommand and AssignCommand functions (in K1)?

I found someone saying that ActionDoCommand works for assigning actions, and AssignCommand for non-actions. If that is true, then what exactly is an action and what is a non-action (that is still assignable)?

So, if I understand correctly, AssignCommand is used for assigning a subject to do some function starting with “Action” (e.g. “ActionMoveToLocation”), while ActionDoCommand is used to “convert” a function that does not start with “Action” (e.g. SetFacing) to one that does, i.e. to something that can be added to some object’s action queue (otherwise it’s not added to the action queue but executed immediately). You can then use AssignCommand to assign this action to an object, unless the action is meant to be executed (immediately) by the caller of the script (e.g. in an “OnAttacked” script).