NEW SCRIPTS: Disable Trap GUI

@andgalf requested help with some GUIs that were originally uploaded by Little Baron, which can be found here: Lockpicking & Trap Disarming UI's | The Neverwinter Vault

NB: The images for the GUI are required from the above Vault download.

The thread has grown quite long, and rather than people potentially missing what is now available, I thought I would post the scripts here for any others interested. These three new scripts are only for the Disable Trap GUI, as this is the one I concentrated on. The Lock Picking GUI I have also fixed, but the code is tightly woven into my own campaign code and not something easily shared. (If you want to see the Lock Picking GUI in action, check out The Scroll.)

Little Baron’s original work uses more scripts and a different XML to what I provide here, so keep that in mind if you consider using this. My own version also allows a player to toggle on or off usage of any Thieves Tools so they are not automatically used if the player does not wish to use them here. This version also prevents PCs without any training (or points) in the DISABLE DEVICE skill from being able to disable trap components or recover the trap. (They may still be able to find components of the trap, but cannot interact with them.)

If you decide to use this, then please report any issues in this thread for my attention, and I will try to address them as soon as possible. My thanks to @andgalf for encouraging me to pull my finger out and fix this. It’s only been around six years. :wink:

NB: TRIGGER TRAP: Use a basic “empty” non-trap trigger to determine where the trap is to be. i.e. DO NOT USE a TRAP Trigger. DO NOT mark it as trapped! Although you can manually set DCs and trap types and they will be used.

NB: If you leave the default trap as a Minor Spike Trap Type (*), then a random trap type is generated based upon the PC level. If a DC is left at zero, then a random one will be generated, based on the PC level for DISARM and on the DISARM setting for DETECTION.

(*) To force a Minor Spike Trap, set an integer on the trap within “TRAPTYPE” to -1 (minus one). You MUST then manually add DETECT DC and DISABLE DC values.

UPDATED: These scripts also work with VFX fix!

NB: OBSERVE SCRIPT NAMES.

alb_open_trappicking: Goes on a placeable (OnUsed), a door’s (OnFailToOpen) and a triggers (OnEntered): -

/////////////////////////////////////////////////////////////////////////////////
// LittleBaron 10/08 (UPDATED & FIXED. INC COMPANION SUPPORT BY LANCE BOTELLE 07/03/22)
// NB: OBJECT_SELF IS THE TRAPPED OBJECT THAT IS TRIGGERED CALLING THIS SCRIPT.
// DISPLAYS THE TRAP GUI IF DETECTED (OR SETS OFF TRAP IF NOT)-OR RECALLS LAST STATE.
// THE GUI OPENED WITH THIS SCRIPT IS CALLED LB_trappicker.xml
// THE XML USES ONLY ONE CALLBACK SCRIPT: gui_trappicking
/////////////////////////////////////////////////////////////////////////////////

//#include "alb_functions_core" 
#include "x0_i0_position" 

///////////////////////////////////////////////////////////////////////////////////////
// RETURN A RANDOM NUMBER FROM THOSE THAT REMAIN IN DESIGNATED SERIES (14 OF 0-13)
///////////////////////////////////////////////////////////////////////////////////////
int GetRandomNumber(object oTrap, string sPickFromInitial = "ABCDEFGHIJKLMN");
int GetRandomNumber(object oTrap, string sPickFromInitial = "ABCDEFGHIJKLMN")
{
	// VALUE TO RETURN
	int iNumber;
	
	string sPickFrom = GetLocalString(oTrap, "XLettersRemain");		
	
	// INITIAL SPECTRUM
	if(sPickFrom == ""){sPickFrom = sPickFromInitial;}
	
	int iLettersRemain = GetStringLength(sPickFrom);				// E.g. 11 in this case
	int ThisLetter = Random(iLettersRemain);						// E.g. 0-10 possible here.
	string sLetter = GetSubString(sPickFrom, ThisLetter, 1);		// E.g. 0 would return "A"
	
	// CREATE & STORE REMAINING ALPHABET STRING
	int nRightCount = iLettersRemain - ThisLetter - 1;				// E.g. 11 - 0 - 1 = 10 (-1 is GetSubString 0 correction)
	int nLeftCount = iLettersRemain - nRightCount - 1;				// E.g. 11 - 10 - 1 = 0 (-1 is for this allocation)
	
	string sRHRemain = GetStringRight(sPickFrom, nRightCount);		// E.g. "BCDEFGHIJK" in this case
	string sLHRemain = GetStringLeft(sPickFrom, nLeftCount);		// E.g. Nothing to return in this case.	
	string sRemainingLetters = sLHRemain + sRHRemain;	
	
	SetLocalString(oTrap, "XLettersRemain", sRemainingLetters);  	// Now stores "BCDEFGHIJK" as possible remianing letters to choose from.
		
	// SECONDARY PREF CAN USE 5-15
	if(sLetter == "A"){iNumber = 0;}
	else if(sLetter == "B"){iNumber = 1;}
	else if(sLetter == "C"){iNumber = 2;}
	else if(sLetter == "D"){iNumber = 3;}
	else if(sLetter == "E"){iNumber = 4;}
	else if(sLetter == "F"){iNumber = 5;}
	else if(sLetter == "G"){iNumber = 6;}
	else if(sLetter == "H"){iNumber = 7;}
	else if(sLetter == "I"){iNumber = 8;}
	else if(sLetter == "J"){iNumber = 9;}
	else if(sLetter == "K"){iNumber = 10;}
	else if(sLetter == "L"){iNumber = 11;}
	else if(sLetter == "M"){iNumber = 12;}
	else if(sLetter == "N"){iNumber = 13;}

	return iNumber;													// E.g. Returns 1	
}

///////////////////////////////////////////////////////////////////////////////////////
// RETURN A RANDOM PREFIX STRING FROM THOSE THAT REMAIN IN DESIGNATED SERIES (11)
///////////////////////////////////////////////////////////////////////////////////////
string GetRandomSecPref(object oTrap, string sPickFromInitial = "ABCDEFGHIJK");
string GetRandomSecPref(object oTrap, string sPickFromInitial = "ABCDEFGHIJK")
{	
	// VALUE TO RETURN
	string sSECPREF;
	
	string sPickFrom = GetLocalString(oTrap, "LettersRemain");		
	
	// INITIAL SPECTRUM
	if(sPickFrom == ""){sPickFrom = sPickFromInitial;}
	
	int iLettersRemain = GetStringLength(sPickFrom);				// E.g. 11 in this case
	int ThisLetter = Random(iLettersRemain);						// E.g. 0-10 possible here.
	string sLetter = GetSubString(sPickFrom, ThisLetter, 1);		// E.g. 0 would return "A"
	
	// CREATE & STORE REMAINING ALPHABET STRING
	int nRightCount = iLettersRemain - ThisLetter - 1;				// E.g. 11 - 0 - 1 = 10 (-1 is GetSubString 0 correction)
	int nLeftCount = iLettersRemain - nRightCount - 1;				// E.g. 11 - 10 - 1 = 0 (-1 is for this allocation)
	
	string sRHRemain = GetStringRight(sPickFrom, nRightCount);		// E.g. "BCDEFGHIJK" in this case
	string sLHRemain = GetStringLeft(sPickFrom, nLeftCount);		// E.g. Nothing to return in this case.	
	string sRemainingLetters = sLHRemain + sRHRemain;	
	
	SetLocalString(oTrap, "LettersRemain", sRemainingLetters);  	// Now stores "BCDEFGHIJK" as possible remianing letters to choose from.
		
	// SECONDARY PREF CAN USE 5-15
	if(sLetter == "A"){sSECPREF = "dd5_";} 
	else if(sLetter == "B"){sSECPREF = "dd6_";} 
	else if(sLetter == "C"){sSECPREF = "dd7_";} 
	else if(sLetter == "D"){sSECPREF = "dd8_";} 
	else if(sLetter == "E"){sSECPREF = "dd9_";} 
	else if(sLetter == "F"){sSECPREF = "dd10_";} 
	else if(sLetter == "G"){sSECPREF = "dd11_";} 
	else if(sLetter == "H"){sSECPREF = "dd12_";} 
	else if(sLetter == "I"){sSECPREF = "dd13_";} 
	else if(sLetter == "J"){sSECPREF = "dd14_";} 
	else if(sLetter == "K"){sSECPREF = "dd15_";} 

	return sSECPREF;													// E.g. Returns "dd5_"
}

////////////////////////////////////////////////////////////////////////////////////////////	
// RELOCK THE DOOR AFTER TRAP
////////////////////////////////////////////////////////////////////////////////////////////				
void CheckReLock(object oTRAP);
void CheckReLock(object oTRAP)
{	
	if(!GetIsTrapped(oTRAP))
	{
		// FOR COMPATIBILITY
		if(GetLocalInt(oTRAP, "lockedalso") == 0)
		{
			SetLocked(oTRAP, FALSE);
			SetLockKeyRequired(oTRAP, FALSE);
		}
		
		else
		{	
			SetLocked(oTRAP, TRUE);
			AssignCommand(oTRAP, ActionCloseDoor(oTRAP));
		}
	}
	
	else
	{
		DelayCommand(0.2, CheckReLock(oTRAP));	
	}
}

