Jump to content

Home

Script function for stopping a dialog running


envida

Recommended Posts

I have dialog that runs when you open a container but I want it to run only once when you open the container the first time after that it stops.

 

I have everything working and the dialog runs after the container is closed but of course if I open and closed it again it will run again.

 

Is there a script function that I can put in the dialog that allow it run only once.

 

I saw in the script tutorials that there a functions for checking if a script has already run is there something similar for a dialog?

Link to comment
Share on other sites

I still don't get it....I assume I would have to have a script that runs when the dialog is run and also a script to run that I put in the box that determines if the dialog is available (kotor tool) right?

 

So if I use a script like the ones below what would go in what script? I assume that the first script will have to set a boolean value and the second script would check if it is set. Am I on the right track? And please don’t laugh of these scripts if am totally way of :p

 

Script to run when dialog is used:

void main() 
{
 int nBoolSlot = 6;

 object oLocker = GetObjectByTag("footlker099");

 SetLocalBoolean(oLocker, nBoolSlot, TRUE);
}

Script that determines if dialog is available:

void main() 
{
 int nBoolSlot = 6;

 object oLocker = GetObjectByTag("footlker099");

 int nCheck = GetLocalBoolean(GetFirstPC(), nBoolSlot);

 if (nCheck) { return; } //exit if TRUE

}

Link to comment
Share on other sites

Here is a script to attach to the dialogue branch so it will spawn a placeable at specified coordinates and put some upgrade items into it;

[size=2]
void main() {

   	float x=0.00f;//These are where  
   	float y=0.00f; //you enter the
   	float z=0.00f; //whereami coordinates
   	float r=0.00f; //placeable orientation N S E W
   	vector MyVec = Vector(x,y,z);    //line 1
   	location MyLoc = Location(MyVec, r);     //line 2
   	object oContainer=CreateObject(OBJECT_TYPE_PLACEABLE, "PutTagHere", MyLoc); //line3
CreateItemOnObject("g_i_upgrade001", oContainer);
CreateItemOnObject("g_i_upgrade002", oContainer);
CreateItemOnObject("g_i_upgrade003", oContainer);
CreateItemOnObject("g_i_upgrade004", oContainer);
CreateItemOnObject("g_i_upgrade005", oContainer);
CreateItemOnObject("g_i_upgrade006", oContainer);
CreateItemOnObject("g_i_upgrade007", oContainer);
CreateItemOnObject("g_i_upgrade008", oContainer);
CreateItemOnObject("g_i_upgrade009", oContainer);

SetLocalBoolean(oContainer,3,TRUE); //This line is the one that closes the door.
}
[/size]

And here is the script you put in the dialogue branch to see if it is available;

[size=2]
int StartingConditional() {
return (!GetLocalBoolean(GetObjectByTag("PutTagHere"),3));
}
[/size]

This is basically the same as tk102's Zaalbar finds items mod. Once the Local Boolean is set to a 3 the dialogue will not show again. :D

 

You don't have to use the number 3 you can use any number 1 to 7 I believe. ;)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...