Saltar al contenido

Más en DLAN: Nuestras Traducciones | Otras Traducciones | Mods y modding | Revisiones y Guías | Videojuegos | Arte | Literatura | Rol y Rol por foro e IRC | Mapa de la web
Foto

Sistema de reparto de experiencia


No hay respuestas

#1 Zoraga

Zoraga

    Neonato

  • Miembro
  • PipPip
  • 209 posts

Posteado 30 March 2018 - 08:45 PM

Buenas gente, traigo una duda por aquí aver si alguien me echa una mano, hace poco cambié el sistema de experiencia que tenía en un módulo, parece funcionar bien, pero me gustaría modificarlo para restar el porcentaje de penalización de exp grupal con otros jugadores, y mantenerlo con los henchman, pero no logro entender mucho el script y que valor debo modificar, aquí abajo lo dejo (sacado del vault):

https://neverwinterv...s=2&qt-recent=1

 

//::///////////////////////////////////////////////
//:: Name NWN-Custom XP script
//:: FileName tw_xp_KH
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    This script calculates XP for killing creatures
    based on the individual PC-level towards the
    creatures CR for every partymember. Based on
    the 3.5 edition XP system.
    The XP amount is modified by the Partysize,
    detracting 10% of the individuals XP per
    Partymember within the distance set in the
    Ini-file on module load (tw_xp_KH_ini)
*/
//:://////////////////////////////////////////////
//:: Created By: Towan75
//:: Created On: 01/18/04
//:: Last modified: 03/13/04 by Towan75
//:://////////////////////////////////////////////

#include"aps_include"


void HenchmanCheck(object oTarget)
{
/*  See if the player has any Associates and if so, calculate the
    individual XP penalty for this player, based on the associate
    type.
    NOTE: Could be improved by taking the Associates CR into account
          for determining the XP-Penalty
*/

    object oModule=GetModule();
    int iHenchman=0;
    SetLocalInt(oTarget, "HenchmanModifier",0);
    if (GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oTarget) != OBJECT_INVALID)
     {
      iHenchman=GetLocalInt(oModule, "XP-Mod_Henchman");
      SetLocalInt(oTarget, "HenchmanModifier",iHenchman);
     }
    if (GetAssociate(ASSOCIATE_TYPE_SUMMONED, oTarget) != OBJECT_INVALID)
     {
      int iHenchman = GetLocalInt(oTarget, "HenchmanModifier");
      iHenchman=iHenchman+GetLocalInt(oModule, "XP-Mod_Summoned");
      SetLocalInt(oTarget, "HenchmanModifier",iHenchman);
     }
    if (GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oTarget) != OBJECT_INVALID)
     {
      int iHenchman = GetLocalInt(oTarget, "HenchmanModifier");
      iHenchman=iHenchman+GetLocalInt(oModule, "XP-Mod_AnimalCompanion");
      SetLocalInt(oTarget, "HenchmanModifier",iHenchman);
     }
    if (GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oTarget) != OBJECT_INVALID)
     {
      int iHenchman = GetLocalInt(oTarget, "HenchmanModifier");
      iHenchman=iHenchman+GetLocalInt(oModule, "XP-Mod_Familiar");
      SetLocalInt(oTarget, "HenchmanModifier",iHenchman);
     }
    if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, oTarget) != OBJECT_INVALID)
     {
      int iHenchman = GetLocalInt(oTarget, "HenchmanModifier");
      iHenchman=iHenchman+GetLocalInt(oModule, "XP-Mod_Dominated");
      SetLocalInt(oTarget, "HenchmanModifier",iHenchman);
     }
    int iCheck=GetLocalInt(oTarget, "HenchmanModifier");
    if (iCheck<1) SetLocalInt(oTarget, "HenchmanModifier", 1);
}

int GetIsInSameArea(object oKiller, object oTarget)
{
// make sure the Partymember is in the same Area and within the Sphere of XP gaining
    object oKillerArea = GetArea(oKiller);
    object oTargetArea = GetArea(oTarget);
    float fDistance = IntToFloat(GetLocalInt(GetModule(), "XP-Mod_Distance"));
    if (oKillerArea == oTargetArea && GetDistanceBetween(oKiller, oTarget) <= fDistance)
        return TRUE;
    return FALSE;
}