////////////////////////////////////////////////////////////////////////////////////////////	
// DISPLAY THE TRAP GUI (FIRST TIME EMPTY)
////////////////////////////////////////////////////////////////////////////////////////////				
void LBDisplayTrapGUI(object oPC, object oTRAP, int iFIRSTTIME);
void LBDisplayTrapGUI(object oPC, object oTRAP, int iFIRSTTIME)
{		
	// MAIN GUI DISLAY
	DisplayGuiScreen(oPC, "SCREEN_TRAPPICKER", FALSE, "LB_trappicker.xml");
	
	// DISABLE RECOVERY ON INITIAL STARTUP
	//SetGUIObjectDisabled(oPC, "SCREEN_TRAPPICKER", "RecoveryButton", !GetTrapRecoverable(oTRAP));	 
	SetGUIObjectHidden(oPC, "SCREEN_TRAPPICKER", "LBRecover", TRUE);
	
	// KNOWN OR NOT
	string sTRAPNAME = GetLocalString(oTRAP, "TRAPNAMEKNOWN");
	string sTRAPIMAGE = GetLocalString(oTRAP,"TRAPIMAGE");	
	
	// UNKNOWN ON FIRST RUN
	if(iFIRSTTIME || sTRAPNAME == ""){sTRAPNAME = "Trap Type Unkown"; sTRAPIMAGE = "temp0.tga";}
	
	SetGUITexture(oPC, "SCREEN_TRAPPICKER", "TRAP_TOP", sTRAPIMAGE);
	SetGUIObjectText(oPC, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, sTRAPNAME);	
	
	// THE NUMBER OF SECONDARY COMPONENTS REQUIRED FOR DEACTIVATION
	int iSECQTY = GetLocalInt(oTRAP, "SECONDARY");
	
	// RESTORE PROGRESS BARS TO DATE
	int x;
			
	int iSECDONE;
	
	while(x < 14)
	{
		if(GetLocalInt(oTRAP, "PICK_" + IntToString(x) + "FOUND") == 2)
		{
			iSECDONE ++;
		}
		
		x++;	
	}
	
	float fSECFULL = IntToFloat(iSECQTY);
	float fSECDONE = IntToFloat(iSECDONE);			
	float fPercent = fSECDONE/fSECFULL;	
	
	//SendMessageToPC(GetFirstPC(FALSE), " FOUND >>> " + FloatToString(fSECDONE) + " TOTAL >>> " + FloatToString(fSECFULL));
	//SendMessageToPC(GetFirstPC(FALSE), " GOOD BAR >>> " + FloatToString(fPercent));
	
	SetGUIProgressBarPosition(oPC, "SCREEN_TRAPPICKER", "TRAP_PROG_GOOD", fPercent);
	
	int iWORSE = GetLocalInt(oTRAP, "FAILLEVEL");		
	float fNewFail = IntToFloat(iWORSE)/100.0;		
	
	//SendMessageToPC(GetFirstPC(FALSE), " WORSE INT >>> " + IntToString(iWORSE));
	//SendMessageToPC(GetFirstPC(FALSE), " BAD BAR >>> " + FloatToString(fNewFail));
	
	SetGUIProgressBarPosition(oPC, "SCREEN_TRAPPICKER", "TRAP_PROG_BAD", fNewFail);	
	
	///////////////////////////////////////////////////////////////////////////////////////
	// RESET ALL IDENTIFIED ITEMS WITHIN THE TRAP
	// IF "FOUND" == 1: BUTTON FOUND BUT NOT PRESSED
	// IF "FOUND" == 2: BUTTON FOUND AND ALREADY PRESSED
	///////////////////////////////////////////////////////////////////////////////////////
	
	x = 0;
	
	while (x < 14)
	{
		string sBUTTON = "PICK_" + IntToString(x);
		
		if (GetLocalInt(oTRAP, sBUTTON + "FOUND") > 0)
		{
			string sTGAPREF = GetLocalString(oTRAP, sBUTTON + "TGA");
			int iSTATE = GetLocalInt(oTRAP, sBUTTON + "FOUND");
			
			if(iSTATE == 1)
			{
				SetGUITexture(oPC,"SCREEN_TRAPPICKER", sBUTTON, sTGAPREF + "idle.tga");
				SetGUIObjectDisabled(oPC, "SCREEN_TRAPPICKER", sBUTTON, FALSE);
			}
			
			else if(iSTATE == 2)
			{
				SetGUITexture(oPC,"SCREEN_TRAPPICKER", sBUTTON, sTGAPREF + "press.tga");
				SetGUIObjectDisabled(oPC, "SCREEN_TRAPPICKER", sBUTTON, TRUE);
			}
			
			else
			{
				SetGUITexture(oPC, "SCREEN_TRAPPICKER", sBUTTON, "sigil_slot.tga");		
			}
		}
		
		x++;
	}
	
	///////////////////////////////////////////////////////////////////////////////////////
	// PICK USAGE BUTTON
	///////////////////////////////////////////////////////////////////////////////////////
	
	int iPICKSTATE = GetLocalInt(oTRAP, "PICKUSE");
			
	// NOT BEING USED (DEFAULT STATE)
	string sTexture = "b_s0_normal.tga";
	
	if(iPICKSTATE == 0)
	{
		// SHOW IMAGE AS ACTIVELY USING
		sTexture = "b_s0_hover_pressed.tga";
		SetLocalInt(oTRAP, "PICKUSE", 1);
	}		
	
	else
	{
		DeleteLocalInt(oTRAP, "PICKUSE");
	}
	 
	SetGUITexture(oPC, "SCREEN_TRAPPICKER", "LBPickUse", sTexture);																									
}

////////////////////////////////////////////////////////////////////////////////////////////////
// PC CLICKS ON PLACEABLE, DOOR OR ENTERS TRIGGER
////////////////////////////////////////////////////////////////////////////////////////////////

