Author Topic: On level up send message to dm?  (Read 308 times)

Legacy_Guest_NWN Dragon-Blade_*

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
On level up send message to dm?
« on: March 16, 2011, 01:18:45 am »


                Is there a way to script that on level up the DM gets a message saying who leveled up and to what level? 
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
On level up send message to dm?
« Reply #1 on: March 16, 2011, 02:48:31 am »


               The way to do that would be to make or customise the OnPlayerLevelup module script and send a message to the DM chat channel.  Of course, the message would go nowhere if there are no DMs in the game at the time.
It would be possible to record the information in the game's log file if it's needed even if a DM isn't logged in.
I can't do any scripts right now due to just having an operation, or I'd help.  If nobody can help you after I've recovered, I'll see what I can do.
               
               

               
            

Legacy_PurpleProse

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
On level up send message to dm?
« Reply #2 on: March 16, 2011, 04:36:16 am »


               Just add in the onlevelup handler:

object oLoop = GetFirstPC();
while (GetIsObjectValid(oLoop)){
if(GetIsDM(oLoop)) SendMessageToPC(oLoop, GetName(oPC) + " has leveled up to level " + GetHitDie(oPC));
oLoop = GetNextPC();
}
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
On level up send message to dm?
« Reply #3 on: March 16, 2011, 05:18:20 am »


               Don't really need a loop for anything. Just do something like this in the OnPlayerLevelUp event:


void main()
{
    object oPC = GetPCLevellingUp();
    string sLevel = IntToString(GetHitDice(oPC));
    string sMessage = GetName(oPC) + " has leveled up to level " + sLevel;
    SendMessageToAllDMs(sMessage);
}


Good luck.
               
               

               


                     Modifié par GhostOfGod, 16 mars 2011 - 05:20 .
                     
                  


            

Legacy_Guest_NWN Dragon-Blade_*

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
On level up send message to dm?
« Reply #4 on: March 16, 2011, 11:37:42 am »


               Ahh thankyou!