Jump to content

Home

scripting question - tsl


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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")));


}

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...