void main()
{
	////////////////////////////////////////////////////////////////////////////////////////////	
	// TRAP CURRENT STATE (RE-DISPLAY IF ALREADY UNDERWAY)
	// NB: TRIGGERS CANNOT BE RE-DISPLAYED! (ONLY PLACEABLE AND DOORS)
	////////////////////////////////////////////////////////////////////////////////////////////	
	
	object oTRAP = OBJECT_SELF;
	int iOBJTYPE = GetObjectType(oTRAP);
	
	// REASON NOT TO FIRE (ALSO USED FOR TRAP COMPLETED AS WELL AS JAMMED)
	if(GetLocalInt(oTRAP, "TRAPSTUCK")){return;}
		
	////////////////////////////////////////////////////////////////////////////////////////////	
	// CURRENT PC LEVEL & SKILLS (TRAP DETECTION ROLLS)
	////////////////////////////////////////////////////////////////////////////////////////////	
		
	object oPC = GetLastUsedBy();	
	if(!GetIsObjectValid(oPC)){oPC = GetEnteringObject();}	
	
	int iPCLevel = GetTotalLevels(oPC, FALSE);
	int iPCSpot = GetSkillRank(SKILL_SPOT,oPC,FALSE);
	int iPCSearch = GetSkillRank(SKILL_SEARCH,oPC,FALSE);
	int iSEARCHING = GetDetectMode(oPC);
	
	int iROLL; int iHIGHEST; int x;
	
	// THREE ROLLS TO EMULATE THE APPROACH
	while (x < 3) 
	{
		iROLL = d20() + iPCSpot;		
		if (iHIGHEST < iROLL){iHIGHEST = iROLL;}		
		x++;
	}
	
	x = 0;
	
	// ALSO THREE SEARCH ROLLS IF WAS IN SEARCH MODE	
	while (x < 3 && iSEARCHING == DETECT_MODE_ACTIVE)
	{
		iROLL = d20() + iPCSearch;
		if (iHIGHEST < iROLL){iHIGHEST = iROLL;}
		x++;
	} 
		
	// HIGHEST DIE ROLL FROM THOSE MADE
	iROLL = iHIGHEST;
	
	////////////////////////////////////////////////////////////////////////////////////////////
	// GET TRAP TYPE BASED ON VAR. (NB: MINOR SPIKE REQUIRES "TRAPTYPE" TO -1 AT BUILD TIME)
	// IF "TRAPTYPE" NOT SET, THEN IT WILL DETERMINE A TRAP BASED ON TRAP TYPE SET, UNLESS ...
	// IF MINOR SPIKE LEFT AS DEFAULT WITHOUT "TRAPTYPE" TO -1, THEN RANDOM TYPE & LEVEL SET.
	// EPIC VERSIONS NOT SUPPORTED.
	////////////////////////////////////////////////////////////////////////////////////////////
	
	int iTYPE = GetLocalInt(oTRAP, "TRAPTYPE");
	
	// FORCE MINOR SPIKE TRAP WITH NO RANDOMNESS
	if (iTYPE == -1){iTYPE = 0;}																											
	
	// TRAP SET BASED ON OBJECT SETTING (OR RANDOM) - BASED ON PC LEVEL
	else if(iTYPE == 0)
	{
		// IF STILL MINOR SPIKE, THEN RANDOMIZE TYPE
		iTYPE = GetTrapBaseType(oTRAP);		
		
		if (iTYPE == 0)
		{
			// 0-10
			iTYPE = Random(11);
		
			// AND ADJUST FOR PC LEVEL (0-4)
			int level = (iPCLevel/4);
			if (level > 4){level = 4;}
			
			iTYPE = iTYPE * 4;
			iTYPE = iTYPE + level;	
		}
	}
	
	////////////////////////////////////////////////////////////////////////////////////////////	
	// TRIGGER - CREATE REAL TRAP NOW
	////////////////////////////////////////////////////////////////////////////////////////////	
		
	if(iOBJTYPE == OBJECT_TYPE_TRIGGER && GetTag(oTRAP) != "NEWTRAP")
	{
		SetTag(OBJECT_SELF, "NEWTRAP");
		
		location loc = GetAheadLocation(oPC, 2.75);
		
		oTRAP = CreateTrapAtLocation(iTYPE, loc, 2.5, "NEWTRAP", STANDARD_FACTION_HOSTILE);
		
		DelayCommand(1.0, DestroyObject(OBJECT_SELF));
	}	
	
	////////////////////////////////////////////////////////////////////////////////////////////		
	// INITIALIZE THE TRAP
	////////////////////////////////////////////////////////////////////////////////////////////	
	
	int iFIRSTTIME = 0; int DDC;
	
	if(!GetLocalInt(oTRAP, "INITIALIZED"))
	{																											
		iFIRSTTIME = 1;
		
		////////////////////////////////////////////////////////////////////////////////////////////		
		// ELSE INITIALIZE THE TRAP NOW! PREPARES TRAP DCS AND TYPE! DISPLAY GUI IF SPOTTED!
		////////////////////////////////////////////////////////////////////////////////////////////	
		
		SetLocalInt(oTRAP, "INITIALIZED", 1);
		SetLocalInt(oTRAP, "ACTIVATED", 1);
		
		////////////////////////////////////////////////////////////////////////////////////////////	
		// PREPARE TRAP DCS 
		////////////////////////////////////////////////////////////////////////////////////////////
		
		// TRAP DISARM DC
		int DC = GetTrapDisarmDC(oTRAP);
		
		if (DC == 0)
		{	 
			DC = 14 + (iPCLevel + Random(iPCLevel/2));
			SetTrapDisarmDC(oTRAP, DC);
		}	
		
		// TRAP DETECT DC
		DDC = GetTrapDetectDC(oTRAP);
		
		if (DDC == 0)
		{
			DDC = (DC/2) + Random(DC/2);
			SetTrapDetectDC(oTRAP, DDC);
		}	
		
		///////////////////////////////////////////////////////////////////////////////////////////////////////
		// INITIALIZE THE TRAP BASED ON TYPE
		///////////////////////////////////////////////////////////////////////////////////////////////////////
		
		// NAME AND IMAGE
		string sTRAPNAME; string sTRAPIMAGE; 
		
		// STRING PREFIX FOR PRIME COMPONENT
		string sPRIMEPREF;
		
		// INT SUFFIX FIX FOR TRAP RECOVERED (NEG AND ACID FIX)
		int iRecover;	
		
		// IMAGES FOR PRIME COMPNENT USE PREF: 0, 1, 2, 3, 4, 16 and 17
		if(iTYPE < 4)//spike trap
		{
			sTRAPNAME = "Spike Trap";
			sTRAPIMAGE = "it_kit_spiketrap.tga";
			sPRIMEPREF = "dd16_";
		}
		
		else if(iTYPE < 8)//holy trap
		{
			sTRAPNAME = "Holy Energy Trap";
			sTRAPIMAGE = "it_kit_holytrap.tga";
			sPRIMEPREF = "dd4y_";
		} 
		
		else if(iTYPE < 12)//tangle trap
		{
			sTRAPNAME = "Tangle Trap";
			sTRAPIMAGE = "it_kit_tangletrap.tga";
			sPRIMEPREF = "dd17_";
		}
		
		else if(iTYPE < 16)//acid trap
		{
			sTRAPNAME = "Acid Blob Trap";
			sTRAPIMAGE = "it_kit_acidblobtrap.tga";
			sPRIMEPREF = "dd4g_";
		}
		
		else if(iTYPE < 20)//fire trap
		{
			sTRAPNAME = "Fire Trap";
			sTRAPIMAGE = "it_kit_firetrap.tga";
			sPRIMEPREF = "dd1_";
		}
		
		else if(iTYPE < 24)//electrical trap
		{
			sTRAPNAME = "Electric Trap";
			sTRAPIMAGE = "it_kit_electricaltrap.tga";
			sPRIMEPREF = "dd0_";
		}
		
		else if (iTYPE < 28)//gas trap
		{
			sTRAPNAME = "Gas Trap";
			sTRAPIMAGE = "it_kit_gastrap.tga";
			sPRIMEPREF = "dd3_";
		}
		
		else if(iTYPE < 32)//frost trap
		{
			sTRAPNAME = "Frost Trap";
			sTRAPIMAGE = "it_kit_frosttrap.tga";
			sPRIMEPREF = "dd2_";
		}
		
		else if(iTYPE < 36)//Neg trap
		{
			sTRAPNAME = "Negative Energy Trap";
			sTRAPIMAGE = "it_kit_negativetrap.tga";
			sPRIMEPREF = "dd4r_";
			
			// BASE ITEM TO RESREF REF FIX
			iRecover = 8;
		}
		
		else if(iTYPE < 40)//Sonic trap
		{
			sTRAPNAME = "Sonic Trap";
			sTRAPIMAGE = "it_kit_sonictrap.tga";
			sPRIMEPREF = "dd2_";
		}
		
		else if(iTYPE < 44)//acid splash trap
		{
			sTRAPNAME = "Acid Splash Trap";
			sTRAPIMAGE = "it_kit_acidsplashtrap.tga";
			sPRIMEPREF = "dd4g_";
			
			// BASE ITEM TO RESREF REF FIX
			iRecover = -8;
		}
		
		// STORE TRAP DETAILS	
		SetLocalString(oTRAP, "TRAPNAME", sTRAPNAME);	
		SetLocalString(oTRAP, "TRAPIMAGE", sTRAPIMAGE);
		SetLocalInt(oTRAP, "TRAPTYPE", iTYPE);	
		
		// STORE TRAP RECOVERY SUFFIX
		iRecover = iRecover + iTYPE + 1;
		string sRecover = IntToString(iRecover);
		if(iRecover < 10){sRecover = "0" + sRecover;}	
		SetLocalString(oTRAP, "TRAPRECOVER", "nw_it_trap0" + sRecover);
		
		////////////////////////////////////////////////////////////////////////////////
		// RANDMISE A PRIMARY COMPONENT BUTTON (IMAGE AND DC + 5)
		////////////////////////////////////////////////////////////////////////////////
		
		// RETURNS RANDOM 0-13
		int iPRIMEBUTTON = GetRandomNumber(oTRAP);
		
		// STORE PRIME BUTTON TGA PREFIX
		string sBUTTON = "PICK_" + IntToString(iPRIMEBUTTON); 			
		SetLocalString(oTRAP, sBUTTON + "TGA", sPRIMEPREF);
		SetLocalInt(oTRAP, sBUTTON + "PRIME", 1);
		
		// PRIMARY BUTTON DC
		SetLocalInt(oTRAP, sBUTTON + "DC", DDC + 5);
		
		////////////////////////////////////////////////////////////////////////////////
		// NOW RANDOMISE 1-13 SECONDARY BUTTONS AVAILABLE (BASED ON TRAP ORIGINAL DC)
		////////////////////////////////////////////////////////////////////////////////
		
		int iSEC = DC/5; if(iSEC < 1){iSEC = 1;} else if(iSEC > 13){iSEC = 13;}
		SetLocalInt(oTRAP, "SECONDARY", iSEC);	

                // DEBUG FEEDBACK
		/*SendMessageToPC(GetFirstPC(FALSE), "<color=CornFlowerBlue>TRAP TYPE >>> " + IntToString(iTYPE)
		+ "\nBASE DC TO FIND >>> " + IntToString(DC) 
		+ "\nPRIME (MAX) DC TO FIND (SECONDARIES LOWER) >>> " + IntToString(DDC+5)
		+ "\nSECONDARY STORED >>> " + IntToString(iSEC) + "</c>");*/
		
		// SendMessageToPC(GetFirstPC(FALSE), " STORING SECONDS >>> " + IntToString(iSEC));
		
		while (iSEC > 0)
		{
			// 13 BUTTONS REMAIN RANDOMIZATION (NEVER RETURNS NUMBER ALREADY USED)
			int iSECBUTTON = GetRandomNumber(oTRAP);			
			sBUTTON = "PICK_" + IntToString(iSECBUTTON);
			
			// MUST USE 11 VALUES OF 5 - 15 (NOT ANY OF THE PRIMES USED)
			string sSECONDPREF = GetRandomSecPref(oTRAP);																			
			SetLocalString(oTRAP, sBUTTON + "TGA", sSECONDPREF);
							
			// AND GIVE EACH BUTTON A DC VALUE TOO
			int iHALFDC = DDC/2; int iRoll = Random(iHALFDC) + iHALFDC;			
			SetLocalInt(oTRAP, sBUTTON + "DC", iRoll);		 	
			
			iSEC = iSEC - 1;			
		}
		
		SetTrapDisarmable(oTRAP, FALSE);
		SetTrapRecoverable(oTRAP, FALSE);
	}
	
	////////////////////////////////////////////////////////////////////////////////////////////
	// TRAP NOW DETECTED! ONLY DISARM VIA GUI! CANNOT BE RECOVERED UNTIL DISABLED!
	////////////////////////////////////////////////////////////////////////////////////////////
	
	if(iROLL < DDC)
	{	
		// SET TRAP STATES
		SetTrapActive(oTRAP, TRUE);	
		SetTrapDetectable(oTRAP, TRUE);
		SetTrapDetectedBy(oTRAP, oPC);			
                   
                  AssignCommand(oPC,SpeakString("TRAP!"));
		
		// PLACE TRAP ON DOOR OR PLACEABLE NOW. (TRIGGER TRAP HAS ALREADY BEEN SETUP ABOVE.)		
		if(iOBJTYPE != OBJECT_TYPE_TRIGGER)
		{		 
			CreateTrapOnObject(iTYPE, oTRAP, STANDARD_FACTION_HOSTILE, "", "");	
		} 			
		
		if(iOBJTYPE == OBJECT_TYPE_PLACEABLE)
		{
			AssignCommand(oPC,ClearAllActions());			
			DelayCommand(0.1, AssignCommand(oPC, ActionInteractObject(oTRAP)));
			
			// FOR COMPATIBILITY
			if(GetLocalInt(oTRAP, "lockedalso") == 0)
			{
				SetLocked(oTRAP, FALSE);
				SetLockKeyRequired(oTRAP, FALSE);
			}
		}
		
		else if(iOBJTYPE == OBJECT_TYPE_DOOR)
		{
			SetLocked(oTRAP, FALSE);
			AssignCommand(oPC,ClearAllActions());
			AssignCommand(oPC, ActionOpenDoor(oTRAP));
			DelayCommand(0.2, CheckReLock(oTRAP));
		}	
		
		SetLocalInt(oTRAP, "TRAPSTUCK", 1);
				
		return;
	}
	
	////////////////////////////////////////////////////////////////////////////////////////////
	// PC SPOTS THE TRAP (STOP!) DISPLAY GUI FOR THE FIRST TIME!
	////////////////////////////////////////////////////////////////////////////////////////////
		
	// ALTHEA CAMPAIGN
	//SetLocalObject(GetMainPC(oPC), "TRAP", oTRAP);	
	
	// OTHER CAMPAIGNS (SP ONLY)
	SetLocalObject(GetModule(), "TRAP", oTRAP);			
		
	AssignCommand(oPC, ClearAllActions());
	AssignCommand(oPC, SpeakString("I've found a trap!"));
	PlayCustomAnimation(OBJECT_SELF, "search" , TRUE, 3.0);	
	
	DelayCommand(0.1, LBDisplayTrapGUI(oPC, oTRAP, iFIRSTTIME));
}	

