Aller au contenu

Photo

XP Giver - Hard Leveling


  • Veuillez vous connecter pour répondre
51 réponses à ce sujet

#1
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

This code is used in the creature ondeath events. 

 

The high level players is helping the low level players to level up killing low level creatures example:

 

A player level 30 is killing ogres(level 5) to help a player level 1 to level up winning the max XP(about 4 difference of level - as you can see in the system iDN > 4).

Other bad thing is that some players is using the Epic Mummy in the Sequencer robe to level up characters lvl 11 killing level 20 creatures (and they can use the spell a lot of time giving the robe to other players after rest)

 

I need ideas to make the level up be dinamic.

//:://////////////////////////////////////////////////

#include "module_include"
#include "x2_inc_compon"
#include "x0_i0_spawncond"

void main()
{
    object oKiller = GetLastKiller();

//============== XP Giver Script ===================
//============== Creating Variables ===============
    int iQuantidade;
    int iXP;
    float fXPPenalt;
    int iXPPenalt;
    int iNewXP;
    int iPenal;
    int iCR = FloatToInt(GetChallengeRating(OBJECT_SELF));
    int iHD;
    int iDN;
    object oAreaPC;
//============== Starting the count ===========================
    object oArea = GetArea(oKiller);
    object oObject = GetFirstObjectInArea(oArea);
    int iDead = GetIsDead (oObject);
    int iSameFaction = GetFactionEqual (oKiller, oObject);
    while (GetIsObjectValid(oObject))
    {
        if ((GetIsPC(oObject)) && (iSameFaction == TRUE) && (iDead == FALSE))
            {
                iQuantidade = iQuantidade + 1; //iQuantidade = the amount of players in party
            }
        oObject = GetNextObjectInArea(oArea);
        iDead = GetIsDead (oObject);
        iSameFaction = GetFactionEqual (oKiller, oObject);
    }

//=========== The party XP penalty ==========================

    if (iQuantidade == 1) iPenal = 10;
    if (iQuantidade == 2) iPenal = 20; 
    if (iQuantidade == 3) iPenal = 25;
    if (iQuantidade == 4) iPenal = 30;
    if (iQuantidade >= 5) iPenal = 60; //low XP

//========== Applying XP ====================================

    oObject = GetFirstPC();
    int iAmaldicoado = GetLocalInt(oObject, "amaldicoado"); // amaldicoado = cursed
    while (GetIsObjectValid(oObject))
    {
        iHD = GetHitDice(oObject);
        iDN = iCR - iHD;
        iDead = GetIsDead (oObject);
        iSameFaction = GetFactionEqual (oKiller, oObject);
        oAreaPC = GetArea(oObject);
        if ((iSameFaction == TRUE) && (iDead == FALSE) && (oAreaPC == oArea))
        {
            if (iDN > 4)
            {
                iXP = 380;  // 350, 310, 290, 270, 250 //350 is the max XP
            }
            if (iDN == 4)
            {
                iXP = 330;  // 300, 270, 250, 230, 210
            }
            if (iDN == 3)
            {
                iXP = 270;  // 250, 220, 210, 200, 190
            }
            if (iDN == 2)
            {
                iXP = 220;  // 200, 180, 170, 160, 150
            }
            if (iDN == 1)
            {
                if (iQuantidade == 4) iPenal = 32;  //adjustment +02 (penalty)
                if (iQuantidade == 5) iPenal = 38;  //adjustment +03
                iXP = 160;  // 150, 130, 120, 110, 100
            }
            if (iDN == 0)
            {
                if (iQuantidade == 2) iPenal = 28;  //adjustment +08
                if (iQuantidade == 3) iPenal = 37;  //adjustment +12
                if (iQuantidade == 4) iPenal = 46;  //adjustment +16
                if (iQuantidade == 5) iPenal = 55;  //adjustment +20
                if (iQuantidade > 5) iPenal = 64;   //adjustment +04
                iXP = 110;  // 100, 080, 070, 060, 050
            }
            if (iDN == -1)
            {
                if (iQuantidade == 4) iPenal = 34; //adjustment +04
                iXP = 60;   // 060, 050, 050, 040, 040
            }
            if (iDN == -2)
            {
                iXP = 40;   // 040, 040, 030
            }
            if (iDN == -3)
            {
                iXP = 20;   // 020, 020, 020
            }
            if (iDN == -4)
            {
                iXP = 10;   // 010
            }
            if (iDN < -4)
            {
                iXP = 1;    // 001
            }

            int iCurrentXP = GetXP(oObject);
            int iXPMax = ( (iHD * 1000) + (iHD * (iHD - 1) * 500) );
            if  (iCurrentXP < iXPMax)
            {
                if (iAmaldicoado != 2) //amaldicoado = cursed
                {
                    if (!HasSanctuary(oObject))
                    {
                        fXPPenalt = (iXP/10) * (iPenal/100.0);
                        iXPPenalt = FloatToInt(fXPPenalt); // conversion to integer values
                        iNewXP = iXP - (iXPPenalt*10);
                        GiveXPToCreature(oObject, iNewXP); // giving XP
                    }
                    else
                    {
                        FloatingTextStringOnCreature ("Sem XP em Santuario", oObject); 
                        //No XP using greater sanctuary
                    }
                }
            }
            if  ( (iCurrentXP > (iXPMax - 1)) && (iCurrentXP < 780000))
            {
             FloatingTextStringOnCreature ("Level Up", oObject); //Intuitive message
             //This makes the XP not accumulative
            }
        }
    oObject = GetNextPC();
    }
}


