Introduction

All modding will take place on Lua. You can view the documentation at the link. To run the mod, you need to download a dll file from my bot, one folder will be created in the folder with the game: D3Mods, it will contain the hook.lua file, the script that will be run after the game is started. So far, modding is in a very early beta test. This modding was considered and conceived as plugins for servers. There are several functions for getting information from the server.

All information is taken from the original modding API from D3LV1N. Missing points have been added here and errors in the signatures that were incorrectly written in the original have been corrected. All this is presented in an attractive and understandable presentation.

Events

OnChatMessage

A function that takes two arguments message, and sender. It is called when any player sends a message to the chat.

OnChatMessage = function(sender, message)
    if message == "Hello!" then
        log(I, "hello!")
    end
end

OnInstantiate

A function that also accepts two arguments: GameObject, and player. GameObject is the object that was installed, player is the owner of the object. The function will detect even child objects, the main thing is that the object has a Photon.Pun.PhotonView component.

OnInstantiate = function(player, GameObject)
    if GetName(GameObject):find("Barrel") and player == "D3LV!N" then
        Destroy(GameObject)
    end
end

OnPlayerJoined

Invokes then player join in room.

OnPlayerJoined = function(player)
    Players[player] = "citizen"
end

OnPlayerLeft

The function is called when a player leaves the server.

OnPlayerLeft = function(player) 
    Players[player] = nil
end

OnKilled

For this feature to work properly, you need to enable KillFeed.

OnKilled = function(killer, killed)
    GiveCash(killer, 200)
end

OnPlayerHit

Detects a player's hit.

OnPlayerHit = function(player)
    log(I,player)
end

OnDance

Called when a player starts dancing.

OnDance = function(player)
    log(I, player .. " started dancing!")
end

Logging and other

log

A function that logs your text to the console. Takes two arguments, the first is how you will log the text I - Info, E - error, W - warning.

OnChatMessage = function(sender, message)
    log(I, message)
    log(W, sender)
end

Update

The function is called every frame, does not work in the menu.

LastTime = os.time()
Update = function()
    if os.time() - LastTime > 20 then
        LastTime = os.time()
        SendChatMessage("Your advertising")
    end
end

GameObject

The API provides a GameObject variable that will store a pointer to a game object, as well as many functions for getting or changing the properties of a game object.

Instantiate

The function spawns an object with your name and then returns a reference to it.

GameObject = Instantiate("propName", --auto-registration of the object (string)
    "PropPath", --Full path to prop (string)
    0.1, --X pos (float)
    100, --Y pos (float)
    0.2, --Z pos (float)
    0.1, --X rot (float)
    0.2, --Y rot (float)
    0.5, --Z rot (float)
    0.01, --W rot (float)
    1 -- group (int)
)

FindGameObjectByName

Finds a game object by its name and returns a reference to it.

OnChatMessage = function(sender, message)
    GameObject = FindGameObjectByName("Barrel")
    SetPosition(GameObject, 0,100,0)
end

FindGameObjectsWithTag

Returns a list of game objects with a specific tag.

OnChatMessage = function(sender, message)
    GameObjects = FindGameObjectsWithTag("Player")
    for i = 0, #GameObjects do
        log(I, GetName(GameObjects[i]))
    end
end

GetName

Gets the name of the GameObject as a string.

local objectName = GetName(GameObject)

SetName

Sets a new name for the specified GameObject.

SetName(GameObject, "MyCustomObject")

GetPosition

Returns three float values representing the object's position (X, Y, Z).

local x, y, z = GetPosition(GameObject)

SetPosition

Moves the GameObject to the specified X, Y, Z coordinates.

SetPosition(GameObject, 100, 150, 100)

GetRotation

Returns four float values of the object's quaternion rotation (X, Y, Z, W).

local qx, qy, qz, qw = GetRotation(GameObject)

SetRotation

Sets the rotation of the GameObject using four float quaternion values.

SetRotation(GameObject, 0, 0, 0, 1)

Destroy

Deletes the specified GameObject from the game world.

Destroy(GameObject)

ChangeStatic

Changes the position, rotation, and scale of a static object.

ChangeStatic(GameObject, Px, Py, Pz, Sx, Sy, Sz, Rx, Ry, Rz)

TransferHost

Transfers ownership of a GameObject to the local player.

TransferHost(GameObject)

SetColor

Sets the color of a letter prop.

SetColor(GameObject, "#FF0000")

SetScale

Sets the scale (size) of a GameObject.

SetScale(GameObject, 2, 2, 2)

SetText

Sets the text content of a text prop (e.g., a blackboard).

SetText(GameObject, "NewText")

GetParent

Gets the parent GameObject of the specified object.

local parentObject = GetParent(GameObject)

GetChild

Gets a child GameObject by its index.

-- The second argument is the index (integer)
local firstChild = GetChild(GameObject, 1)

GetOwner

Gets the nickname of the player who owns the GameObject.

local ownerName = GetOwner(GameObject)

IsAvailable

