• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

TrinityCore 3.3.5 Custom command for displayed respawn timers

Jeremiassen1

New member
Hey.

I was wondering if someone could help me out with a little script for a custom command on a 3.3.5a trinity server. The command is supposed to display remaining respawntime for a creature to respawn in the players chat. Would be neat if someone here could help me out
 

Vitrex

Moderator
i think if u do .npc info it displays the respawn time
https://www.reaper-x.com/2009/01/01/trinity-core-gm-commands/

Syntax: .npc info Display a list of details for the selected creature.
The list includes:
– GUID, Faction, NPC flags, Entry ID, Model ID,
– Level,
– Health (current/maximum),
– Field flags, dynamic flags, faction template,
– Position information,
– and the creature type, e.g. if the creature is a vendor.

What exactly help do you need? don't know where to start or stucked somewhere ?
 

slp13at420

Mad Scientist
these would be the 4 lines I would look at in \src\server\scripts\Commands\cs_npc.cpp in `static bool HandleNpcInfoCommand(ChatHandler* handler, char const* /*args*/)`
:
Code:
[COLOR="#808080"]
        Creature* target = handler->getSelectedCreature();

        int64 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL);

        if (curRespawnDelay < 0)
            curRespawnDelay = 0;
[/COLOR]
create pointer called `target` for creature , and get respawn timer left and set to 0 if it math's out to a negative integer.

probably these 2 lines too:
Code:
[COLOR="#808080"]
        std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
        std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);
[/COLOR]

so you can post `respawn timer` and `respawn timer left`.

Code:
[COLOR="#808080"]
        handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
[/COLOR]

I added this idea to the EmuDevs Community Premium System --> http://emudevs.com/showthread.php/5708-CPP-EmuDevs-Community-Premium-System
 
Last edited:
Top