Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

scripting question - tsl

Page: 1 of 1
 newbiemodder
05-30-2010, 2:15 PM
#1
I need help with a script. I've been racking my brain on this for a day now and can't seem to get it to work. I keep getting myself confused. I'm assuming it needs a local boolean check { i hate these things}.

I have a script that fires when a door opens. Specifically, weapons are flourished and a conversation is started.

After the dialog, fighting occurs and the door is closed via script. After the fighting the door opens again via script. But the conversation starts again = PROBLEM.

I need some kind of conditional or boolean set/check to make sure that the dialog fires only once after the initial door opening and not again when the pc exits the door.

thanks as always.
 logan23
05-30-2010, 2:50 PM
#2
Have the conversation started by a script that have the npc start the conversation with PC.
So when it tries to fire again the npc is dead so it wont fire.
 newbiemodder
05-30-2010, 3:45 PM
#3
The problem is the npc that we converse with is not killed...it's kind of like a test/challenge scene where they spar but no one is killed.
 logan23
05-30-2010, 4:02 PM
#4
you could have it after the test, the NPC gives you something as a reward or show of some type of appreciation. Then the script can do a check/if statement on this plot item. If the item is not there it will trigger the test event, but if it is present then it won't fire again.
 newbiemodder
05-30-2010, 5:11 PM
#5
This is what I decided to do here, note it still is not working.

I set up a local boolean in an early dialog using the standard script, a_set_local, using boolean# 29 in the P1 slot and using the stringparam of "doorfinal" but without the quotes. This script sets the boolean to TRUE

So, on the DoorOpen script of a door I have this script, it's here where I think the problem is:

void main() {

if (GetLocalBoolean(GetObjectByTag("doorfinal"), 29)) {


object oNPC0 = (GetObjectByTag("n_teachjedia"));
object oNPC1 = (GetObjectByTag("sentryc"));
object oNPC2 = (GetObjectByTag("sentryd"));
object oNPC3 = (GetObjectByTag("n_pupil01"));
object oNPC4 = (GetObjectByTag("n_pupil02"));
object oNPC5 = (GetObjectByTag("n_pupil03"));
object oNPC6 = (GetObjectByTag("n_pupil04"));
object oNPC7 = (GetObjectByTag("n_pupil05"));
object oNPC8 = (GetObjectByTag("n_pupil06"));
object oNPC9 = (GetObjectByTag("n_pupil07"));
object oNPC10 = (GetObjectByTag("n_pupil08"));
object oNPC11 = (GetObjectByTag("n_pupil09"));
object oNPC12 = (GetObjectByTag("n_pupil10"));
object oNPC13 = (GetObjectByTag("n_pupil11"));

CreatureFlourishWeapon(oNPC0);
CreatureFlourishWeapon(oNPC1);
CreatureFlourishWeapon(oNPC2);
CreatureFlourishWeapon(oNPC3);
CreatureFlourishWeapon(oNPC4);
CreatureFlourishWeapon(oNPC5);
CreatureFlourishWeapon(oNPC6);
CreatureFlourishWeapon(oNPC7);
CreatureFlourishWeapon(oNPC8);
CreatureFlourishWeapon(oNPC9);
CreatureFlourishWeapon(oNPC10);
CreatureFlourishWeapon(oNPC11);
CreatureFlourishWeapon(oNPC12);
CreatureFlourishWeapon(oNPC13);


object oPC = GetFirstPC();
object oNPC14 = GetObjectByTag("n_xyz",0);
int iDelay1 = 2;

AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ClearAllEffects());

DelayCommand( IntToFloat(iDelay1), AssignCommand(oNPC14, ActionStartConversation(GetFirstPC(),"dialognamehere")));


}

}

What I then planned to do is prior to having the door close for the fight, I would place the generic script, a_local_reset , which would set the local boolean to FALSE which would void out the dooropen script for the next time the door opens

However, the npcs are not flourishing their weapons when the door opens as desired, so I think my problem is in the above script.

Does this make any sense at all......
 logan23
05-30-2010, 5:28 PM
#6
Another way is to use journal entry as the structure so you just have to do a check on the jrl entry number.

To not clog the jrl log you can place it in the complete mission section which player never look at.
 DarthStoney
05-30-2010, 8:51 PM
#7
Try this and see if it works the way you want,the other suggestion would be to add a global to the globalcat.2da that would be easier to control.
void main() {

object oPC = GetFirstPC();
if (!GetLocalBoolean(oPC, 40)){


object oNPC0 = (GetObjectByTag("n_teachjedia"));
object oNPC1 = (GetObjectByTag("sentryc"));
object oNPC2 = (GetObjectByTag("sentryd"));
object oNPC3 = (GetObjectByTag("n_pupil01"));
object oNPC4 = (GetObjectByTag("n_pupil02"));
object oNPC5 = (GetObjectByTag("n_pupil03"));
object oNPC6 = (GetObjectByTag("n_pupil04"));
object oNPC7 = (GetObjectByTag("n_pupil05"));
object oNPC8 = (GetObjectByTag("n_pupil06"));
object oNPC9 = (GetObjectByTag("n_pupil07"));
object oNPC10 = (GetObjectByTag("n_pupil08"));
object oNPC11 = (GetObjectByTag("n_pupil09"));
object oNPC12 = (GetObjectByTag("n_pupil10"));
object oNPC13 = (GetObjectByTag("n_pupil11"));

CreatureFlourishWeapon(oNPC0);
CreatureFlourishWeapon(oNPC1);
CreatureFlourishWeapon(oNPC2);
CreatureFlourishWeapon(oNPC3);
CreatureFlourishWeapon(oNPC4);
CreatureFlourishWeapon(oNPC5);
CreatureFlourishWeapon(oNPC6);
CreatureFlourishWeapon(oNPC7);
CreatureFlourishWeapon(oNPC8);
CreatureFlourishWeapon(oNPC9);
CreatureFlourishWeapon(oNPC10);
CreatureFlourishWeapon(oNPC11);
CreatureFlourishWeapon(oNPC12);
CreatureFlourishWeapon(oNPC13);


object oNPC14 = GetObjectByTag("n_xyz",0);
int iDelay1 = 2;

AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ClearAllEffects());
SetLocalBoolean(oPC, 40, 1);
DelayCommand( IntToFloat(iDelay1), AssignCommand(oNPC14, ActionStartConversation(GetFirstPC(),"dialognamehere")));


}

}
 newbiemodder
05-31-2010, 9:16 AM
#8
got it working
Page: 1 of 1