int PartyModifier(object oKiller)
{
/* Determine Partymodifier in % and set additional individual modifiers
   for Summons
*/
   int iPartySize=0;
   int iModifier=0;
   object oModule = GetModule();
   int iMinMod=GetLocalInt(oModule, "XP-Mod_MinimumPartymodifier");
   int iMaxSize=GetLocalInt(oModule, "XP-Mod_MaxPartysize");
   object oTarget = GetFirstFactionMember(oKiller, TRUE);
   while (oTarget != OBJECT_INVALID)
            {
            if (GetIsInSameArea(oKiller, oTarget) == TRUE)
               {
                iPartySize++;
// if enabled, calculate individual XP penalty for Henchmen
                if(GetLocalInt(oModule,"XP-Mod_Henchpenalty") && GetIsPC(oTarget)) HenchmanCheck(oTarget);
               }
            oTarget = GetNextFactionMember(oKiller, TRUE);
            }
   if (iPartySize < iMaxSize) {
      iModifier=100-(10*iPartySize);
      if (iModifier < iMinMod) iModifier = iMinMod;
     }
   else iModifier = iMinMod;

   return iModifier;
}

float CreatureXPValue(int iLevel, int iNPCCR);

void main()
{
    object oModule = GetModule();
    object oKiller = GetLastKiller();
    object oMaster = GetMaster(oKiller);
//Determine who was the Killer of the Monster
    if (oKiller == OBJECT_SELF)
        oKiller = GetLocalObject(OBJECT_SELF, "MyKiller");
    if (oMaster != OBJECT_INVALID)
        oKiller = GetMaster(oKiller);
    if (GetTrapCreator(oKiller) != OBJECT_INVALID)
        oKiller = GetTrapCreator(oKiller);
    if (GetIsPC(oKiller) == FALSE)
        return;

    int iModifier = PartyModifier(oKiller);

    float fDeadCR = GetChallengeRating(OBJECT_SELF);
    int iDeadCR = FloatToInt(fDeadCR);
// If chosen, set the maximum XP an individual player can get for one monster
// and the overall XP-slider
    float fOverall = (1 / IntToFloat(GetLocalInt(oModule, "XP-Mod_Overall")) );
    int iMaxSingleXP = GetLocalInt(oModule, "XP-Mod_MaxSingleXP");

// Now we will see to give the Players their hard earned XP
   object oTarget = GetFirstFactionMember(oKiller, TRUE);
   while (oTarget != OBJECT_INVALID)
           {
            if (GetIsInSameArea(oKiller, oTarget) == TRUE)
             {
              float fCreatureXP = CreatureXPValue(GetHitDice(oTarget), iDeadCR);
              // Calculate the float XP to Int XP taking into account the
              // overall modifier
              int iCreatureXP = FloatToInt(100.0 * fCreatureXP * fOverall);
              // now the individual modifiers apply to calculate the endresult
              int iIndMod=100-GetLocalInt(oTarget, "HenchmanModifier");
              if (iIndMod<10) iIndMod=10;
              iCreatureXP=(iCreatureXP*iModifier*iIndMod)/1000000;
              // Reward the XP to the player
              if (iCreatureXP<iMaxSingleXP) GiveXPToCreature(oTarget, iCreatureXP);
              else GiveXPToCreature(oTarget, iMaxSingleXP);
             }
            oTarget = GetNextFactionMember(oKiller, TRUE);
           }
}