#2
WhiZard

WhiZard
  • Members
  • 1 204 messages

 

This code is used in the creature ondeath events. 

 

The high level players is helping the low level players to level up killing low level creatures example:

 

A player level 30 is killing ogres(level 5) to help a player level 1 to level up winning the max XP(about 4 difference of level - as you can see in the system iDN > 4).

Other bad thing is that some players is using the Epic Mummy in the Sequencer robe to level up characters lvl 11 killing level 20 creatures (and they can use the spell a lot of time giving the robe to other players after rest)

 

 

Your first example is an instance of grinding (getting unlimited XP from repetition) and there is no true fix for it unless you somehow cap or abandon the grinding level system that is common to servers.  One way would be to store the number of kills of different types of creatures and to no longer grant XP reward for having killed more than the capped amount.

 

Your second example is easily fixed (if sequencing is the only problem) simply delete the variable that sequencers use whenever an item is unacquired by a PC.


  • Shadooow et WhiteTiger aiment ceci

#3
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

not understand   :huh:



#4
WhiZard

WhiZard
  • Members
  • 1 204 messages

To remove sequencer spells you are just deleting variables produced by x2_s3_sequencer

 

object oItem = GetModuleItemLost();
int i;

for (i = 1; i <= 3; i++)
        {
            DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER" + IntToString(i));
        }
        DeleteLocalInt(oItem, "X2_L_NUMTRIGGERS");


  • WhiteTiger aime ceci

#5
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

I got your idea

 

1example: This is a valid solution, but does not make things the way we want because this way we are applying limit to the XP.

2example: This is fine!

 

what is this "for (i = 1; i <= 3; i++)" you used?



#6
Shadooow

Shadooow
  • Members
  • 4 465 messages

what is this "for (i = 1; i <= 3; i++)" you used?

just a little more rafined method of coding

 

you can replace it by this:

 

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER1");

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER2");

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER3");


  • WhiteTiger aime ceci

#7
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

Like just ADD this to my OnItemLost code and done?

 

DeleteLocalInt(GetModuleItemLost(), "X2_L_SPELLTRIGGER1");

DeleteLocalInt(GetModuleItemLost(), "X2_L_SPELLTRIGGER2");

DeleteLocalInt(GetModuleItemLost(), "X2_L_SPELLTRIGGER3");



#8
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

Shadooow && Whizard

 

Dont we need to check if oItem = Sequencer Robe to delete these variables?



#9
Shadooow

Shadooow
  • Members
  • 4 465 messages

not because if its not sequencer the code wont have any effect :rolleyes:

 

ultimate answer:

 

add either:

int i;

for (i = 1; i <= 3; i++)
        {
            DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER" + IntToString(i));
        }
        DeleteLocalInt(oItem, "X2_L_NUMTRIGGERS");

or

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER1");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER2");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER3");
DeleteLocalInt(oItem, "X2_L_NUMTRIGGERS");

this code, whatever you prefer the functionality is the same, into your OnUnAcquire event, compile and thats it


  • WhiteTiger aime ceci

#10
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

I would like to give a message to the player informing that he losts your spell in Sequencer robe... just like this?

 

sItem = GetResRef(oItem)

 

if(sItem = "resrefSequencer")

{

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER1");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER2");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER3");
DeleteLocalInt(oItem, "X2_L_NUMTRIGGERS");

SendMessageToPC(oPC, "[ITEM] The item " + GetName(oItem) + " lost the enchantment.");

}

 

//EDITED SendMessageToPC(string, object) to SendMessageToPC(object, string)


Modifié par WhiteTiger, 12 juillet 2014 - 03:52 .


#11
Shadooow

Shadooow
  • Members
  • 4 465 messages

I would like to give a message to the player informing that he losts your spell in Sequencer robe... just like this?

 

sItem = GetResRef(oItem)

 

if(sItem = "resrefSequencer")

{

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER1");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER2");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER3");
DeleteLocalInt(oItem, "X2_L_NUMTRIGGERS");

SendMessageToPC("Sequencer Robe: The slot was cleaned!", oPC);

}

I see. Good idea. This will work but there is more sequences so maybe it would be easier to do this:


if(GetLocalInt(oItem, "X2_L_NUMTRIGGERS") > 0)

{

DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER1");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER2");
DeleteLocalInt(oItem, "X2_L_SPELLTRIGGER3");
DeleteLocalInt(oItem, "X2_L_NUMTRIGGERS");

