Jump to content

Home

Qui-Gon's Script Shack


Qui-Gon Glenn

Recommended Posts

  • Replies 352
  • Created
  • Last Reply

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!

Link to comment
Share on other sites

Hey guys well I'm looking for a script that would be something along the lines of this:

 

1)checks if person A is dead

2checks if person B is dead

3)checks if person C is alive.

 

Just so your fully aware this script will be placed onto person B's on death script.

Link to comment
Share on other sites

Hey guys well I'm looking for a script that would be something along the lines of this:

 

1)checks if person A is dead

2checks if person B is dead

3)checks if person C is alive.

 

Just so your fully aware this script will be placed onto person B's on death script.

 

First off, I'm assuming Person A is the party leader, and Person C is the third member in the party.

 

Something like this should get you started(though I can't compile it to test it):

 

Show spoiler
(hidden content - requires Javascript to show)
void main() {
   object PersonA = GetPartyMemberByIndex(0);
   object PersonB = GetPartyMemberByIndex(1);
   object PersonC = GetPartyMemberByIndex(2);

   if(GetIsDead(PersonA) == 1 &&
      GetIsDead(PersonB) == 1 &&
      GetIsDead(PersonC) == 0)
   {
        <Do whatever you want here...>
   }
}

 

Of course, that assumes that you don't want anything to happen if either Person A or B is also alive when the script activates. If you do want something to happen, then I can work that in too.

Link to comment
Share on other sites

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.

 

Any help so far?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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...

 

Then I could actually help you.

Link to comment
Share on other sites

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...

 

Then I could actually help you.

 

PM'ed you explained everything in DETAIL.

 

Thanks-Supreme Kotor

Link to comment
Share on other sites

  • 2 weeks later...
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?

Link to comment
Share on other sites

AFAIK you can't modify nwscript.nss in any way for use in the game.

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.

Link to comment
Share on other sites

  • 4 months later...

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)?

Link to comment
Share on other sites

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:

 

void main()
{


  AssignCommand(GetObjectByTag("Carth"), ActionForceMoveToObject(GetObjectByTag("Bastila")));
  AssignCommand(GetObjectByTag("Carth"), SetFacing(325.5));

}

 

SetFacing is not a command that is inherently added to the action queue, thus Carth's walking command would most likely be messed up by his trying to face 325.5 degrees.

 

However, if you set it up like this:

 

void main()
{


  AssignCommand(GetObjectByTag("Carth"), ActionForceMoveToObject(GetObjectByTag("Bastila")));
  AssignCommand(GetObjectByTag("Carth"), ActionDoCommand(SetFacing(325.5)));

}

 

It adds SetFacing to the action queue, so Carth will finish walking to Bastila before he turns to face 325.5 degrees.

 

You can read up on ActionDoCommand, and all things scripting, here.

Link to comment
Share on other sites

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)?

 

Well, the documentation for both are:

// 294: Do aActionToDo.

void ActionDoCommand(action aActionToDo);

 

and

// 6: Assign aActionToAssign to oActionSubject.
// * No return value, but if an error occurs, the log file will contain
//   "AssignCommand failed."
//   (If the object doesn't exist, nothing happens.)

void AssignCommand(object oActionSubject,action aActionToAssign);

 

In my experience, one should/would use the first function at times where the target is one's self, ie: in the On***(Fill in with: Spawn, Heartbeat, Attacked, and the other events), or in a cutscene.

 

What happens with each? Well...

 

ActionDoCommand adds the action to the front(top?) of the action queue, making it happen immediately.

 

AssignCommand, however, adds the action to the end(bottom?) of the action queue, allowing for one to "chain" actions together.

Link to comment
Share on other sites

Thanks for the help guys! (or gals, I don’t know :p)

 

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).

 

SetFacing(); // Makes script caller immediately do something.

ActionMoveToLocation(); // Adds action to script caller’s action cue.

ActionDoCommand(SetFacing()); // Adds non-action to script caller’s action cue.

AssignCommand(oObject, ActionMoveToLocation()); // Adds action to oObject’s action cue.

AssignCommand(oObject, ActionDoCommand(SetFacing())); // Adds non-action to oObject’s action cue.

 

Again, an action is a function that starts with “Action” and a non-action is one that doesn’t.

Of course, I’m leaving out parameters and stuff, but you know what I mean.

 

Anyway, if I explain it this way, is it correct?

Link to comment
Share on other sites

  • 1 month later...

I've been looking at lrn_form.dlg and its associated scripts, particularly a_give_form and c_chkform_next. And I have a few reservations about teaching the player a new form out of sequence. I know supposedly it has been done before - M4-78 and Coruscant Jedi Temple, for example - but if I'm reading this right... well... it shouldn't be possible. At least, not without breaking the existing system.

 

The problem, as I see it, is that it's set up to check a global (G_PC_FORM) rather than how many forms the player has learned. The global is used for a switch, with each case determining what form the player learns. The global value is then increased each time the player learns a form. Because the scripts only anticipate this global having three possible states (0, 1, and 2), once it is set to 3, it should be impossible for the player to learn additional forms. And this could have disastrous consequences, as in at least one case there is not a conditioness safety node, so if there is no valid form left to learn, the conversation will break.

 

There are seven forms in total that you can learn from the masters, and only three masters in the original game, so it seems like it should be a nonissue... I'm have a hard time believing my eyes, so I'm wondering if anyone else could help decipher the matter.

Link to comment
Share on other sites

  • 3 weeks later...

I was attempting to make a message box pop up in KotOR II. However, the function used for this [ DisplayMessageBox(); ] will make a message box pop up, even while one is in a conversation. This causes the GUI to break, so once the conversation is over the player can neither move, nor access any menus.

 

In order to make it so I could still call a script with this function in the middle of a dialogue without breaking the GUI, I had an idea to use the GetIsInConversation function to make the script wait until the conversation is over, and then immediately display the message box. However, I don't know exactly how to do that. I was leaning towards something like this:

 

void main()
{

  while( GetIsInConversation(GetFirstPC()) == TRUE )
  {

      make script keep looping back and checking to see if the conversation 
      has ended

  }

  Once conversation as ended
  {

      DisplayMessageBox();

  }

}

 

I don't know if this is how you'd go about setting it up, and obviously I need the proper functions, so any help would be appreciated.

Link to comment
Share on other sites

I was attempting to make a message box pop up in KotOR II. However, the function used for this [ DisplayMessageBox(); ] will make a message box pop up, even while one is in a conversation. This causes the GUI to break, so once the conversation is over the player can neither move, nor access any menus.

 

In order to make it so I could still call a script with this function in the middle of a dialogue without breaking the GUI, I had an idea to use the GetIsInConversation function to make the script wait until the conversation is over, and then immediately display the message box. However, I don't know exactly how to do that. I was leaning towards something like this:

 

void main()
{

  while( GetIsInConversation(GetFirstPC()) == TRUE )
  {

      make script keep looping back and checking to see if the conversation 
      has ended

  }

  Once conversation as ended
  {

      DisplayMessageBox();

  }

}

 

I don't know if this is how you'd go about setting it up, and obviously I need the proper functions, so any help would be appreciated.

 

Okay, this might help, but it depends on what you want the message box to do/say/have in it:

 

void main()

{

DelayCommand(0.5, DisplayMessageBox());

}

 

Then place the script in the .dlg file's "Script that fires when conversation ends" slot in DLGEdit(Click the topmost node, that has the file path).

 

Alternatively, you might try experimenting with ActionPauseConversation(), display message box, then ActionResumeConversation(), since I believe a script ends with its node in a dlg(which means your script above would need to be in a heartbeat script, most likely).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...