Server Totals
Mikona - (2)
Deglos - (2)
Ferrell - (2)
M'Chek - (2)
Wilderness - (2)
Visimontium - (2)
Elysia - (1)
Underdark - (0)
Le'Or - (0)
Total players: 13

Links Menu

Prevent & log reconnect on dying

Moderators: Nighthawk4, Dungeon Masters

Prevent & log reconnect on dying

PostAuthor: Neve » Tue Nov 18, 2003 7:05 pm

This script logs the number of times a player logged off while dying, send him/her a message with the number of times this cheat was attempted, logs it in the logfile and sends a message to all DM's. I hope it's of any use :)

OnClientLeave :

Code: Select all
void main(){
    object oPlayer = GetExitingObject();
    int iLeavingPlayerHP = GetCurrentHitPoints(oPlayer);
    string sHPString = GetName(oPlayer) + "_Health";
    string sLogDeath = GetName(oPlayer) + "_LogDeath";

    SetLocalInt(GetModule(), sHPString, iLeavingPlayerHP);

    if(iLeavingPlayerHP <= 0){
        SetLocalInt(GetModule(), sLogDeath, GetLocalInt(GetModule(), sLogDeath) + 1);
        WriteTimestampedLogEntry("****** Player " + GetName(oPlayer) + " has logged out while dying. This was attempted " + IntToString(GetLocalInt(GetModule(), sLogDeath)) + " time(s) during this session.");

OnClientEnter :

Code: Select all
int CheckHealth(object oPlayer){
    int iDamage = 0;
    string sLogString = GetName(oPlayer) + "_Relogged";
    string sHPString = GetName(oPlayer) + "_Health";
    string sLogDeath = GetName(oPlayer) + "_LogDeath";

    if(GetLocalInt(GetModule(), sLogString)){
        iDamage = GetMaxHitPoints(oPlayer) - GetLocalInt(GetModule(), sHPString);
        SendMessageToPC(oPlayer, "You last logged out with " + IntToString(GetLocalInt(GetModule(), sHPString)) + " remaining hitpoints.");
        SendMessageToPC(oPlayer, "You logged off " + IntToString(GetLocalInt(GetModule(), sLogDeath)) + " time(s) to prevent death.");
        SendMessageToAllDMs(GetName(oPlayer) + " logged off " + IntToString(GetLocalInt(GetModule(), sLogDeath)) + " time(s) to prevent death.");
        SetLocalInt(GetModule(), sLogString, 1);

    return iDamage;

void main(){
    object oPlayer = GetEnteringObject();

    SetPlotFlag(oPlayer, FALSE);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(CheckHealth(oPlayer)), oPlayer);
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
Prince of Bloated Discourse
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands

PostAuthor: Titanium Dragon » Tue Nov 18, 2003 8:21 pm

Problem is, a lot of people crash while dying too; also, if you log out while in the death script, when you log back in you keel over. This would flood the DM channel with these messages, as almost every character has crashed at least once in the death script (I know I have).
User avatar
Titanium Dragon
Posts: 2917
Joined: Sun Apr 27, 2003 5:18 pm
Location: Corvallis, OR (GMT - 7)

PostAuthor: Korrigan » Sat Dec 13, 2003 11:22 am

I made a nice working system with the native NWN database system.
If a player logs dead, he will reappear dead and at the same place, even if the server went down inbetween. Also, it manages persistant player location (you log out in a dungeon, server reboots, you still relog in the same dungeon). I use timed database flushing, so there is no lag created by this.

Neve : Send me a mail if you want the code :)
User avatar
Prince of Bloated Discourse
Posts: 280
Joined: Sat Apr 12, 2003 4:21 pm
Location: Jester of the Fey Vivian, Lady of the Lake ...

Return to NWN Scripting

Who is online

Registered users: Ambrosia, Bing [Bot], Google [Bot], silverfields2, Tel