SendMessageToPC("Sequencer Robe: The slot was cleaned!", oPC);

}

  • WhiteTiger aime ceci

#12
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

//edit 

thank you shadooow & wizard 

//end edit

 

I continues having troubles with the XP gain by repetition (example): the high-level gets 1 XP by killing the ogre and the other lower-level receive 200 XP for being in the party.


Modifié par WhiteTiger, 16 juillet 2014 - 03:24 .


#13
Shadooow

Shadooow
  • Members
  • 4 465 messages

First you must determine the killers hit dice (or hit dice of killers master in case of associate)

 

int iHDkiller = GetHitDice(oKiller);

 

then after this code:

 

    if (iDN < -4)
    {
    iXP = 1; // 001
    }

 

do something like this:

int lvldiff =  abs(iHD-iHDkiller); //difference between levels of killer and party member receiving xp

 if(lvldiff > 4)

 {

 iXP = 1;//if difference more than 4, then he gains only 1 xp

 }


  • WhiteTiger aime ceci

#14
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

Good idea! I have done, shadooow. thank you

WRONG CODE

Modifié par WhiteTiger, 17 juillet 2014 - 06:56 .


#15
WhiZard

WhiZard
  • Members
  • 1 204 messages

Another option is to loop through the party members (by faction) and find the one with the highest HD.  Then award XP to each as if they all had that HD.


  • WhiteTiger aime ceci

#16
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

Another option is to loop through the party members (by faction) and find the one with the highest HD.  Then award XP to each as if they all had that HD.

 

this way the players will dislike to do pt with highest HD =(



#17
Shadooow

Shadooow
  • Members
  • 4 465 messages

Another option is to loop through the party members (by faction) and find the one with the highest HD.  Then award XP to each as if they all had that HD.

nah thats nonsense, will then give low lvl players XP that a high level player get for the high level monster - ultimate power levelling



#18
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

Is possible to avoid repeating the IXP code?



#19
WhiZard

WhiZard
  • Members
  • 1 204 messages

Shadooow, I could criticize your two examples similarly.

 

Your first one would give only 1 XP to a character soloing a tough creature

 

Your second one could give 1 XP if a low level summon killed the creature

 

 

The biggest problem in awarding XP is in determining participation.  Easy to do in SP; difficult to do in an infinite grind MP.


  • WhiteTiger aime ceci

#20
Shadooow

Shadooow
  • Members
  • 4 465 messages

Shadooow, I could criticize your two examples similarly.

 

Your first one would give only 1 XP to a character soloing a tough creature

 

Your second one could give 1 XP if a low level summon killed the creature

 

 

The biggest problem in awarding XP is in determining participation.  Easy to do in SP; difficult to do in an infinite grind MP.

Not really.

A lvldiff in first case is 0 so nothing happens.

The second case wont happen since if a associate make the kills the killer is then switched to master which I advised WhiteTiger via PM and he already incorporated that to his script.

 

Anyway - so you are saying your suggestion is not doing what I told or you just trying to find a flaw in my own suggestion because your is faulty?



#21
WhiZard

WhiZard
  • Members
  • 1 204 messages

Not really.

A lvldiff in first case is 0 so nothing happens.

The second case wont happen since if a associate make the kills the killer is then switched to master which I advised WhiteTiger via PM and he already incorporated that to his script.

 

Anyway - so you are saying your suggestion is not doing what I told or you just trying to find a flaw in my own suggestion because your is faulty?

 

 

You only advised going one level up the master chain.  A summon's summon would have the summon as the master.

 

EDIT: And you still have to explain why my method is a huge exploit.   WhiteTiger's system had the problem of giving 1 XP to the high level and 200 XP  to the low level.  My suggestion would turn this into 1 XP for both.


  • WhiteTiger aime ceci

#22
Shadooow

Shadooow
  • Members
  • 4 465 messages

You only advised going one level up the master chain.  A summon's summon would have the summon as the master.

Lol and who beside you use chaining summons? This is not a standard and its something that I wouldnt recommend myself. Has so many problems for what purpose? I found a bettter way though I know that your pride wont allow you to use any of my scripting I ever published.



#23
WhiZard

WhiZard
  • Members
  • 1 204 messages

Lol and who beside you use chaining summons? This is not a standard and its something that I wouldnt recommend myself. Has so many problems for what purpose? I found a bettter way though I know that your pride wont allow you to use any of my scripting I ever published.

 

Many standard summons have summons.


  • WhiteTiger aime ceci

#24
WhiteTiger

WhiteTiger
  • Members
  • 479 messages
I rewrote the script a few posts above and as everyone can see I'm repeating the same code twice: 
 
Line 53-104 && line 121-173 
 
Is possible to avoid the repetition of code to save lines?


#25
Shadooow

Shadooow
  • Members
  • 4 465 messages

Many standard summons have summons.

oh okay... my mistake

 

is any of these summons accessable for PC ?