Repository navigation
[3] Adding Building to Keycard System
As of version 4.1.0, you can add regular buildings on the map to the Custom Keycards system. Unlike regular Keycard Doors, you will need the ClassName of the building itself, its XYZ position and the ID of the building door(s) that should open as Keycard Door. To get new data (building className + position and door ID) special item was added that will help you in this, more details below.
You can create an infinite number of .json files with different names in the Static_Locations folder. All these files will be loaded on server startup (you can check this by looking in your server script.log and finding this line there SCRIPT : [INFO] [Custom Keycards] Successfully loaded XX static location(s).)
The Keycard Building location config is very similar to the Keycard Door location config. Let's start in order:
"LocationName": "Your Location Name" - is initially created just for you, you can put any text you want here. This text will be used in the logs.
"KeycardBuildings": [] - Buildings whose doors you want to use as Keycard Door. These buildings can be many, separated by a comma.
Now let's look at Keycard Building:
"BuildingClassName": "BuildingClassName" - ClassName of your building, either enter it yourself or use EVG_CustomKeycardsHelper.
"BuildingPosition": [] - XYZ position of your building. This position and ClassName will be used to find this building, if it is not found, an error will be displayed in script.log. I recommend to use EVG_CustomKeycardsHelper to get this XYZ position.
"BuildingDoors": [] - Building doors that will be converted to Keycard Door. You can add multiple doors, separated by a comma.
Now let's loot at Keycard Door in Keycard Building:
"DoorId": 0 - thats the only difference between normal Keycard Door and Building's Keycard Door. Each door in building has its own ID, I recommend to use EVG_CustomKeycardsHelper to get this IDs.
"AutoCloseTime": 60.0 - Time (in seconds) until the door closes automatically. If the value is 0, the door will not close until server restart.
"ItemsToOpen": [] - ClassName(s) of the item(s) that will open this door. You can use any item(s), even a can of beans.
"DamageToItem": 30.0 - Damage to the item after it opens this door. This value is NOT a percentage.
"OpenSound": 1 - 1 - Enabled / 0 - Disabled. Whether the opening sound of this door will be played.
"ErrorSound": 1 - 1 - Enabled / 0 - Disabled. Whether the error sound of this door will be played.
"CloseSound": 1 - 1 - Enabled / 0 - Disabled. Whether the close sound of this door will be played.
"AlarmSound": 0 - 1 - Enabled / 0 - Disabled. Whether the alarm sound of this door will be played.
"AlarmSoundSetName": "CK_KeycardAlarm_SoundSet" - The name of the sound to be played as alarm.
"AlarmPositions": [] - XYZ position to play the alarm sound. There can be several of these positions. If the position is equal to zero vector (0, 0, 0), the sound will be played on the door itself.
"Notification": 0 - 1 - Enabled / 0 - Disabled. Will this door send notification of it been openned to all players.
"NotificationLocationName": "Zelenogorsk" - Location name that will be used in notification.
"NotificationText": "Keycard Room was unlocked at %1" - Notification text. %1 will be replaced by "NotificationLocationName", you can also remove %1 from text.
"NotificationTime": 15 - Time (in seconds) that notification will be shown to players.
"LootCrates": [] - Loot Crates settings. More details below.
With the 4.1.0 update, Loot Crates have been added to the mod. They are linked to specific Keycard Doors and have different settings. Each Keycard Door can have multiple Loot Crates separated by a comma.
"ClassName": "evg_MediumCrate_01" - Here you must enter the ClassName of Loot Crate. All ClassNames can be found in the .INFO folder in the @Custom Keycards mod folder.
"Position": [] - XYZ position of this Loot Crate.
"Orientation": [] - XYZ orientation of this Loot Crate.
"SpawnChance": 25.0 - The chance of this Loot Crate to spawn. Percentage, from 0 to 100.
"SpawnType": 0 - There are 3 SpawnType for Loot Crates. 0 Spawns Loot Crate at server start. 1 Spawns Loot Crate after opening Keycard Door and despawn this Loot Crate after closing Keycard Door. 2 Spawns Loot Crate after opening Keycard Door, but without despawn.
"UnlockTime": 5 - Time to Unlock Loot Crate. If the value is 0, the Loot Crate will be Unlocked.
"ItemsToOpen": [] - ClassName(s) of item(s) that can be used to Unlock the Loot Crate.
"DamageToItem": 25.0 - Damage to the item used to Unlock this Loot Crate. This value is NOT a percentage.
"LootTableNames": [] - Name of the file(s) (without .json) with the loot preset(s). These file(s) must be located in the LootTables folder. You can use multiple files, one random will be selected when the loot is spawned.
EVG_CustomKeycardsHelper is an item that will help you with getting the building data and its doors id. Just spawn it and while holding it in your hands, walk up to the building, you will see action to get the building data, this data will be copied to your clipboard. If you walk up to the door of the building you will get another action, it does nothing but shows the ID of the door your character is looking at.
Video of using EVG_CustomKeycardsHelper.
0_DefaultStaticLocation.json is a working config that is created automatically if the Static_Locations folder is empty. In this file you can see what a properly filled config looks like (there is only one building with one door in this config, you can add more):
{
"LocationName": "Zelenogorsk Keycard Buildings Config",
"KeycardBuildings": [
{
"BuildingClassName": "CoolBuilding_ClassName",
"BuildingPosition": [
1234.5670166015626,
1234.5670166015626,
1234.5670166015626
],
"BuildingDoors": [
{
"DoorId": 0,
"AutoCloseTime": 60.0,
"ItemsToOpen": [
"evg_keycards_Tisy01",
"evg_keycards_Red"
],
"DamageToItem": 30.0,
"OpenSound": 1,
"ErrorSound": 1,
"CloseSound": 1,
"AlarmSound": 0,
"AlarmSoundSetName": "CK_KeycardAlarm_SoundSet",
"AlarmPositions": [
[
0.0,
0.0,
0.0
]
],
"Notification": 0,
"NotificationLocationName": "Zelenogorsk",
"NotificationText": "Keycard Room was unlocked at %1",
"NotificationTime": 15,
"LootCrates": [
{
"ClassName": "evg_MediumCrate_01",
"Position": [
1234.5670166015626,
1234.5670166015626,
1234.5670166015626
],
"Orientation": [
0.0,
0.0,
0.0
],
"SpawnChance": 25.0,
"SpawnType": 0,
"UnlockTime": 5,
"ItemsToOpen": [
"Lockpick"
],
"DamageToItem": 25.0,
"LootTableNames": [
"0_DefaultLootTable"
]
}
]
}
]
}
]
}