Checks if the GameObject reference is valid and the object has not been destroyed. Returns a boolean value.

if IsAvailable(GameObject) then
    log(I, "Object is available!")
else
    log(W, "Object is no longer available.")
end

Player

Functions for interacting with both the local and remote players.

PlayerTeleport

Teleports the local player to the specified coordinates.

if message == "!TPMe" then
    PlayerTeleport(0, 100, 0)
end

SetSpawnable

The SetSpawnable function allows you to set the prop that the tool gun will spawn.

OnChatMessage = function(sender, message)
    if message:find("!set ") then
        SetSpawnable(message:gsub("!set ", ""))
    end
end

GetPlayerInfo

This function gets the info of the player.

OnChatMessage = function(sender, message)
    if message == "!myinfo" then
        local IsInfectedd, --bool
        weaponID = GetPlayerInfo(sender) --int
    end
end

TeleportPlayer

The function teleports other players.

TeleportPlayer(
    0, --X pos
    0, --Y pos
    0, --Z pos
    "D3LV1N" --Player nickname
)

DamagePlayer

The function gives damage to the player.

DamagePlayer(1, --float damage
    1, --float bleeding
    1, --IDK
    "D3LV1N", --Target (nickname)
    GameObject --Target bone
)

KnockPlayer

The function can either completely drop the player to the ground (without damage) or simply stop and throw away his weapon.

KnockPlayer(
    nil, --put or stop
    "D3LV1N" --Target
)

GiveCash

The function gives money to other players.

GiveCash(
    9999, -- value of cash
    "D3LV1N" --Nickname
)

SendRules

Sends your rules to the server. Can be sent to all. nil = false, 1 = true.

SendRules(
    nil, --Action Cam, nil, --BAN AI GOREDOLLS,
    nil, --BAN BIG EXPLOSIVES, nil, --BAN HATS AND ARMOR,
    nil, --BAN GOREDOLLS, nil, --BAN ENTITES,
    nil, --BAN EXPLOSIVES, nil, --BAN EXPLOSIVE WEAPON,
    nil, --BAN FOOD, nil, --BAN HEAVY WEAPONS,
    nil, --BAN LIHT WEAPONS, nil, --BAN MEDICINE,
    nil, --BAN MEELE WEAPONS, nil, --BAN NEXTBOTS,
    nil, --BAN PROPS, nil, --BAN REALITY CRUSHER,
    nil, --BAN VEHICLES, nil, --CAN DROP WEAPONS,
    nil, --CREATOR MODE, nil, --INTER-TEAM PVP/FRIENDLY FIRE,
    nil, --HOST BADGE, nil, --HOST SWITCH FEED,
    nil, --IGNORED BY AI, nil, --INFINITE AMMO,
    nil, --INFINITE STAMINA, nil, --INVINCIBILITY,
    nil, --KILL FEED, nil, --NOCLIP,
    nil, --PLAYER CONNECTION FEED, nil, --SLOWMO,
    nil, --SPAWN IS INFECTED, nil, --DISABLE FISTS,
    nil, --DISABLE KICKING, nil, --UNKNOWNSETTING,
    10, -- RESPAWN PENALTY, nil, --UNKNOWNSETTING,
    nil, --ALLOW SAVE LOADING, nil, --ALLOW VICE HOST,
    nil, --ALLOW CHANGES BY VICE HOST, nil, --UNKNOWNSETTING,
    nil --UNKNOWNSETTING
)

InfectPlayer

The function infects the player with a zombie virus.

InfectPlayer("D3LV1N")

ChangeSkin

Changes the skin of a player.

ChangeSkin("#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", false, 1,1,1,1,1,1,false,false,1,1,true,1, "D3LV!N")

SetWeather

The function sets the weather, can set it for all or for one player.

SetWeather(
    10.1, --time
    nil, --DayNightCicle
    2, --WeatherID 0, 18
    nil, --Rainy
    nil, --ThunderStorm
    "D3LV1N" --Recipient (optional)
)
Weather ID Options

Sending text

There are several functions for transmitting information to players. These functions have 2 overloads, the function either accepts only text and sends it to all players, or the function also accepts the player's nickname and sends the message only to him.

SendFriendRequest

Sends a friend request UI element.

SendFriendRequest(
    "text",
    "text",
    "D3LV!N"
)

SendText

Sends a full-screen text table.

SendText(
    "Hello", --header
    "world!", --text
    "D3LV1N" --Recipient (optional)
)

SendChatMessage

Sends a chat message.

SendChatMessage(
    "Hello world!", --mesages text
    "D3LV1N" --Recipient (optional)
)

SendTitle

Sends a title to the screen

SendTitle(
    "Hello on server!", --title
    "D3LV1N" --Recipient (optional)
)

SendObjective

Sends a objective to the screen

SendObjective(
    "Kill everyone!", --objective
    "D3LV1N" --Recipient (optional)
)

SendTimer

Sends a timer

SendTimer(
    100, --time
    "D3LV1N" --Recipient (optional)
)