Author Topic: Dying when logging on to server  (Read 588 times)

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Dying when logging on to server
« on: October 04, 2011, 04:22:49 am »


               I've recently noticed that sometimes when I log on to my server, my PC will have -1 HP and subsuquently die. I will get 2 damage messages, type magical. The first one is for my full HP and the 2nd one is for 1 more. The attacker is "Someone". It doesn't happen every time I  log in and can happen to any of my PC's.

Could anyone point me in the right direction as to what might becausing this? I  thought I  had found something in the enterMod script, but I guess that wasn't it.

Thanks '<img'>
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Dying when logging on to server
« Reply #1 on: October 05, 2011, 12:08:02 am »


               Someone attacks is usually a default when no one can be found as the attacker.  Something on client exit or enter, or maybe hb.  Though you said your on enter is not causing it.  Which scripts have you altered in module scripts?  For I can almost certainly guarantee it's one of you module scripts doing it.  What system are you using?  Are you logging during a fight?  Some possible reasons.  Also any ondying alterations?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Dying when logging on to server
« Reply #2 on: October 05, 2011, 12:23:18 am »


               You must be using some system which tracking hitpoints before exiting the server. I dont know who have created this system but obviously its made wrong.

In order to work you have to track not the damage tha have been dealt to the PC but PC's current hitpoints instead. Because in time checking the PC might have bonus constitution that raised his total hitpoints so if the system tracks difference between current and max, this difference when applied in OnEnter might kill you if you dont have that constitution boost anymore.

Or the system doesnt track hitpoints in OnExit as it should but maybe in heartbeat or pseudo-heartbeat. In either case we need to see your OnClientEnter and OnClientExit scripts.
               
               

               


                     Modifié par ShaDoOoW, 04 octobre 2011 - 11:24 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Dying when logging on to server
« Reply #3 on: October 05, 2011, 12:58:01 am »


               If it is not in the Client Enter event, It sounds more like a misfirring TBS to me. Perhaps one that is firing the OnActivate when the item is aquired.
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Dying when logging on to server
« Reply #4 on: October 05, 2011, 06:09:33 pm »


               

"What system are you using?"

No idea what that means. I started a blank module about 2 years ago, installed CEP and also brought in some scripts from the mod I used to play on. But I couldn't tell you which.

I'm not logging on during a fight.

Here is the on_enter script

#include "leo_regen"
#include "inc_quest"
void main()
{

  ExecuteScript("zep_cr_nocheat", OBJECT_SELF);
  ExecuteScript("leo_regen_enter",OBJECT_SELF);

  object oPC = GetEnteringObject();

  SetLocalString(oPC, "ID", GetPCPlayerName(oPC) );
  SetLocalString(oPC, "NAME", GetName(oPC) );
  SetLocalString(oPC, "KEY", GetPCPublicCDKey(oPC) );
  SetLocalString(oPC, "IP", GetPCIPAddress(oPC) );

  /* Informational messages */
  DelayCommand(10.0, SendMessageToPC(oPC, "It is VERY important that you read the Journal Entries, as the server rules are stated in it.  It will be your responsibiltiy to know the server rules. "));
  /* Insert persistent journal entries */
  DelayCommand( 2.0, enableQuestJournal(oPC));

  if( GetIsPC(oPC) && !GetIsDM(oPC) )
  {
    string sReport;

    sReport = ">>> ID: " + GetPCPlayerName(oPC)
            + "; Name: "+ GetName(oPC)
            + "; CD Key:" + GetPCPublicCDKey(oPC)
            + "; IP:" + GetPCIPAddress(oPC)
            + "; has logged in.";
    WriteTimestampedLogEntry(sReport);
    SendMessageToAllDMs(sReport);
  }
  string sHPVar     = "hp" + GetName(oPC);
  string sDeadVar   = "dd" + GetName(oPC);

  int nHPOnExit     = GetLocalInt(OBJECT_SELF, sHPVar);
  int nDead         = GetLocalInt(OBJECT_SELF, sDeadVar);
  int nMaxHP        = GetMaxHitPoints(oPC);

  if ( nDead == 1 )
  {
    CreateItemOnObject("death", oPC, 1);
    SetLocalInt(OBJECT_SELF, sDeadVar, 0);
  }

  effect eDeath = EffectDeath();

  if( GetItemPossessedBy(oPC, "death") != OBJECT_INVALID )
  {
    ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(eDeath), oPC);
  }
   /* Returning characters */
  if  ( nHPOnExit > 0
  ||    nDead )
  {
    if ( !GetIsDM(oPC) )
    {
      /* Reset previous hp */
      effect dmg = EffectDamage(nMaxHP - nHPOnExit);
      ActionWait(0.1);

      ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, oPC);

    }
  }
  /* Initial login */
  else
  {
    if ( !GetIsDM(oPC) )
    {
      /* Check for undesired talents */
      ExecuteScript("mod_talentcheck", oPC);

    }
  }

}


