Jump to content

Home

Scripting help


TriggerGod

Recommended Posts

At this moment, I am working on some quests, and I need to learn some more scripting, so bear with me. All these scripts would be for TSL.

 

1) How would I go about making a party member the leader, and setting it back to having your PC as the leader at a later time? (Like the bar fight on Nar Shaddaa between Atton and the Twin Suns, and Mira going through the Jekk Jekk Tar)

 

2) Would it be possible to check which party members are in your party as you enter a new area? To be more specific, how would I check if Brianna was in your party as you entered the tomb on Korriban?

 

3) How would I set up a wave of enemies, similar to the waves upon waves of Dark Jedi on the Star Forge?

Link to comment
Share on other sites

Not too sure about the first question. You could give a look at the SetPartyLeader() function though.

 

For the second, you can use the following script:

int StartingConditional() {
  int i = 0;
  while( i < 3 ) {
  if( GetTag( GetPartyMemberByIndex( i ) ) == "Handmaiden" )
     return TRUE;
  i++;
  }
  return FALSE;
}

 

I don't know how the game creates waves of opponents, but a way you can do it is to attach a spawning script to the OnDeath field of the enemy that you want to respawn. Every time the character is killed, you spawn a new one. Of course, you'll need some event to kick in to prevent this from going on forever. What do you have in mind for the stopping event?

 

- Star Admiral

Link to comment
Share on other sites

A

1) How would I go about making a party member the leader, and setting it back to having your PC as the leader at a later time? (Like the bar fight on Nar Shaddaa between Atton and the Twin Suns, and Mira going through the Jekk Jekk Tar)

 

Use (for example) SetPartyLeader(NPC_ATTON) to change leader and then SetPartyLeader(NPC_PLAYER) to change back to the main character. Keep in mind that the main will disappear from the party in the meanwhile, and that any puppets (like Bao-Dur's remote) will vanish from the character being set as party leader while they're leader.

 

2) Would it be possible to check which party members are in your party as you enter a new area? To be more specific, how would I check if Brianna was in your party as you entered the tomb on Korriban?

 

if (IsNPCPartyMember(NPC_HANDMAIDEN])) {
   // Do stuff...
}

...in the OnAreaEnter event script for that area.

 

3) How would I set up a wave of enemies, similar to the waves upon waves of Dark Jedi on the Star Forge?

 

You can either use an Encounter trigger for that, or have a heartbeat script running on some object that checks for existing spawned enemies and then spawn more to make sure the desired amount are active. Encounters would require less/no scripting, though aren't as flexible depending on how you want it to work.

Link to comment
Share on other sites

  • 2 weeks later...

OK, thanks for the help so far. I have some more scripting woes.

 

I've edited appearance.2da, so that an unused line (The Darth Traya (Atris) line) can use my skins. I've hex edited the model, I've compiled and put into my override, and now I'm working on a script to change Atris into the new appearance when the script is ran. I got the script to change appearance from teekay's post on useful scripting functions, and I edited it to my use. But, for some reason, when I do this script:

// 850
// ChangeObjectAppearance
// oObjectToChange = Object to change appearance of
// nAppearance = appearance to change to (from appearance.2da)
void ChangeObjectAppearance( object p_atris, 491 );

the compilation aborts, with the error saying

syntax error at "integer constant"

 

I also tried making the 491 into the name of the row, like so:

 

// 850
// ChangeObjectAppearance
// oObjectToChange = Object to change appearance of
// nAppearance = appearance to change to (from appearance.2da)
void ChangeObjectAppearance( object p_atris, Unique_Darth_Atris );

 

This time, there is a syntax error at Unique_Darth_Atris.

 

Am I doing something wrong with this script?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...