Aller au contenu

Photo

Modifying LVLup GUI


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Serlith_

Serlith_
  • Members
  • 72 messages

I want to make a rather small change to the leveling process, that is decrease the max skill ranks from PC LVL + 3 to PC LVL. The XML calls to functions that don't seem to be callable from stripting level, so... Does that mean I have to write my own from scratch to achieve this?



#2
Clangeddin86

Clangeddin86
  • Members
  • 220 messages

There is an ugly workaround for this to be done with scripting, but:

1) it makes characters not legal, so if the module does not allow illegal characters you won't be let in.

2) It's not general and requires a slight modification of every module you use it on.

3) It fires only on level up, so for first level it won't count.

4) The script only triggers AFTER level up is COMPLETED, this means that during the levelling process, you will still be able to distribute points above your character's level, doing so will trigger the problem listed at point 5).

5) it's mistake prone by the user's end and penalizes the users cheating him out of a few skill points until he levels up again. If this mistake is done at max level, the penalty will be permanent.

 

Still, if you can live with all these issues, here's the script that will do (more or less), what required.

 

You have to put this script (you decide the name) on "On Player Level Up Script" of the Module Properties.

//:://////////////////////////////////////////////
//:: Created By: Clangeddin 
//:: Created On: 2015
//:://////////////////////////////////////////////

void main()
{
	object oPC = GetPCLevellingUp();
	int nMAX = GetTotalLevels(oPC, FALSE);
	int nSKILL;
	int nAMOUNT;
	int nROWS = GetNum2DARows("skills");
	int nREMAIN = GetSkillPointsRemaining(oPC);
	int nREST = nREMAIN;
	while (nSKILL < nROWS)
	{
		nAMOUNT = GetSkillRank(nSKILL, oPC, TRUE);
		if (nAMOUNT > nMAX)
		{
			SetBaseSkillRank(oPC, nSKILL, nMAX, TRUE);
			nREST = nREST + nAMOUNT - nMAX;
		}
		nSKILL = nSKILL + 1;
	}
	if (nREST > 0)
	{
		SetSkillPointsRemaining(oPC, nREST);
		FloatingTextStringOnCreature("The base rank of some of your skills has been toned down to your character's level. You have been refunded " + IntToString(nREST - nREMAIN) + " skill points to spend next level. Be careful to not distribute base skill ranks higher than character's level at max level or you will lose skill points permanently.", oPC, FALSE);	
	}
}