Event List - djkrose/7DTD-ScriptingMod GitHub Wiki
Overview
Click on any of the events for details:
- animalDamaged
- animalDied
- chatMessage
- chunkLoaded
- chunkMapCalculated
- chunkUnloaded
- eacPlayerAuthenticated
- eacPlayerKicked
- entityLoaded
- entityUnloaded
- gameAwake
- gameShutdown
- gameStartDone
- gameStatsChanged
- logMessageReceived
- playerDamaged
- playerDied
- playerDisconnected
- playerEnteredChunk
- playerExpGained
- playerLevelUp
- playerLogin
- playerSaveData
- playerSpawnedInWorld
- playerSpawning
- serverRegistered
- zombieDamaged
- zombieDied
Details
The following list shows all events and an example of event data in JSON format. Some notes:
- Event data values can be null if they have no value or don't apply for this event.
- JSON properties can be in a different order than listed here. Don't rely on the order!
- JSON data is always one line and without comments.
animalDamaged
Called when an animal suffered damage from anyone or anything.
Same event data as playerDamaged, but entitySteamId
is always null obviously.
animalDied
Called when an animal was killed or died by itself.
Same event data as playerDamaged, but entitySteamId
is always null obviously.
chatMessage
Called when an in-game chat message was sent. Can be from a player, from a telnet console, or from the server directly.
Note: Other mods can block or modify chat messages, for example to apply colors or filter out chat commands. Scripting Mod receives only the filtered chat message in the mod queue.
Standard player chat example:
{
"messageType": "Chat", // possible values: PlainTextLocal, EntityWasKilled, JoinedGame, LeftGame, ChangedTeam, Chat
"from": "djkrose",
"message": "Hello World!",
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 20
}
}
Exampe for chat message when player died:
{
"messageType": "EntityWasKilled", // possible values: PlainTextLocal, EntityWasKilled, JoinedGame, LeftGame, ChangedTeam, Chat
"from": "djkrose",
"message": "", // Always empty for messageType "EntityWasKilled" because the client uses it's own translation
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 20
}
}
chunkLoaded
Called when a chunk is loaded into the game engine because a player needs it. Called frequently - use with care!
{
"chunkKey": 805306223,
"chunkPos": {
"x": -145,
"z": 47
}
}
chunkMapCalculated
Called when the map for the chunk was calculated by generating a pixel color for each of the 16x16 blocks. Called frequently - use with care!
Same event data as chunkLoaded.
chunkUnloaded
Called when a chunk is unloaded from the game engine because it is not used by any player anymore. Called frequently - use with care!
Same event data as chunkLoaded.
eacPlayerAuthenticated
Called when a player successfully passed the EAC check on an EAC-enabled server.
{
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": -1, // entity is yet unknown at this point
"ip": "127.0.0.1",
"ping": 0
}
}
eacPlayerKicked
Called when a player got kicked due to failed EAC check on an EAC-enabled server.
{
"reason": "EAC violation: ClientAuthenticationFailed - Authentication timed out (1\/2)",
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": -1,
"ip": "127.0.0.1",
"ping": 0
}
}
entityLoaded
Called when any entity (zombie, item, air drop, player, ...) is spawned in the world, both loaded and newly created. Called frequently - use with care!
{
"entityType": "EntityZombieCrawl",
"entityId": 2913634,
"entityName": "zombieSteveCrawler",
"position": {
"x": -2379,
"y": 106,
"z": 656
}
}
entityUnloaded
Called when any entity (zombie, item, air drop, player, ...) disappears from the world, e.g. it got killed, picked up, despawned, logged off, ... Called frequently - use with care!
{
"reason": "Unloaded",
"entityType": "EntityMinibike",
"entityId": 2787991,
"entityName": "minibike",
"position": {
"x": -2462,
"y": 113,
"z": 780
}
}
gameAwake
Called during game start on every mod, before the World is ready.
No event data.
gameShutdown
Called when the game is in the process of shutting down, after connections were closed and resources were unloaded.
No event data.
gameStartDone
Called when the game started and all objects are ready.
No event data.
gameStatsChanged
Called when game stats change including EnemyCount and AnimalCount, so it's called frequently. Use with care!
No event data.
logMessageReceived
Called on any uncaught Unity or 7DTD error message. While the event parameters suggests it could be called for non-errors I couldn't find a single other use for it other than errors.
{
"logType": "Exception",
"condition": "NullReferenceException: Object reference not set to an instance of an object",
"trace": "..." // full stack trace of the exception
}
playerDamaged
Called when a player suffered damage from anyone or anything.
{
"position": {
"x": -2300,
"y": 115,
"z": 688
},
"entityId": 2912955,
"entityName": "djkrose",
"entitySteamId": "76561198028632449",
"sourceEntityId": 2913636,
"sourceEntityName": "zombieSteve",
"sourceEntitySteamId": null,
"damageType": "Melee", // possible values: Undef, Bullet, Melee, FallingBlock, Starve, Fall, Radiation, Explosion, BlockDamage, Suicide, Sickness, Disease, Drowning, Fire, Corrosive, Electrical
"hitBodyPart": "Torso", // possible values: None, Torso, Head, LeftUpperArm, RightUpperArm, LeftUpperLeg, RightUpperLeg, LeftLowerArm, RightLowerArm, LeftLowerLeg, RightLowerLeg
"hitDirection": "Front", // possible values: Front, Back, Left, Right, Explosion, None
"damage": 10,
"armorDamage": 0,
"armorSlot": "Chest", // possible values: Head, Eyes, Face, Chest, Hands, Legs, Feet, Back, Count, None
"stunType": "None", // possible values: None, Kneel, Prone, Getup
"stunDuration": 0,
"critical": false,
"fatal": true,
"crippleLegs": false,
"dismember": false,
"turnIntoCrawler": false,
"painHit": false
}
playerDied
Called when a player was killed or died by himself.
Same event data as playerDamaged, but fatal
is always true.
playerDisconnected
Called when a player has disconnected from the game and all associated game data is about to be unloaded.
{
"shutdown": false, // true if the player was disconnected because the server is shutting down
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "", // always empty, because the player is already disconnected
"ping": 21
}
}
playerEnteredChunk
Called when a player enters a chunk, usually by moving there but also by teleporting or login.
{
"newChunk": { // chunk the player just entered
"x": -149,
"z": 45
},
"oldChunk": { // chunk the player just left, or (0,0) if the player logged in there
"x": -148,
"z": 45
},
"position": { // exact current player position, not chunk position
"x": -2369,
"y": 101,
"z": 724
},
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 20
}
}
playerExpGained
Called when a player gained experience points for whatever reason. Called frequently - use with care!
{
"expGained": 1039,
"expToNextLevel": 401,
"levelUp": false, // true if the experience gain caused a level-up, in which case also playerLevelUp is triggered
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 0
}
}
playerLevelUp
Called when a player reached a new level.
{
"oldLevel": 4,
"newLevel": 5,
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 0
}
}
playerLogin
Called when a player has connected but before he was authenticated with Steam. Do not trust the clientInfo data!
{
"compatibilityVersion": "Alpha 16.4",
"clientInfo": {
"playerName": "djkrose", // do not trust!
"steamId": "76561198028632449", // do not trust!
"ownerSteamId": null, // always null because Steam didn't tell us yet
"entityId": -1,
"ip": "127.0.0.1",
"ping": 0
}
}
playerSaveData
Called in regular intervalls for players to save their player file to disk.
{
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 20
},
"playerDataFile": "C:\\Users\\Besitzer\\AppData\\Roaming\\7DaysToDie\\Saves\\Random Gen\\AfraidOfTheDark\\Player\\76561198028632449.ttp"
}
playerSpawnedInWorld
Called when the player was made visible and the loading screen disappeared. This is a good event to send chat messages to the player upon login.
{
"reason": "JoinMultiplayer", // possible values: NewGame, LoadedGame, Died, Teleport, EnterMultiplayer, JoinMultiplayer, Unknown
"position": {
"x": -2341,
"y": 107,
"z": 704
},
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 20
}
}
playerSpawning
Called when the player was authenticated and his entity was created (entityLoaded event) but before the player becomes visible and the loading screen disappears. During spawning all required chunks and entites are loaded.
Because the player is now authenticated you can trust the clientInfo from now on. The event data also contains data about the player's visual appearence (player profile).
{
"playerProfile": {
"archetype": "BaseMale",
"gender": "male",
"hairName": "male_shaggy_hair",
"hairColor": {
"r": 255,
"g": 248,
"b": 197,
"a": 255
},
"skinColor": {
"r": 97,
"g": 79,
"b": 54,
"a": 255
},
"eyeColor": {
"r": 148,
"g": 161,
"b": 168,
"a": 255
},
"beardName": "male_beast_beard"
},
"clientInfo": {
"playerName": "djkrose",
"steamId": "76561198028632449",
"ownerSteamId": "76561198028632449",
"entityId": 2912955,
"ip": "127.0.0.1",
"ping": 20
}
}
serverRegistered
Called when the server was registered with Steam and announced to the master servers. This is also done for non-public servers!
Here we get all the game settings including the discovered external IP address of the server, which is not yet available when the server itself logs the GamePrefs on startup.
{
"gameInfos": {
"GameType": "7DTD",
"GameMode": "SurvivalMP",
"GameName": "AfraidOfTheDark",
"ServerDescription": "",
"ServerWebsiteURL": "",
"IP": "87.164.117.105", // external ip adress of the server
"LevelName": "Random Gen",
"GameHost": "djk [lan only]",
"Version": "Alpha 16.4",
"CountryCode": "BH", // the country code seems to be wrong most of the time
"CompatibilityVersion": "Alpha 16.4",
"Platform": "WindowsPlayer",
"SteamID": "90112330550557701", // just a dummy steam id, because the dedicated server doesn't need a steam account
"MaxPlayers": "16",
"Port": "26900",
"CurrentPlayers": "0",
"GameDifficulty": "2",
"DayNightLength": "60",
"ZombiesRun": "1",
"EnemyDifficulty": "0",
"PlayerKillingMode": "0",
"DropOnDeath": "0",
"DropOnQuit": "0",
"BloodMoonEnemyCount": "8",
"CurrentServerTime": "0",
"DayLightLength": "18",
"BlockDurabilityModifier": "100",
"AirDropFrequency": "72",
"LootAbundance": "100",
"LootRespawnDays": "30",
"MaxSpawnedZombies": "60",
"MaxSpawnedAnimals": "50",
"LandClaimSize": "41",
"LandClaimDeadZone": "30",
"LandClaimExpiryTime": "14",
"LandClaimDecayMode": "2",
"LandClaimOnlineDurabilityModifier": "4",
"LandClaimOfflineDurabilityModifier": "4",
"DayCount": "3",
"IsDedicated": "True",
"IsPasswordProtected": "False",
"IsPublic": "False",
"EnemySpawnMode": "True",
"ShowFriendPlayerOnMap": "True",
"BuildCreate": "False",
"EACEnabled": "False",
"AirDropMarker": "False",
"StockSettings": "True",
"StockFiles": "True",
"Architecture64": "True"
}
}
zombieDamaged
Called when a zombie suffered damage from anyone or anything.
Same event data as playerDamaged, but entitySteamId
is always null obviously.
zombieDied
Called when a zombie was killed or died by itself.
Same event data as playerDamaged, but entitySteamId
is always null obviously.