void main() { object oItem = GetEventParamObject(0); object oTarget = GetEventParamObject(1); object oPC = OBJECT_SELF; // Check if the item is being used in the specified areas object oArea = GetArea(oPC); string sAreaTag = GetTag(oArea); if (sAreaTag != "A_CAS_CASINOCOINS" && sAreaTag != "A_CAS_CASINOVAULT" && sAreaTag != "A_CAS_WEDFOREST" && sAreaTag != "A_CAS_WEDDINGME001" && sAreaTag != "A_CAS_SLEEPYCREEK") { SendMessageToPC(oPC, "This item cannot be used in this area."); return; } // Check if a valid target has been selected if (oTarget == OBJECT_INVALID) { SendMessageToPC(oPC, "No valid target selected."); return; } // Check if the target has the variable 'cas_securityroom' set if(GetLocalInt(oTarget, "cas_securityroom") > 0) { // If the variable is set, retrieve the waypoint object for the exit object oWaypointExit = GetObjectByTag("WP_CAS_SEC_EXIT"); if(oWaypointExit == OBJECT_INVALID) { SendMessageToPC(oPC, "Exit waypoint not found."); return; } // Get the location of the exit waypoint location lDestinationExit = GetLocation(oWaypointExit); // Move the target to the exit waypoint AssignCommand(oTarget, ActionJumpToLocation(lDestinationExit)); SendMessageToPC(oTarget, "You've been sent to the exit of the security area."); } else { // If the variable 'cas_securityroom' is not set, continue with the original logic // Retrieve the waypoint object using its tag for the security room object oWaypointSecurity = GetObjectByTag("WP_CAS_SECURITY"); if (oWaypointSecurity == OBJECT_INVALID) { SendMessageToPC(oPC, "Security waypoint not found."); return; } // Get the location of the security room waypoint location lDestinationSecurity = GetLocation(oWaypointSecurity); // Move the target to the security room waypoint AssignCommand(oTarget, ActionJumpToLocation(lDestinationSecurity)); SendMessageToPC(oTarget, "Hello! You've been sent to the security cells of the Casino. Please wait for the security to come deal with you."); } }