LB_trappicker.xml: The NEW XML for trap picking: -

<?xml version="1.0" encoding="NWN2UI"?>

<!-- SCREEN DEFINITIONS -->

<UIScene name="SCREEN_TRAPPICKER" x=ALIGN_CENTER y=ALIGN_CENTER width=400 height=400 modal=true idleexpiretime="0.1"
fadeout="0.3" fadein="0.3" draggable=true backoutkey=true scriptloadable=true priority="SCENE_SCRIPT" OnRemove=UIObject_Misc_ExecuteServerScript("gui_trappicking","EXIT","")/>

<!-- Close Button -->

<UIButton name="CloseButton" x=355 y=45 style="STYLE_CLOSE_BUTTON" OnLeftClick=UIButton_Input_ScreenClose()> </UIButton>

<UIButton name="LBPickUse" x=13 y=45 width=27 height=27 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","LP","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","LP") OnToolTip='UIObject_Tooltip_DisplayTooltipString("Toggle Pick Usage - If Available","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'>

<UIFrame state="base" fill="b_s0_normal.tga" />
<!UIFrame state=up fill="b_s0_normal.tga" />
<UIFrame state=hilited fill="b_s0_hover.tga" />

</UIButton>	

<UIButton name="LBRecover" x=170 y=168 width=60 height=60 fill="sigil_slot.tga" MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","R","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","R") OnToolTip='UIObject_Tooltip_DisplayTooltipString("Click To Recover Trap","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'>

<UIFrame state=up fill="recover_normal.tga" />
<UIFrame state=down fill="recover_pressed.tga" />
<UIFrame state=focused fill="recover_hover.tga" />
<UIFrame state=hilited fill="recover_hover_pressed.tga" />
<UIFrame state=hifocus fill="recover_hover_pressed.tga" />
<UIFrame state=disabled fill="recover_hover_pressed.tga" />

</UIButton>	

<!-- Button1 (On left click fires script) -->

<UIButton name="PICK_0" x=340 y=80 width=40 height=40 MouseDownSFX="gui_select"  OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","0","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","0")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_1" x=17 y=80 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","1","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","1")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_2" x=178 y=80 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","2","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","2")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_3" x=97 y=80 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","3","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","3")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_4" x=258 y=80 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","4","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","4")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_5" x=340 y=270 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","5","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","5")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_6" x=17 y=270 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","6","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","6")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_7" x=178 y=270 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","7","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","7")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_8" x=97 y=270 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","8","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","8")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_9" x=258 y=270 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","9","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","9")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_10" x=340 y=143 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","10","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","10")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_11" x=340 y=207 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","11","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","11")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_12" x=17 y=143 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","12","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","12")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>

<UIButton name="PICK_13" x=17 y=207 width=40 height=40 MouseDownSFX="gui_select" OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","13","") OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_trappicking","","13")>
<UIFrame state=base fill="sigil_slot.tga" />
</UIButton>


<UIText name="TRAP_FEEDBACK" x=77 y=49 width=240 height=20 align=center valign=center color="white" fontfamily="Title_Font" text="Trap" />

<UIFrame name="TRAP_TOP" x=170 y=168 width=60 height=60 fill="sigil_slot.tga" OnToolTip='UIObject_Tooltip_DisplayTooltipString("Disable Trap To Recover It","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")' OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_trappicking","R","") />

<UIProgressBar name="TRAP_PROG_GOOD" x=118 y=178 width=18 height=68 vertical=true img="trap_prog_good.tga" />

<UIProgressBar name="TRAP_PROG_BAD" x=265 y=178 width=18 height=68 vertical=true img="trap_prog_bad.tga" />

<UIFrame name="Bar_1" x=112 y=170 width=30 height=85 fill="trap_prog_overbar2.tga"/>

<UIFrame name="Bar_2" x=259 y=170 width=30 height=85 fill="trap_prog_overbar.tga"/>


<!-- Background Image -->

<UIIcon name="TRAP_BACKGROUND" img="TrapBack.tga" x=0 y=0 width=400 height=400 />
<UIFrame x=0 y=0 width=PARENT_WIDTH height=PARENT_HEIGHT border=32 />

FINAL SCRIPT IN NEXT POST (TOO LARGE FOR HERE)

2 Likes

CONTINUING ABOVE …

gui_trappicking: The third and final support script for the xml callbacks …