I didn't write this script (I  am so not a scripter lol), but I do see something dealing with death.
I did write a script to heal 3 points if HP = -1. That dealt with the symptom, but not the cause.

There is no OnClientLeave script

Thanks
               
               

               


                     Modifié par Zeidae, 05 octobre 2011 - 05:11 .
                     
                  


            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Dying when logging on to server
« Reply #5 on: October 05, 2011, 09:37:46 pm »


               I think this is the problem

     /* Reset previous hp */
     effect dmg = EffectDamage(nMaxHP - nHPOnExit);
     ActionWait(0.1);

     ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, oPC);

So I removed the effect part. We'll see what happens.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Dying when logging on to server
« Reply #6 on: October 06, 2011, 01:25:54 am »


               Yeah that's probably it. What it is saying is to subtract nHPOnExit from your maximum hitpoints.
So what the script is trying to prevent is players logging when they are probably going to die and then relogging with full hitpoints. I used something similar to these scripts and occassionally had the same problem. Also there is a nocheat execute at the top too, no idea what that is nor the other exectuable. Yeah it's probably something in the ondying of the PC and/or ondeath as you can see the check for the item dead, which will prevent dead players from logging back in to avoid being dead, they will still be dead. Basically an anti-cheat mechanism, gone awry.
So say your max hits are 100 and the HpONExit is 10: i.e. 100 - 10 = 90.  When you log back in it will do 90 hitpoints of damage to your PC, which should leave you with 10hp, but clearly something is mucking up the works here.  One way instead of just dropping the line entirely would be to halve max hp - hpoexit number,actually halving maxhp number, which lowers the damage done. In this way the player would still be down some hits just not dead, hopefully.
So the line would look like this:
effect dmg = EffectDamage(nMaxHP/2 - nHPOnExit);
So going back to the placed values 100/2 = 50 - 10 which is HPOnExit = 40 pts of damage on enter. 
That is if you want players to log back in with fewer hits.  Another way would be to put a delaycommand on the damage line say of 20 seconds or so, and then to send a msg to the PC that their recent battle has left them still wounded, giving them time to quaff a potion to offset the coming loss of hits.  Just another approach. Of course this approach would reguire you to divide the total damage and inflict it in increments maybe in 1/4 increments 4 times. Something like:

effect dmg =  EffectDamage(nMaxHP - nHPOnExit/4);
DelayCommand(15.0,SendMessageToPC(oPC, " Your previous wounds are still untreated"));
DelayCommand(20.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, oPC));
DelayCommand(25.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, oPC));
DelayCommand(30.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, oPC));
DelayCommand(35.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, oPC));

My last thought on this is that the reason it is happening is that somewhere you are receiving additional damage so you log in already down a few more hits than expected, that's why I asked about combat.  Thus exiting on combat there may be some residual damage to your PC and then when you log in and take all that damage at once it is dropping you below zero hits, which is death unless you have a bleed down script, in which case you expire at -10, which is the maximum you can bleed dow too, actually -9 is the maximum you can bleed down too since -1 more hit and you are dead.
 
               
               

               


                     Modifié par ffbj, 06 octobre 2011 - 01:34 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Dying when logging on to server
« Reply #7 on: October 06, 2011, 03:25:34 am »


               imo the problem is that there is no OnClientExit script

I have hitpoints tracking in there and OnEnter and it works absolutelly correctly, if you logged out with 10hps you will log in with 10hps. If you died then you log in dead.

So in his module the HP tracking must be done probably in heatbeart or dont know, very possibly this value isnt reseted when player respawn/get resurrected.

Could you then post your module OnHeartbeat script?
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Dying when logging on to server
« Reply #8 on: October 10, 2011, 09:54:14 pm »


               

ShaDoOoW wrote...
imo the problem is that there is no OnClientExit script

I have hitpoints tracking in there and OnEnter and it works absolutelly correctly, if you logged out with 10hps you will log in with 10hps. If you died then you log in dead.

So in his module the HP tracking must be done probably in heatbeart or dont know, very possibly this value isnt reseted when player respawn/get resurrected.

Could you then post your module OnHeartbeat script?


You're probably right about the problem being no exit script.
the enter script is calling a variable that is supposed to be set on exit.
I'll have to either write one later or just go with the hack I  have ATM. Just so long as peeps don't die when they log in '<img'>

Thanks for the replies