# Turning Off Pet Talk

> **Note:** Server-side only. No client change needed, so it works for every player right away.

## Overview

Pets post lines in players' common chat. This edit adds an on/off switch to `petbedge.lua`. When the switch is off, pets stop talking, but their mood, belly and other stats keep updating as normal.

### File locations

<table id="bkmrk-client-server-%E2%80%93-scri"><thead><tr><th>Client</th><th>Server</th></tr></thead><tbody><tr><td>–</td><td><code>script&#47;petbedge&#46;lua</code> (same folder as <code>petbedge&#95;interface&#46;lua</code>)</td></tr></tbody></table>

### What needs to be changed

<table id="bkmrk-file-%2F-location-note"><thead><tr><th>File / location</th><th>Notes</th></tr></thead><tbody><tr><td><code>petbedge&#46;lua</code>, above <code>PetBedge&#95;Talk&#95;Entrance</code> (around line 260)</td><td>Add the switch <code>PET&#95;TALK&#95;ENABLED</code></td></tr><tr><td><code>petbedge&#46;lua</code>, inside <code>PetBedge&#95;Talk&#95;Entrance</code></td><td>Replace one <code>return</code> line with three lines</td></tr></tbody></table>

## How it works

1. The game server calls `PetBedge_Talk_Entrance` every so often for each summoned pet.
2. That function calls `PetTalk` (in `petbedge_interface.lua`). `PetTalk` does two jobs: 
    - **Upkeep:** updates mood (happiness), rating, size, star, the max HP fix and the extra skill slot.
    - **Talk:** picks a line for the pet to say, or returns "say nothing".
3. The edit lets `PetTalk` run as normal so the upkeep still happens. Then, if the switch is off, it throws the line away and returns `0,0,0,-1`. That's the game's own "say nothing" value.

<table id="bkmrk-value-returned-meani"><thead><tr><th>Value returned</th><th>Meaning</th></tr></thead><tbody><tr><td><code>pet&#95;tid&#44; 0&#44; msg&#44; 0</code></td><td>Pet says line <code>msg</code></td></tr><tr><td><code>0&#44; 0&#44; 0&#44; &#45;1</code></td><td>Pet says nothing</td></tr></tbody></table>

> **Warning:** Don't skip `PetTalk`. If the function returns `0,0,0,-1` without calling `PetTalk` first, belly and mood stop working (seen in testing).

## Editing the file

1. Back up `petbedge.lua`.
2. Open it and find `function PetBedge_Talk_Entrance`.
3. On a new line **above** the function, add the switch.
4. Inside the function, replace the `return PetTalk(...)` line with the three new lines.
5. Save and restart the server.

### Original

```lua
function PetBedge_Talk_Entrance(pet_tid,pet_item,pet_ess,is_summon)
	--宠物说话
	local pet = {};
	PetBedge_InnerInit(pet_tid,pet_item,pet_ess,pet);
	return PetTalk(pet_tid,pet,is_summon);
	--return pet_tid,channel_id,msg_id,emote
end

```

### Changed

```lua
PET_TALK_ENABLED = false   -- pet talk: true = on, false = off (restart the server after changing)

function PetBedge_Talk_Entrance(pet_tid,pet_item,pet_ess,is_summon)
	--宠物说话
	local pet = {};
	PetBedge_InnerInit(pet_tid,pet_item,pet_ess,pet);
	local r1, r2, r3, r4 = PetTalk(pet_tid,pet,is_summon);   -- pet upkeep still runs
	if PET_TALK_ENABLED == false then return 0,0,0,-1; end   -- talk off: the game's own "no talk" value
	return r1, r2, r3, r4;
	--return pet_tid,channel_id,msg_id,emote
end

```

> **Warning:** Leave `PetBedge_Emote_Entrance` (the function right below) in place. It handles pet emotes. It's easy to delete it by accident when pasting.

> **Tip:** Text after `--` is a note and is ignored by the game. If the Chinese notes come out garbled after pasting, it's harmless. To avoid it, keep the file's original lines and paste only the new English lines. The file uses Chinese (GBK) encoding.

## Turning talk on or off

<table id="bkmrk-setting-result-pet_t"><thead><tr><th>Setting</th><th>Result</th></tr></thead><tbody><tr><td><code>PET&#95;TALK&#95;ENABLED &#61; false</code></td><td>Pets don't talk. Upkeep still runs.</td></tr><tr><td><code>PET&#95;TALK&#95;ENABLED &#61; true</code></td><td>Pets talk as normal.</td></tr></tbody></table>

Change the value, save, restart the server.

## What it doesn't cover

- **Level-up lines** come from a different function (`PetLevelUp`), so pets still speak when they level up.
- **Pet emotes** (`PetBedge_Emote_Entrance`) are not affected.
- It turns talk **off**, it doesn't make it rarer.

### Unconfirmed: why some pets talk nonstop

In `PetTalk`, normal idle talk is a small random chance (about 0.5–5% per check). But if `pet:QueryData(1) > 0`, the pet talks **on every check** with no random roll. This may be the real cause of the nonstop chatter. Not tested yet.

## Final check

- \[ \] Summon a pet and wait a few minutes. No pet lines in chat.
- \[ \] Belly and mood still change over time.
- \[ \] Pet emotes still work.
- \[ \] No new errors in the server log.
- \[ \] Set the switch to `true`, restart, and check pets talk again.

**Rollback:** put the backed-up `petbedge.lua` back and restart.

---

*Credit: edit by Amongades, checked against `petbedge.lua` and `petbedge_interface.lua` for Ether Saga.*