/////////////////////////////////////////////////////////////////////////////////
// LittleBaron 10/08 (UPDATED & FIXED. INC COMPANION SUPPORT BY LANCE BOTELLE 07/03/22)
// OBJECT_SELF IS THE MAIN PC (NB: CAN DIFFER FROM oPC TRAP PICKER)
// FEEDBACK WHEN PLAYER HOVERS OVER A GUI BUTTON. (UPDATES BUTTON & GIVES INFO)
// SETS TRAP PARTS TO "IDLE" UPON DISCOVERY READY FOR FURTHER INTERACTION
/////////////////////////////////////////////////////////////////////////////////
// ALSO OPERATION WHEN PLAYER LEFT CLICKS A TRAP PART OR RECOVERY GUI BUTTON.
// A TRAP IS SUCCESSFULLY DISARMED IF THE PRIME COMPONENT IS DISABLED (OR ALL LESSER ONES)
// A PRIME COMPONENT IS DC + 5, WHEREAS SECONDARY ONES ARE LOWER DCS (HALF - FULL DC)
// EACH FAILED ATTEMPT WILL INCREASE THE RED BAR SLIGHTLY (CRITICALLY FAILS FULLY)
// EACH SUCCESS INCREASES THE GREEN BAR (EITHER PARTIALLY FOR SECONDARIES OR FULLY FOR PRIME)
// NB: YOU ONLY HAVE A ONE TIME CHANCE TO "RECOVER THE TRAP" AFTER DISARMING IT. (IF AVAILABLE.)
/////////////////////////////////////////////////////////////////////////////////
// CURRENTLY LEFT IN LOCK PICK SUPPORT. USES BEST PICKS FOR BONUS FIRST.
/////////////////////////////////////////////////////////////////////////////////

//#include "alb_functions_core"
#include "x0_i0_position"

////////////////////////////////////////////////////////////////////////////////////////////
// RETRIEVE ANY LOCK PICK BONUS (BEST LOCKPICK USED)
////////////////////////////////////////////////////////////////////////////////////////////
int GetPickBonus(object oPC, object oTRAP);
int GetPickBonus(object oPC, object oTRAP)
{		
	int iBONUS = 0; string sText = "<color=MediumBlue>No Pick Bonus Being Applied.</c>";
	
	if(GetLocalInt(oTRAP, "PICKUSE"))
	{	
		object oPICK = GetItemPossessedBy(oPC,"NW_IT_PICKS004"); 
		
		if(oPICK != OBJECT_INVALID){iBONUS = 10;}		
		if(iBONUS == 0){oPICK = GetItemPossessedBy(oPC,"NW_IT_PICKS003"); iBONUS = 6;}	
		if(iBONUS == 0){oPICK = GetItemPossessedBy(oPC,"NW_IT_PICKS002"); iBONUS = 3;}
		if(iBONUS == 0){oPICK = GetItemPossessedBy(oPC,"NW_IT_PICKS001"); iBONUS = 1;}			
			
		SetLocalObject(oPC, "PICKUSED", oPICK);	
		
		// UPDATE (ALLOW FOR STACK CAPABILITY ALTERATION)
		if(oPICK != OBJECT_INVALID)
		{
			int iSTACK = GetItemStackSize(oPICK);
			if(iSTACK == 1){DestroyObject(oPICK);}
			else{SetItemStackSize(oPICK, iSTACK - 1);}
		}
		
		else
		{
			sText = "<color=MediumBlue>No Picks Available!</c>";	
		}
	}
	
	else if(iBONUS != 0)
	{			
		sText = "<color=CornFlowerBlue>Pick Bonus Applied: " + IntToString(iBONUS) + "</c>";
	}
	
	SendMessageToPC(oPC, sText);
		
	return iBONUS;
}

////////////////////////////////////////////////////////////////////////////////////////////	
// RELOCK THE DOOR AFTER TRAP
////////////////////////////////////////////////////////////////////////////////////////////				
void CheckReLock(object oTRAP);
void CheckReLock(object oTRAP)
{	
	if(!GetIsTrapped(oTRAP))
	{
		// FOR COMPATIBILITY
		if(GetLocalInt(oTRAP, "lockedalso") == 0)
		{
			SetLocked(oTRAP, FALSE);
			SetLockKeyRequired(oTRAP, FALSE);
		}
		
		else
		{	
			SetLocked(oTRAP, TRUE);
			AssignCommand(oTRAP, ActionCloseDoor(oTRAP));
		}
	}
	
	else
	{
		DelayCommand(0.2, CheckReLock(oTRAP));	
	}
}