// In this function the actual XP-worth of the creature is Set,
// this could probably best be done as a DB query with the XP
// table from the 2da in it or even better as a on the fly
// calculation with a formula
// anyway right now it is determined from the SQL Database
// based on Creature CR and Player Hitdice
float CreatureXPValue(int iLevel, int iNPCCR)
{

// SQL Version:
string x="SELECT C"+IntToString(iNPCCR)+" FROM xptable WHERE Level='"+IntToString(iLevel)+"'";
  SQLExecDirect(x);
  SQLFetch();
  string sXPValue=SQLGetData(1);
  float fXP=StringToFloat(sXPValue);
  if (fXP<=0.0) fXP=0.0;
  return fXP;


// Case-clause Version:
 /*
        float fXP;
        switch (iNPCCR)
            {
            case 00:
                if (iLevel<=2) fXP=18.0;
                else if (iLevel==3) fXP=17.0;
                else if (iLevel >3 && iLevel<=8) fXP=7.0;
                else if (iLevel >8 && iLevel<=10) fXP=5.25;
                else if (iLevel >10 && iLevel<=14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 01:
                if (iLevel <= 2) fXP=48.0;
                else if (iLevel == 3) fXP=42.0;
                else if (iLevel == 4) fXP=26.0;
                else if (iLevel == 5) fXP=23.0;
                else if (iLevel == 6) fXP=19.0;
                else if (iLevel == 7) fXP=17.0;
                else if (iLevel == 8) fXP=14.0;
                else if (iLevel >8 && iLevel<=10) fXP=5.25;
                else if (iLevel >10 && iLevel<=14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 02:
                if (iLevel <= 2) fXP=90.0;
                else if (iLevel == 3) fXP=75.0;
                else if (iLevel == 4) fXP=42.0;
                else if (iLevel == 5) fXP=33.0;
                else if (iLevel == 6) fXP=28.0;
                else if (iLevel == 7) fXP=23.0;
                else if (iLevel == 8) fXP=19.0;
                else if (iLevel == 9) fXP=11.25;
                else if (iLevel ==10) fXP=5.25;
                else if (iLevel >10 && iLevel<=14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 03:
                if (iLevel <= 2) fXP=137.0;
                else if (iLevel == 3) fXP=120.0;
                else if (iLevel == 4) fXP=63.0;
                else if (iLevel == 5) fXP=53.0;
                else if (iLevel == 6) fXP=40.0;
                else if (iLevel == 7) fXP=33.0;
                else if (iLevel == 8) fXP=26.0;
                else if (iLevel == 9) fXP=16.5;
                else if (iLevel ==10) fXP=12.75;
                else if (iLevel >10 && iLevel<=14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 04:
                if (iLevel <= 2) fXP=192.0;
                else if (iLevel == 3) fXP=177.0;
                else if (iLevel == 4) fXP=105.0;
                else if (iLevel == 5) fXP=77.0;
                else if (iLevel == 6) fXP=63.0;
                else if (iLevel == 7) fXP=47.0;
                else if (iLevel == 8) fXP=39.0;
                else if (iLevel == 9) fXP=22.5;
                else if (iLevel ==10) fXP=18.75;
                else if (iLevel ==11) fXP=13.0815;
                else if (iLevel >11 && iLevel<=14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 05:
                if (iLevel <= 2) fXP=315.0;
                else if (iLevel == 3) fXP=240.0;
                else if (iLevel == 4) fXP=152.0;
                else if (iLevel == 5) fXP=126.0;
                else if (iLevel == 6) fXP=91.0;
                else if (iLevel == 7) fXP=74.0;
                else if (iLevel == 8) fXP=54.0;
                else if (iLevel == 9) fXP=33.0;
                else if (iLevel ==10) fXP=24.75;
                else if (iLevel ==11) fXP=19.278;
                else if (iLevel ==12) fXP=12.393;
                else if (iLevel >12 && iLevel<=14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 06:
                if (iLevel <= 2) fXP=400.0;
                else if (iLevel == 3) fXP=378.0;
                else if (iLevel == 4) fXP=202.0;
                else if (iLevel == 5) fXP=181.0;
                else if (iLevel == 6) fXP=147.0;
                else if (iLevel == 7) fXP=105.0;
                else if (iLevel == 8) fXP=84.0;
                else if (iLevel == 9) fXP=45.0;
                else if (iLevel ==10) fXP=36.75;
                else if (iLevel ==11) fXP=25.4745;
                else if (iLevel ==12) fXP=18.5895;
                else if (iLevel ==13) fXP=13.77;
                else if (iLevel ==14) fXP=4.8195;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 07:
                if (iLevel <= 2) fXP=400.0;
                else if (iLevel == 3) fXP=450.0;
                else if (iLevel == 4) fXP=309.0;
                else if (iLevel == 5) fXP=235.0;
                else if (iLevel == 6) fXP=209.0;
                else if (iLevel == 7) fXP=168.0;
                else if (iLevel == 8) fXP=119.0;
                else if (iLevel == 9) fXP=71.25;
                else if (iLevel ==10) fXP=50.25;
                else if (iLevel ==11) fXP=37.179;
                else if (iLevel ==12) fXP=24.786;
                else if (iLevel ==13) fXP=20.655;
                else if (iLevel ==14) fXP=14.4585;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;
            case 08:
                if (iLevel <= 2) fXP=400.0;
                else if (iLevel == 3) fXP=450.0;
                else if (iLevel == 4) fXP=385.0;
                else if (iLevel == 5) fXP=353.0;
                else if (iLevel == 6) fXP=269.0;
                else if (iLevel == 7) fXP=237.0;
                else if (iLevel == 8) fXP=189.0;
                else if (iLevel == 9) fXP=100.5;
                else if (iLevel ==10) fXP=78.75;
                else if (iLevel ==11) fXP=50.949;
                else if (iLevel ==12) fXP=37.8675;
                else if (iLevel ==13) fXP=26.8515;
                else if (iLevel ==14) fXP=22.032;
                else if (iLevel ==15) fXP=13.8;
                else if (iLevel >14 && iLevel<=20) fXP=4.2;
                else fXP=4.0;
                return fXP;

            default:
                fXP = 1.0;
            }
    return fXP;
*/
}
 

 


Colaborando en:



Nombre servidor: ES) Rebelión del Submundo
Tipo de servidor: rol/acción/jvj
Jugadores: 1-25
Niveles: 1-30
Base literaria: Reinos Olvidados
IP (conectar directamente): sombrasdefaerun.no-ip.org
Foro: http://usn-rol.foroes.org/



 




Responder



  


A Bragol. Tus amigos te echan de menos.