void main(string sBUTTONHOVER, string sBUTTON)
{
	/////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////
	// HOVER OVER BUTTON FEEDBACK ***************************************************
	/////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////
	
	if(sBUTTONHOVER != "")
	{
		// THE BUTTON HOVERED OVER
		sBUTTONHOVER = "PICK_" + sBUTTONHOVER;	
		
		// SendMessageToPC(GetFirstPC(FALSE), " >>> " + sBUTTONHOVER);
		
		////////////////////////////////////////////////////////////////////////////////
		// GET THE CURRENT PC INTERACTING WITH THE TRAP
		////////////////////////////////////////////////////////////////////////////////
		
		object oPC = GetControlledCharacter(OBJECT_SELF);		
		
		////////////////////////////////////////////////////////////////////////////////
		// PREPARE ANY FEEDBACK (AND SOUND TO PLAY ON FIRST FIND ONLY)
		////////////////////////////////////////////////////////////////////////////////
		
		string sSound = "";	string sBUTNAME = "You find nothing here!";		
		
		////////////////////////////////////////////////////////////////////////////////
		// RECALL BUTTON TGA PREFIX & DC (PRIME DC IS HIGHER. SECONDARIES RANDOM LOWER.)
		////////////////////////////////////////////////////////////////////////////////
		
		// ALTHEA CAMPAIGN
		//object oTRAP = GetLocalObject(OBJECT_SELF, "TRAP"); 
		
		// OTHER CAMPAIGNS (SP ONLY)
		object oTRAP = GetLocalObject(GetModule(), "TRAP");	  
		
		// CHECK FOR TRIGGER TYPE
		int iOBJTYPE = GetObjectType(oTRAP);
		
		// PREVENT SPAM HOVER CHECKS
		if(GetLocalString(oTRAP, "LASTHOVER") == sBUTTONHOVER){return;}		
		else{SetLocalString(oTRAP, "LASTHOVER", sBUTTONHOVER);}
			
		////////////////////////////////////////////////////////////////////////////////
		// ENSURE CURRENT PC IS NEAR TRAP (IN CASE SWITCHED)
		////////////////////////////////////////////////////////////////////////////////
		float fDIS = GetDistanceBetween(oPC, oTRAP);	
		if(fDIS > 0.5){AssignCommand(oPC, ActionMoveToObject(oTRAP, 1, 0.5));}		
		
		string sTGAPREF = GetLocalString(oTRAP, sBUTTONHOVER + "TGA");		
		int iBUTDC = GetLocalInt(oTRAP, sBUTTONHOVER + "DC");	
		
		int iACTIVE = GetLocalInt(oTRAP, "ACTIVATED");
		int iRECOVERABLE = GetTrapRecoverable(oTRAP);
		
		// SendMessageToPC(GetFirstPC(FALSE), "ON THIS BUTTON >>> " + sTGAPREF);
		
		////////////////////////////////////////////////////////////////////////////////
		// DEACTIVATED TRAP ABANDONED (REMOVE IT FROM GAME) - NOT RECOVERED.
		////////////////////////////////////////////////////////////////////////////////
		
		if(sBUTTONHOVER == "PICK_EXIT" && !iACTIVE)
		{			
			if(iOBJTYPE == OBJECT_TYPE_TRIGGER){DestroyObject(oTRAP);}
			
			SetTrapRecoverable(oTRAP, FALSE);	
			SetTrapActive(oTRAP, FALSE);
			SetTrapDetectable(oTRAP, FALSE);
			SetTrapDisarmable(oTRAP, FALSE);	
			return;	
		}
		
		////////////////////////////////////////////////////////////////////////////////
		// OTHER BUTTON HOVER INTERCEPT (RECOVER BUTTON OR TITLE TEXT)
		////////////////////////////////////////////////////////////////////////////////
		
		if(sBUTTONHOVER == "PICK_R" || sBUTTONHOVER == "PICK_LP")
		{			
			if(sBUTTONHOVER == "PICK_LP")
			{
				sBUTNAME = "Toggle Pick Usage";
			}
			
			else if(iACTIVE)
			{
				sBUTNAME = GetLocalString(oTRAP, "TRAPNAMEKNOWN");
				if(sBUTNAME == ""){sBUTNAME = "Trap Type Unkown";}
			}
			
			else 
			{
				sBUTNAME = "Recover Trap";
			}
				
			SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, sBUTNAME);
			return;	
		}
		
		////////////////////////////////////////////////////////////////////////////////
		// OR PREPARE ANY POTENTIAL BUTTON FEEDBACK
		////////////////////////////////////////////////////////////////////////////////
		
		else
		{
			// PREPARE AN APPROPRIATE SOUND FOR COMPONENT FOUND (BASED ON TGA FOUND)
			string sTGAID = GetStringLeft(sTGAPREF, 4); 
			
			//SendMessageToPC(GetFirstPC(FALSE), " >>> " + sTGAID);
			
			if (sTGAID == "dd0_"){sSound = "as_mg_forcefieldexp"; sBUTNAME = "Tesla Coil";}
			else if (sTGAID == "dd1_"){sSound = "as_en_treeonfire_01"; sBUTNAME = "Bomb";}
			else if (sTGAID == "dd2_"){sSound = "as_mg_magicbar1"; sBUTNAME = "Magic Device";}
			else if (sTGAID == "dd3_"){sSound = "as_air_steam_3"; sBUTNAME = "Gas Bladder";}
			else if (sTGAID == "dd4y" || sTGAID == "dd4g" || sTGAID == "dd4r")
			{sSound = "as_en_waterlapshore_b_02"; sBUTNAME = "Fluid Filled Vial";}
			else if (sTGAID == "dd5_"){sSound = "as_sw_chestv3op"; sBUTNAME = "Dial";}
			else if (sTGAID == "dd6_"){sSound = "al_en_woodcreaks05"; sBUTNAME = "Spring";}
			else if (sTGAID == "dd7_"){sSound = "gui_check"; sBUTNAME = "Button";}
			else if (sTGAID == "dd8_"){sSound = "as_cv_ropepully1"; sBUTNAME = "Pulley";}
			else if (sTGAID == "dd9_"){sSound = "as_sw_metalop1"; sBUTNAME = "Turn Key";}
			else if (sTGAID == "dd10"){sSound = "as_pl_siphonleverpull_1"; sBUTNAME = "Lever";}
			else if (sTGAID == "dd11"){sSound = "as_cv_florcreak2"; sBUTNAME = "Trip Wire";}
			else if (sTGAID == "dd12"){sSound = "as_cv_potclang3"; sBUTNAME = "Pressure Plate";}
			else if (sTGAID == "dd13"){sSound = "as_mg_hlyflare1"; sBUTNAME = "Power Crystal";}	
			else if (sTGAID == "dd14"){sSound = "it_eq_fullchain03"; sBUTNAME = "Pull Chain";}
			else if (sTGAID == "dd15"){sSound = "as_sw_lever1"; sBUTNAME = "Clockworks";}
			else if (sTGAID == "dd16"){sSound = "as_cv_shopmetal2"; sBUTNAME = "Metal Spikes";}
			else if (sTGAID == "dd17"){sSound = "sdr_entangle"; sBUTNAME = "Webbing";}
		}
		
		////////////////////////////////////////////////////////////////////////////////
		// THIS COMPONENT BUTTON HAS BEEN FOUND ALREADY!
		////////////////////////////////////////////////////////////////////////////////
		
		if(GetLocalInt(oTRAP, sBUTTONHOVER + "FOUND") > 0)
		{
			if(!iACTIVE)
			{
				sBUTNAME = "Trap Disabled";
				
				if(iRECOVERABLE){sBUTNAME = "Trap Can Be Recovered!";}
			}
				
			SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, sBUTNAME);
				
			return;
		}
		
		////////////////////////////////////////////////////////////////////////////////
		// OTHERWISE WE ARE SEARCHING THIS BUTTON
		////////////////////////////////////////////////////////////////////////////////
		
		else if(!GetLocalInt(oTRAP, "TRAPSTUCK"))
		{		
			// SendMessageToPC(GetFirstPC(FALSE), " CHECKING >>> ");
			
			// OTHERWISE BRIEFLY SHOW MAGNIFYING SEARCH (UPDATE WITH ANYTHING FOUND BELOW)
			SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTONHOVER, "ia_search.tga");	  	  	
			DelayCommand(0.25, SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTONHOVER, "sigil_slot.tga"));
			
			////////////////////////////////////////////////////////////////////////////////
			// GET THE CURRENT PC SKILLS INTERACTING WITH THE TRAP & SEARCH FOR EACH BUTTON
			////////////////////////////////////////////////////////////////////////////////
			
			int iPCSearch = d20() + GetSkillRank(SKILL_SEARCH, oPC);	
					
			//////////////////////////////////////////////////////////////////////////////////////////
			// PC FOUND A COMPONENT
			//////////////////////////////////////////////////////////////////////////////////////////	
			
			if(iPCSearch >= iBUTDC)
			{
				// THIS BUTTON NOW FOUND (STOP FURTHER INTERACTION)
				if(sTGAPREF != "")
				{
					SetLocalInt(oTRAP, sBUTTONHOVER + "FOUND", 1);
				}
				
				// UPDATE GUI IF THIS IS THE PRIME COMPONENT FOUND FOR THIS TRAP
				// NB: TRAP TRIGGERS THE PLAYER CAN GET THE TRAP NAME ANYWAY! (BY HOVERING OVER THE TRAP!)
				if(GetLocalInt(oTRAP, sBUTTONHOVER + "PRIME") || iOBJTYPE == OBJECT_TYPE_TRIGGER)
				{
					string sNAME = GetLocalString(oTRAP, "TRAPNAME");
					string sIMAGE = GetLocalString(oTRAP, "TRAPIMAGE");
					
					// ALLOWS TITLE TO UPDATE WITH TRAP NAME WHEN NOT HOVERING ON A COMPONENT
					SetLocalString(oTRAP, "TRAPNAMEKNOWN", sNAME);						
					SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_TOP", sIMAGE);
				}		
				
				// DOES THI SBUTTON HAVE A VALID IMAGE TO FIND
				if(sTGAPREF != "")
				{
					sTGAPREF = sTGAPREF + "idle.tga";
					DelayCommand(0.5, SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTONHOVER, sTGAPREF));	  	 		
				}
							
				// PLAY DISCOVERY SOUND
				if(sSound != ""){AssignCommand(oPC, PlaySound(sSound));}
			}	
				
			// GIVE THE APPROPRIATE FEEDBACK
			SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, sBUTNAME);	
		}
	}
	
	/////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////
	// LEFT CLICK BUTTON OPERATION **************************************************
	/////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////
	
	else if(sBUTTON != "")
	{
		sBUTTON = "PICK_" + sBUTTON;
	
		// ALTHEA CAMPAIGN
		//object oTRAP = GetLocalObject(OBJECT_SELF, "TRAP"); 
		
		// OTHER CAMPAIGNS (SP ONLY)
		object oTRAP = GetLocalObject(GetModule(), "TRAP");	  
		
		// CHECK FOR TRIGGER TYPE
		int iOBJTYPE = GetObjectType(oTRAP);
		
		// GET THE CURRENT PC INTERACTING WITH THE TRAP
		object oPC = GetControlledCharacter(OBJECT_SELF);		

               ////////////////////////////////////////////////////////////////////////////////
		// DO NOT ENABLE COMPONENTS FOR "DISABLE DEVICE" UNTRAINED PCS
		////////////////////////////////////////////////////////////////////////////////
				
		if(GetSkillRank(SKILL_DISABLE_TRAP, oPC, TRUE) < 1)
		{
			SetNoticeText(oPC, "Only PCs trained in Disable Device can disable components!");
			return;
		}
		
		//SendMessageToPC(GetFirstPC(FALSE), " >>>> " + GetName(OBJECT_SELF));
		
		/////////////////////////////////////////////////////////////////////////////
		// TOGGLE PICK USAGE
		/////////////////////////////////////////////////////////////////////////////		
		
		if(sBUTTON == "PICK_LP")
		{			
			int iPICKSTATE = GetLocalInt(oTRAP, "PICKUSE");
			
			// NOT BEING USED (DEFAULT STATE)
			string sTexture = "b_s0_normal.tga";
			string sText = "<color=MediumBlue>Not using available picks.</c>";
			
			if(iPICKSTATE == 0)
			{
				// SHOW IMAGE AS ACTIVELY USING
				sTexture = "b_s0_hover_pressed.tga";
				sText = "<color=CornFlowerBlue>Using any picks available.</c>";
				SetLocalInt(oTRAP, "PICKUSE", 1);
			}		
			
			else
			{
				DeleteLocalInt(oTRAP, "PICKUSE");
			}
						
			SetNoticeText(oPC, sText);
			SendMessageToPC(oPC, sText);
			 
			SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", "LBPickUse", sTexture);
			
			return;
		}
		
		/////////////////////////////////////////////////////////////////////////////
		// ANIMATION FOR TRAP OBJECT TYPE
		/////////////////////////////////////////////////////////////////////////////
		
		if(GetLocalInt(oTRAP, sBUTTON + "FOUND") == 1 || sBUTTON == "PICK_R")
		{		
			if(iOBJTYPE == OBJECT_TYPE_TRIGGER)
			{
				PlayCustomAnimation(oPC, "disableground", FALSE, 2.0);
			}
			
			else 
			{
				PlayCustomAnimation(oPC, "disablefront", FALSE, 2.0);
			}
		}
		
		/////////////////////////////////////////////////////////////////////////////
		// RECOVER THE TRAP BUTTON
		/////////////////////////////////////////////////////////////////////////////
		
		if(sBUTTON == "PICK_R")
		{
			// CORRECTED RESRREF STRING FOR TRAP RECOVERY
			string sTrapRR = GetLocalString(oTRAP, "TRAPRECOVER");
			
			CreateItemOnObject(sTrapRR, oPC, 1, "", TRUE);
			
			SetTrapDisabled(oTRAP);
			
			// FOR COMPATIBILITY
			if (GetLocalInt(oTRAP,"lockedalso") == 0)
			{
				SetLocked(oTRAP,FALSE);
				SetLockKeyRequired(oTRAP,FALSE);
			}
			
			CloseGUIScreen(OBJECT_SELF, "SCREEN_TRAPPICKER");
			return;	 
		}	
		
		/////////////////////////////////////////////////////////////////////////////
		// TRAP DEACTIVATE BUTTONS
		/////////////////////////////////////////////////////////////////////////////
		
		if(GetLocalInt(oTRAP, sBUTTON + "FOUND") == 0){return;}
		
		/////////////////////////////////////////////////////////////////////////////
		// CALCULATE PC SUCCESS WITH THIS BUTTON (NB: PRIME COMPNENT DC IS HIGHER!)	
		/////////////////////////////////////////////////////////////////////////////
		
		string sTGAPREF = GetLocalString(oTRAP, sBUTTON + "TGA");		
		int iBUTDC = GetLocalInt(oTRAP, sBUTTON + "DC");
		
		// THE NUMBER OF SECONDARY COMPONENTS REQUIRED FOR DEACTIVATION
		int iSECQTY = GetLocalInt(oTRAP, "SECONDARY");
		
		int iRank = GetSkillRank(SKILL_DISABLE_TRAP, oPC);
		int iBonus = GetPickBonus(oPC, oTRAP);
		int iRoll = d20() + iRank + iBonus;
		
		// POSITIVE RESULT IS A SUCCESS. NORMAL FAIL (CAN RETRY) BETWEEN 0 and -10.
		// CRITICALS FAILS AT < -10 (TRAP NOW UNREMOVABLE) and < -15 (SETS OFF TRAP)
		
		int iRESULT = iRoll - iBUTDC; int iCRITICALFAIL = 0; string sSound = "";
		
		//////////////////////////////////////////////////////////////////////////////////////////
		// PLAY A SOUND INTERACTION REGARDLESS
		//////////////////////////////////////////////////////////////////////////////////////////	
		
		if (sTGAPREF == "dd0_"){sSound = "as_mg_mephitobelisk01";}
		else if (sTGAPREF == "dd1_"){sSound = "as_mg_soulsplitter01";}
		else if (sTGAPREF == "dd2_"){sSound = "as_mg_siphonon_1";}
		else if (sTGAPREF == "dd3_"){sSound = "as_mg_treepoisoned_01";}
		else if (sTGAPREF == "dd4_"){sSound = "as_cv_claybreak3"; DelayCommand(1.0, AssignCommand(oPC, PlaySound("as_en_waterlapshore_b_02")));}
		else if (sTGAPREF == "dd5_"){sSound = "as_sw_chestv3op";}
		else if (sTGAPREF == "dd6_"){sSound = "al_en_woodcreaks05";}
		else if (sTGAPREF == "dd7_"){sSound = "gui_check";}
		else if (sTGAPREF == "dd8_"){sSound = "as_cv_ropepully1";}
		else if (sTGAPREF == "dd9_"){sSound = "as_sw_metalop1";}
		else if (sTGAPREF == "dd10"){sSound = "as_pl_siphonleverpull_1";}
		else if (sTGAPREF == "dd11"){sSound = "as_cv_florcreak2";}
		else if (sTGAPREF == "dd12"){sSound = "as_cv_potclang3";}
		else if (sTGAPREF == "dd13"){sSound = "as_mg_unholyfavor";}
		else if (sTGAPREF == "dd14"){sSound = "it_eq_fullchain03";}
		else if (sTGAPREF == "dd15"){sSound = "as_mg_gnomish_on1";}
		else if (sTGAPREF == "dd16"){sSound = "as_cv_shopmetal2";}
		else if (sTGAPREF == "dd17"){sSound = "sdr_entangle";}
			
		AssignCommand(oPC, PlaySound(sSound));
				
		//////////////////////////////////////////////////////////////////////////////////////////
		// PC SUCCESSFULLY DEACTIVATES A COMPONENT (NB: SECONDARY COMPONENTS HAVE LOWER DCS)
		//////////////////////////////////////////////////////////////////////////////////////////	
		
		if(iRESULT > 0)
		{			
			// UPDATE GUI BUTTONS AND GIVE FEEDBACK
			SetGUIObjectDisabled(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTON, TRUE);		
			SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, "Component Success!");					
			SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTON, sTGAPREF + "press.tga");
			
			// RECORD COMPONENT BUTTON SUCCESSFULLY DEACTIVATED
			SetLocalInt(oTRAP, sBUTTON + "FOUND", 2);
			
			// PREPARE FULLY DISARMED
			int iDISARMED = 0;
			
			////////////////////////////////////////////////////////////////////////////
			// THIS WAS THE PRIME COMPONENT!
			////////////////////////////////////////////////////////////////////////////
			
			if(GetLocalInt(oTRAP, sBUTTON + "PRIME")){iDISARMED = 1;}
			
			////////////////////////////////////////////////////////////////////////////
			// ELSE IT WAS A SECONDARY (HOW MANY ARE NOW DONE)
			////////////////////////////////////////////////////////////////////////////
			
			else
			{		
				int x;
				
				int iSECDONE;
				
				while(x < 14)
				{
					if(GetLocalInt(oTRAP, "PICK_" + IntToString(x) + "FOUND") == 2)
					{
						iSECDONE ++;
					}
					
					x++;	
				}
				
				float fSECFULL = IntToFloat(iSECQTY);
				float fSECDONE = IntToFloat(iSECDONE);			
				float fPercent = fSECDONE/fSECFULL;
							
				//SendMessageToPC(GetFirstPC(FALSE), " FOUND >>> " + FloatToString(fSECDONE) + " TOTAL >>> " + FloatToString(fSECFULL));
				//SendMessageToPC(GetFirstPC(FALSE), " GOOD BAR >>> " + FloatToString(fPercent));
				
				// FULLY DISARMED
				if(fPercent >= 1.0){iDISARMED = 1;}
					
				// PARTIALLY DISARMED (AND POTENTIALLY SOME BAD BAR REDRESS)
				else
				{			
					SetGUIProgressBarPosition(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_PROG_GOOD", fPercent);
					
					float fIMPROVE = IntToFloat(iRESULT);
					float fNewFail = (GetLocalFloat(oTRAP, "FAILLEVEL") - fIMPROVE)/100.0;
					if(fNewFail < 0.0){fNewFail = 0.0;}
					SetLocalFloat(oTRAP, "FAILLEVEL", fNewFail);				
					
					SetGUIProgressBarPosition(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_PROG_BAD", fNewFail);	
				}
			}
			
			//////////////////////////////////////////////////////////////////////////
			// FULLY DISARMNED! PREPARE ANY POTENTIAL TRAP RECOVERY! DON'T CLOSE GUI YET!
			//////////////////////////////////////////////////////////////////////////
			
			if(iDISARMED)
			{
				SetGUIProgressBarPosition(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_PROG_GOOD", 1.0);
				
				// LOCK OUT BUTTONS
				int x;
				
				while(x < 14)
				{
					string sBUTTONX = "PICK_" + IntToString(x);
					SetGUIObjectDisabled(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTONX, TRUE);				
					x++;	
				}
					
				// LEAVE ON TRIGGERS TO ALLOW TRAP RECOVERY
				if(iOBJTYPE != OBJECT_TYPE_TRIGGER){SetTrapDisabled(oTRAP);}
					
				SetTrapActive(oTRAP, FALSE); 
				DeleteLocalInt(oTRAP, "ACTIVATED");
				
				// TRAP CAN NOW BE RECOVERED
				SetTrapRecoverable(oTRAP, TRUE);
				
				DelayCommand(1.0, AssignCommand(oPC, PlaySound("gui_trapdisarm")));
				
				//SetGUIObjectDisabled(OBJECT_SELF, "SCREEN_TRAPPICKER", "RecoveryButton", FALSE);	 
				//SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "RecoveryButton", -1, "Recover");	
				SetGUIObjectHidden(OBJECT_SELF, "SCREEN_TRAPPICKER", "LBRecover", FALSE);	 				
				
				// FOR COMPATIBILITY
				if(GetLocalInt(oTRAP, "lockedalso") == 0)
				{
					SetLocked(oTRAP, FALSE);
					SetLockKeyRequired(oTRAP, FALSE);
				}
				
				// PREVENT FURTHER INTERACTION
				SetLocalInt(oTRAP, "TRAPSTUCK", 1);	
				
				// GIVE ALL PARTY MEMBERS XP
				int iTrapXP = 5 * GetTrapDisarmDC (oTRAP);		
				
				// ALTHEA CAMPAIGN 
				//PartyXPAward(iTrapXP, 1, 2, "Trap Disarmed!");	
				
				// OTHER CAMPAIGNS (SP ONLY)
				SetNoticeText(oPC, "Trap Disarmed!");
				GiveXPToCreature(oPC, iTrapXP);
			}			
		} 
		
		//////////////////////////////////////////////////////////////////////////////////////////
		// PC NORMAL FAIL TO DEACTIVATE A COMPONENT (NB: SECONDARY COMPONENTS HAVE LOWER DCS)
		// BUT CAN RETRY THIS COMPONENT
		//////////////////////////////////////////////////////////////////////////////////////////	
		
		else if(iRESULT > -10)
		{
			int iWORSE = GetLocalInt(oTRAP, "FAILLEVEL") + iBUTDC;
			SetLocalInt(oTRAP, "FAILLEVEL", iWORSE);		
			float fNewFail = IntToFloat(iWORSE)/100.0;
			
			//SendMessageToPC(GetFirstPC(FALSE), " WORSE INT >>> " + IntToString(iWORSE));
			//SendMessageToPC(GetFirstPC(FALSE), " BAD BAR >>> " + FloatToString(fNewFail));
			
			// WENT SUPER CRITICAL!
			if(fNewFail >= 0.95){iCRITICALFAIL = 1;}
			
			// BUMP UP THE BAD METER!	
			else
			{			
				AssignCommand(oPC, SpeakString("Drats!"));
				
				// UPDATE GUI BUTTONS AND GIVE FEEDBACK		
				SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, "Component Fail!");	
				SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTON, sTGAPREF + "press.tga");		
				DelayCommand(1.0,SetGUITexture(OBJECT_SELF, "SCREEN_TRAPPICKER", sBUTTON, sTGAPREF + "idle.tga"));			
				SetGUIProgressBarPosition(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_PROG_BAD", fNewFail);			
								
				DelayCommand(1.0, AssignCommand(oPC, PlaySound("gui_criticalfail2")));
			}
		}
		
		//////////////////////////////////////////////////////////////////////////////////////////
		// PC CRITICAL FAILS TO DEACTIVATE A COMPONENT (TRAP CAN NO LONGER BE DISARMED)
		//////////////////////////////////////////////////////////////////////////////////////////	
			
		else if(iRESULT > - 15)
		{		
			// UPDATE GUI BUTTONS AND GIVE FEEDBACK	
			SetGUIObjectText(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_FEEDBACK", -1, "Critical Failure!");	
			SetGUIProgressBarPosition(OBJECT_SELF, "SCREEN_TRAPPICKER", "TRAP_PROG_BAD", 1.0);
			
			// FOR COMPATIBILITY
			if (GetLocalInt(oTRAP,"lockedalso") == 0)
			{
				SetLocked(oTRAP, FALSE);
				SetLockKeyRequired(oTRAP, FALSE);
			}
			
			AssignCommand(oPC, SpeakString("Jammed!"));			
			AssignCommand(oPC, PlaySound("gui_criticalfail2"));
			
			// TRAP NOW
			if (iOBJTYPE != OBJECT_TYPE_TRIGGER)
			{		 
				int iTYPE = GetLocalInt(oTRAP, "TRAPTYPE");
				CreateTrapOnObject(iTYPE, oTRAP, STANDARD_FACTION_HOSTILE, "", "");			
			} 	
			
			// FAILED TRAP STATE
			SetTrapRecoverable(oTRAP, FALSE);	
			SetTrapActive(oTRAP, TRUE);
			SetTrapDetectable(oTRAP, TRUE);
			SetTrapDisarmable(oTRAP, FALSE);	
			
			// PREVENT FURTHER INTERACTION
			SetLocalInt(oTRAP, "TRAPSTUCK", 1);		
			
			// AND CLOSE!		
			DelayCommand(2.0, CloseGUIScreen(OBJECT_SELF, "SCREEN_TRAPPICKER"));			
		}
		
		//////////////////////////////////////////////////////////////////////////////////////////
		// PC CRITICAL FAILS TO DEACTIVATE A COMPONENT (TRAP HAS ALSO GONE OFF!)
		//////////////////////////////////////////////////////////////////////////////////////////	
		
		else{iCRITICALFAIL = 1;}	
		
		//////////////////////////////////////////////////////////////////////////////////////////	
		// WENT SUPER CRITICAL! SET OFF TRAP!
		//////////////////////////////////////////////////////////////////////////////////////////	
		
		if(iCRITICALFAIL)
		{		
			// CLOSE GUI
			CloseGUIScreen(OBJECT_SELF, "SCREEN_TRAPPICKER");
			
			// PREVENT FURTHER INTERACTION
			SetLocalInt(oTRAP, "TRAPSTUCK", 1);	
			
			// TRAP NOW
			if (iOBJTYPE != OBJECT_TYPE_TRIGGER)
			{		 
				int iTYPE = GetLocalInt(oTRAP, "TRAPTYPE");
				CreateTrapOnObject(iTYPE, oTRAP, STANDARD_FACTION_HOSTILE, "", "");			
			} 	
			
			// FAILED TRAP STATE
			SetTrapRecoverable(oTRAP, FALSE);	
			SetTrapActive(oTRAP, TRUE);
			SetTrapDetectable(oTRAP, TRUE);
			SetTrapDisarmable(oTRAP, FALSE);	
						
			AssignCommand(oPC, ClearAllActions(TRUE));
			AssignCommand(oPC, SpeakString("Oh no!"));
			AssignCommand(oPC, PlaySound("gui_criticalfail2"));
			
			if(iOBJTYPE == OBJECT_TYPE_TRIGGER)
			{
				// GET NEAREST PC TO TRIGGER (AVOIDS EXPLOIT)
				object oPCNEAR = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oTRAP, 1, CREATURE_TYPE_IS_ALIVE, CREATURE_ALIVE_TRUE);
				location lLoc = GetAheadLocation(oPCNEAR, DISTANCE_TINY);
AssignCommand(oPCNEAR, ClearAllActions(TRUE));
				AssignCommand(oPCNEAR, ActionForceMoveToLocation(lLoc, 1));	
			}
			
			else if(iOBJTYPE == OBJECT_TYPE_PLACEABLE)
			{
				DelayCommand(0.1, AssignCommand(oPC, ActionInteractObject(oTRAP)));
				
				// FOR COMPATIBILITY
				if(GetLocalInt(oTRAP, "lockedalso") == 0)
				{
					SetLocked(oTRAP, FALSE);
					SetLockKeyRequired(oTRAP, FALSE);
				}
			}
			
			else if(iOBJTYPE == OBJECT_TYPE_DOOR)
			{
				SetLocked(oTRAP, FALSE);
				AssignCommand(oPC, ActionOpenDoor(oTRAP));
				DelayCommand(0.2, CheckReLock(oTRAP));
			}
		}	
	}
}

image

1 Like

Thanks for putting the time and effort to fix these final things!

Everything seems to be working great now!

I only have one small request, if that isn’t too much to ask for. The final text “Trap disarmed!” I would have liked to change into something graphically like in this picture:

trappicking4

You might remember when you helped me with the Quest update GUI a while back. Could one make the “Trap disarmed!” show with white text something along the lines like the picture?

I found this code in the gui_trappicking script (line 537, I think) that I guess is what makes this line appear:

	// OTHER CAMPAIGNS (SP ONLY)
				SetNoticeText(oPC, "Trap Disarmed!");
				GiveXPToCreature(oPC, iTrapXP);

Is this very hard to do? Does one have to dabble with xml coding for that to look in the picture perhaps? Maybe you can’t do it directly in the script?

I have this is mine … so, yes, it is possible. However, I have quite a bit of code differences to you in this arrangement. If you really want to consider this, I would recommend downloading my module (now uploaded) and comparing your code with mine, and see if it is something you could do.

Mine is all handled in the function just above (or below) those lines, which say ALTHEA. But, that function is tied into a lot of other stuff. i.e. It’s not something I would want to have to do at the moment … maybe at a later time. But, as I say, you may be able to grab what you need from my mod. Up to you. :slight_smile:

Actually, I managed to solve it myself. :slightly_smiling_face:

I just used some of the xml code from the journal update thing. So now it shows up at the edge of the screen. Maybe it’s not perfect but I think it looks quite nice, and it’s way better than the boring yellow text that I now have very little of in the module I’m working on now (since we changed the journal update and quest receive xml thing).

1 Like

Excellent! :+1:

Every little touch helps! :slight_smile:

One tiny thing that I changed in the gui_trappicking script, that I found easier to see ingame was this:

sText = "<color=MediumBlue>No Picks Available!</c>";	

I changed it to this:

sText = "<c=#1f75fe>No Picks Available!</c>";

This color is much easier to read than the MediumBlue that you used. Just my opinion, but I thought I could share it.

@andgalf

Thanks for that info :+1: - It’s a great help as I am colour blind, and so it is hard for me to tell the best colours to use. My wife is forever telling me. The last release had quite a few colour alterations.

@andgalf

You will also need to do the line a few above too…

//string sText = “<color=MediumBlue>No Pick Bonus Being Applied.”;
string sText = “<color=#1f75fe>No Pick Bonus Being Applied.”;

Colour is better thanks!