Jump to content
  • 0

Reset Stats NPC


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  740
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

i'm Looking For  This Script Sample Screen shot

 

Reset Specitic Stat
[ STR AGI VIT INT DEX LUK ]

14593562_1067541860028963_2089894090_n.p

Edited by Bringer
Link to comment
Share on other sites

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

you can actually done this without need of any custom source mod.

 

Example:

https://pastebin.com/dZx4Xjw0

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

Meh.. I knew about the compatibility but I was waiting for someone to come with another solution like you did.
 
I'm used to use the 'set' and I've been using this old syntax since eAthena but I'm gonna try to stop. Again, I'm sorry for that and feel free to replace them.
 
Thank you for this command, it'll be very usefull for this npc.
 

EDIT--

Here is the final version without source mod as @Secrets suggested.

// Author: _Okuz_
// Version: 1.0.3 - 16:15 15/10/2016
prontera,150,150,5	script	Reset NPC	690,{

	mes "[Reset NPC]";
	mes "...";
	mes "...";
	mes "...";
	mes "...";
	next;
	.@option = select("Reset Specific Stat:Reset Status:Reset Skills:Reset Both") - 1;

	if (Zeny < .reset_settings[.@option]) {
		mes "[Reset NPC]";
		mes "...";
		close;
	}

	Zeny -= .reset_settings[.@option];
	.@option = 1<<.@option;

	if (.@option & 1) {
		mes "[Reset NPC]";
		mes "...";
		next;
		.@status = select("Str:Agi:Vit:Int:Dex:Luk") - 1;

		setarray .@backup_status[0], readparam(bStr), readparam(bAgi), readparam(bVit), readparam(bInt), readparam(bDex), readparam(bLuk);

		resetstatus;

		for (.@i = 0; .@i < 6; .@i++) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i] - 1;
			StatusPoint -= needed_status_point(callsub(S_getStatusConst, .@i), -(.@backup_status[.@i] - 1));
		}
	}
	else {
		if (.@option & 2 || .@option & 8)
			resetstatus;
		if (.@option & 4 || .@option & 8)
			resetskill;
	}
	close;

// Arg(0): status_index
S_getStatusConst:
	.@i = getarg(0);
	switch (.@i) {
		case 0: return bStr;
		case 1: return bAgi;
		case 2: return bVit;
		case 3: return bInt;
		case 4: return bDex;
		case 5: return bLuk;
		default: debugmes "[Error] : Invalid 'status_index' on " + strnpcinfo(3) + ".";
	}
	end;

OnInit:
	setarray .reset_settings[0], 5000, // 5000z for Specific Stat
				     5000, // 5000z for Status
				     5000, // 5000z for Skills
				     7500; // 7500z for Both (Status + Skills)
}

Tested and working.

Edited by _Okuz_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  740
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

i'm Looking For This Script Sample Screen shot

Reset Specitic Stat

[ STR AGI VIT INT DEX LUK ]

14593562_1067541860028963_2089894090_n.p

bump i can anyone make this script?
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

Hello Bringer,

 

This is such a nice idea, I'm gonna create this script tonight.

Att,

_Okuz_.

Edited by _Okuz_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  740
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

Hello Bringer,

 

This is such a nice idea, I'm gonna create this script tonight.

Att,

_Okuz_.

ok thanks

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

Hello again Bringer,

 

Unfortunately I'm not able to test it (I'm currently at work right now... /hmm ). Please let me know if it works as you expect.

// Author: _Okuz_
// Version: 1.0.0 - 11:46 13/10/2016
prontera,150,150,5	script	Reset NPC	502,{

	mes "[Reset NPC]";
	mes "...";
	mes "...";
	mes "...";
	mes "...";
	next;
	set .@option, select("Reset Specific Stat:Reset Status:Reset Skills:Reset Both") - 1;

	if (Zeny < .reset_settings[.@option]) {
		mes "[Reset NPC]";
		mes "...";
		close;
	}

	set Zeny, Zeny - .reset_settings[.@option];
	set .@option, 1<<.@option;

	if (.@option & 1) {
		mes "[Reset NPC]";
		mes "...";
		next;
		set .@status, select("Str:Agi:Vit:Int:Dex:Luk") - 1;

		setarray .@backup_status[0], readparam(bStr), readparam(bAgi), readparam(bVit), readparam(bInt), readparam(bDex), readparam(bLuk);

		resetstatus;

		for (set .@i, 0; .@i < 6; set .@i, .@i + 1) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i];
		}
	}
	else {
		if (.@option & 2 || .@option & 8)
			resetstatus;
		if (.@option & 4 || .@option & 8)
			resetskills;
	}
	close;

// Arg(0): status_index
S_getStatusConst:
	set .@i, getarg(0);
	switch (.@i) {
		case 0: return bStr;
		case 1: return bAgi;
		case 2: return bVit;
		case 3: return bInt;
		case 4: return bDex;
		case 5: return bLuk;
		default: debugmes "[Error] : Invalid 'status_index' on " + strnpcinfo(3) + ".";
	}
	end;

OnInit:
	setarray .reset_settings[0], 5000, // 5000z for Specific Stat
                                     5000, // 5000z for Status
				     5000, // 5000z for Skills
				     7500; // 7500z for Both (Status + Skills)
}

Att,
_Okuz_,

Edited by _Okuz_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  740
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

Hello again Bringer,

 

Unfortunately I'm not able to test it (I'm currently at work right now... /hmm ). Please let me know if it works as you expect.

// Author: _Okuz_
// Version: 1.0.0 - 11:46 13/10/2016
prontera,150,150,5	script	Reset NPC	502,{

	mes "[Reset NPC]";
	mes "...";
	mes "...";
	mes "...";
	mes "...";
	next;
	set .@option, select("Reset Specific Stat:Reset Status:Reset Skills:Reset Both") - 1;

	if (Zeny < .reset_settings[.@option]) {
		mes "[Reset NPC]";
		mes "...";
		close;
	}

	set Zeny, Zeny - .reset_settings[.@option];
	set .@option, 1<<.@option;

	if (.@option & 1) {
		mes "[Reset NPC]";
		mes "...";
		next;
		set .@status, select("Str:Agi:Vit:Int:Dex:Luk") - 1;

		setarray .@backup_status[0], readparam(bStr), readparam(bAgi), readparam(bVit), readparam(bInt), readparam(bDex), readparam(bLuk);

		resetstatus;

		for (set .@i, 0; .@i < 6; set .@i, .@i + 1) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i];
		}
	}
	else {
		if (.@option & 2 || .@option & 8)
			resetstatus;
		if (.@option & 4 || .@option & 8)
			resetskills;
	}
	close;

// Arg(0): status_index
S_getStatusConst:
	set .@i, getarg(0);
	switch (.@i) {
		case 0: return bStr;
		case 1: return bAgi;
		case 2: return bVit;
		case 3: return bInt;
		case 4: return bDex;
		case 5: return bLuk;
		default: debugmes "[Error] : Invalid 'status_index' on " + strnpcinfo(3) + ".";
	}
	end;

OnInit:
	setarray .reset_settings[0], 5000, // 5000z for Specific Stat
                                     5000, // 5000z for Status
				     5000, // 5000z for Skills
				     7500; // 7500z for Both (Status + Skills)
}

Att,

_Okuz_,

Ok First Test 100% Working 

 

STR 500

AGI 500

VIT 500

INT 500

DEX 500

LUK 500

 

my STR -499 

2nd Test

 

STR 1

AGI 1

VIT 1

INT 1

DEX 1

LUK 1

 

i Choose Again The Str and again my STR is 1 BUT

 

STR 1

AGI 2

VIT 2

INT 2

DEX 2

LUK 2

Everytime i have 1 allstats and choose reset any stat my other stats add +1 Stats

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

Alright, I got it.

I'll be back soon with the fix.

 

EDIT--

I'm back, well the solution seems to be very easy.

// Author: _Okuz_
// Version: 1.0.1 - 11:46 13/10/2016
prontera,150,150,5	script	Reset NPC	690,{

	mes "[Reset NPC]";
	mes "...";
	mes "...";
	mes "...";
	mes "...";
	next;
	set .@option, select("Reset Specific Stat:Reset Status:Reset Skills:Reset Both") - 1;

	if (Zeny < .reset_settings[.@option]) {
		mes "[Reset NPC]";
		mes "...";
		close;
	}

	set Zeny, Zeny - .reset_settings[.@option];
	set .@option, 1<<.@option;

	if (.@option & 1) {
		mes "[Reset NPC]";
		mes "...";
		next;
		set .@status, select("Str:Agi:Vit:Int:Dex:Luk") - 1;

		setarray .@backup_status[0], readparam(bStr), readparam(bAgi), readparam(bVit), readparam(bInt), readparam(bDex), readparam(bLuk);

		resetstatus;

		for (set .@i, 0; .@i < 6; set .@i, .@i + 1) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i] - 1;
		}
	}
	else {
		if (.@option & 2 || .@option & 8)
			resetstatus;
		if (.@option & 4 || .@option & 8)
			resetskill;
	}
	close;

// Arg(0): status_index
S_getStatusConst:
	set .@i, getarg(0);
	switch (.@i) {
		case 0: return bStr;
		case 1: return bAgi;
		case 2: return bVit;
		case 3: return bInt;
		case 4: return bDex;
		case 5: return bLuk;
		default: debugmes "[Error] : Invalid 'status_index' on " + strnpcinfo(3) + ".";
	}
	end;

OnInit:
	setarray .reset_settings[0], 5000, // 5000z for Specific Stat
                                     5000, // 5000z for Status
				     5000, // 5000z for Skills
				     7500; // 7500z for Both (Status + Skills)
}

Now it should work as expected.

 

Att,

_Okuz_.

Edited by _Okuz_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  149
  • Reputation:   3
  • Joined:  07/29/16
  • Last Seen:  

i think something is wrong with the script. when you reset specific stats..

 

For example.. 255 max base lvl will give your character a total of 7,237 statspoints. When you put Str +254 for a total of Str 255 that will cost you 3,611 statspoint. So here's what happen, when i reset Str instead of giving me back a 3,611 statspoints it will give a full 7,237 statspoints. im just saying :D

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

Seems that statusup is not counting them correctly. I need to find a way to recalculate the status points after using the statusup... maybe there is already a built in function for that, but honestly I don't know.
 
I'll working on it, thank you for your report Brahms!
 
Att,
​_Okuz_.

EDIT--
Hey Brahms, are you able to test something for me?
 
Change this:
		for (set .@i, 0; .@i < 6; set .@i, .@i + 1) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i] - 1;
		}

To this:

		for (set .@i, 0; .@i < 6; set .@i, .@i + 1) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i] - 1;
		}

		recalculatestat; // new line added to force to recalculate status points!

Maybe it should work now!

Att,
_Okuz_.

Edited by _Okuz_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  149
  • Reputation:   3
  • Joined:  07/29/16
  • Last Seen:  

ok dude let me try..


it says missing function name or calling undeclared function. give me the last script buddy then ill try it.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

// Author: _Okuz_
// Version: 1.0.1 - 11:46 13/10/2016
prontera,150,150,5	script	Reset NPC	690,{

	mes "[Reset NPC]";
	mes "...";
	mes "...";
	mes "...";
	mes "...";
	next;
	set .@option, select("Reset Specific Stat:Reset Status:Reset Skills:Reset Both") - 1;

	if (Zeny < .reset_settings[.@option]) {
		mes "[Reset NPC]";
		mes "...";
		close;
	}

	set Zeny, Zeny - .reset_settings[.@option];
	set .@option, 1<<.@option;

	if (.@option & 1) {
		mes "[Reset NPC]";
		mes "...";
		next;
		set .@status, select("Str:Agi:Vit:Int:Dex:Luk") - 1;

		setarray .@backup_status[0], readparam(bStr), readparam(bAgi), readparam(bVit), readparam(bInt), readparam(bDex), readparam(bLuk);

		resetstatus;

		for (set .@i, 0; .@i < 6; set .@i, .@i + 1) {
			if (.@status == .@i)
				continue;

			statusup2 callsub(S_getStatusConst, .@i), .@backup_status[.@i] - 1;
		}

		recalculatestat;
	}
	else {
		if (.@option & 2 || .@option & 8)
			resetstatus;
		if (.@option & 4 || .@option & 8)
			resetskill;
	}
	close;

// Arg(0): status_index
S_getStatusConst:
	set .@i, getarg(0);
	switch (.@i) {
		case 0: return bStr;
		case 1: return bAgi;
		case 2: return bVit;
		case 3: return bInt;
		case 4: return bDex;
		case 5: return bLuk;
		default: debugmes "[Error] : Invalid 'status_index' on " + strnpcinfo(3) + ".";
	}
	end;

OnInit:
	setarray .reset_settings[0], 5000, // 5000z for Specific Stat
                                     5000, // 5000z for Status
				     5000, // 5000z for Skills
				     7500; // 7500z for Both (Status + Skills)
}

Every time you get an error try posting some screenshots of your map-server console. By doing this you helps me to understand what exactly is going on. Besides that, make sure that your rAthena is up to date.

Att,

_Okuz_.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  149
  • Reputation:   3
  • Joined:  07/29/16
  • Last Seen:  

ok buddy. let me try them..


Here's what it says buddy. All.txt is a file where i put the script.

post-40858-0-04114600-1476453741_thumb.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  383
  • Reputation:   121
  • Joined:  03/31/12
  • Last Seen:  

This script seems interested :D i've been looking for this kind of script also.
Which can reset a specific stat, instead of resetall.

Edited: I found a bug which players gives a full stats.

 

bTYRnsp.gif

 

ok buddy. let me try them..


Here's what it says buddy. All.txt is a file where i put the script.

Probably your missing a script command for this?

 

 

*recalculatestat;

This command will force a stat recalculation for the attached player.
 

Edited by Azeroth
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  149
  • Reputation:   3
  • Joined:  07/29/16
  • Last Seen:  

i think something is wrong with the script. when you reset specific stats..

 

For example.. 255 max base lvl will give your character a total of 7,237 statspoints. When you put Str +254 for a total of Str 255 that will cost you 3,611 statspoint. So here's what happen, when i reset Str instead of giving me back a 3,611 statspoints it will give a full 7,237 statspoints. im just saying :D

 

same as azeroth. but he has a better explanation for the bug since he uploaded images. :D

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

I just made a quick test for this also it has a bug. it gives you full stats points.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   431
  • Joined:  01/26/16
  • Last Seen:  

 

 

*recalculatestat;

This command will force a stat recalculation for the attached player.

This has nothing to do with stat reset, just fyi.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  383
  • Reputation:   121
  • Joined:  03/31/12
  • Last Seen:  

 

 

 

*recalculatestat;

This command will force a stat recalculation for the attached player.

This has nothing to do with stat reset, just fyi.

 

Oh sad, are you able to help us out? i find it very useful.

Hope you can fixed it.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

 

 

 

*recalculatestat;

This command will force a stat recalculation for the attached player.

This has nothing to do with stat reset, just fyi.

 

 

I'm not able to read the script.c to check its behavior now. I just tried that because it says it'll recalculate status then I thought it would work for that.
 
Do you know any command or any way to recalculate the status?

EDIT--

I'm gonna read all the atcommands, maybe we can find the solution there.

Edited by _Okuz_
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  740
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

*recalculatestat;

This command will force a stat recalculation for the attached player.

This has nothing to do with stat reset, just fyi.

I'm not able to read the script.c to check its behavior now. I just tried that because it says it'll recalculate status then I thought it would work for that.

Do you know any command or any way to recalculate the status?

hmm what about use atcommand Agi -499 ?
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

EDIT--
Here is what I found:
 
statusup uses pc_statusup to increase status and it does subtract status points when raising a status. statusup2 uses pc_statusup2 to raise or decrease status and it doesn't subtracts status points when increasing / decreasing a status.

Here is the source doc:
 

pc_statusup:
 

/**

 * Raises a stat by the specified amount.
 *
 * Obeys max_parameter limits.
 * Subtracts status points according to the cost of the increased stat points.
 *
 * @param sd       The target character.
 * @param type     The stat to change (see enum _sp)
 * @param increase The stat increase (strictly positive) amount.
 * @retval true  if the stat was increased by any amount.
 * @retval false if there were no changes.

 */

==================================================
 

pc_statusp2:
 

/**
 * Raises a stat by the specified amount.
 *
 * Obeys max_parameter limits.
 * Does not subtract status points for the cost of the modified stat points.
 *
 * @param sd   The target character.
 * @param type The stat to change (see enum _sp)
 * @param val  The stat increase (or decrease) amount.
 * @return the stat increase amount.
 * @retval 0 if no changes were made.
 */

 

We have three options to resolve this issue:
1) Change the usage of statusup2 for statusup and loop through each status to increase them by 1 each time till the .@backup_status[<status>] amount. (without source mod)
2) Change the statusup arguments to receive an extra argument that is the amount of points we want to increase. (source mod required)
3) Use needed_status_point() to calculate the points that we need to subtract. (without source mod)
 
I choosed the second one and here is the final script and the .patch / .diff... I'm gonna send a PR regarding this but honestly I don't know if they will accept or not.

EDIT--
The second option breaks up statusup backward compatibility and should not be used.
Edited by _Okuz_
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

 

EDIT--

Here is what I found:

 
statusup uses pc_statusup to increase status and it does subtract status points when raising a status. statusup2 uses pc_statusup2 to raise or decrease status and it doesn't subtracts status points when increasing / decreasing a status.

Here is the source doc:

 

pc_statusup:

 

/**

 * Raises a stat by the specified amount.
 *
 * Obeys max_parameter limits.
 * Subtracts status points according to the cost of the increased stat points.
 *
 * @param sd       The target character.
 * @param type     The stat to change (see enum _sp)
 * @param increase The stat increase (strictly positive) amount.
 * @retval true  if the stat was increased by any amount.
 * @retval false if there were no changes.

 */

==================================================

 

pc_statusp2:

 

/**
 * Raises a stat by the specified amount.
 *
 * Obeys max_parameter limits.
 * Does not subtract status points for the cost of the modified stat points.
 *
 * @param sd   The target character.
 * @param type The stat to change (see enum _sp)
 * @param val  The stat increase (or decrease) amount.
 * @return the stat increase amount.
 * @retval 0 if no changes were made.
 */

 

We have two options to resolve this issue:
1) Change the usage of statusup2 for statusup and loop through each status to increase them by 1 each time till the .@backup_status[<status>] amount. (without source mod)
2) Change the statusup arguments to receive an extra argument that is the amount of points we want to increase. (source mod required)
 
I choosed the second one and here is the final script and the .patch / .diff... I'm gonna send a PR regarding this but honestly I don't know if they will accept or not.

 

I'll test it when i get home.

Thank you for this _Okuz_ i appreciate it. + 1

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   431
  • Joined:  01/26/16
  • Last Seen:  

I choosed the second one and here is the final script and the .patch / .diff... I'm gonna send a PR regarding this but honestly I don't know if they will accept or not.

I would reject it for sake of backward compatibility since your diff completely break all scripts using <char id> parameter in statusup command.

 

I have recently implemented needed_status_point script command to calculate amount of status points needed for raising stats to a point, so use that to get the amount of status points to subtract.

*needed_status_point(<type>,<val>{,<char id>});

Returns the number of stat points needed to change the specified stat <type> by <val>.
If <val> is negative, returns the number of stat points that would be needed to
raise the specified stat from (current value - <val>) to current value. 

By the way, it's 2016 now, stop using the `set` script command.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

Where's the attachment?

Edit: I just found out you have posted the script without the source mod:

Thank you once again, and secre for ur solution.

EDIT--

Here is what I found:

statusup uses pc_statusup to increase status and it does subtract status points when raising a status. statusup2 uses pc_statusup2 to raise or decrease status and it doesn't subtracts status points when increasing / decreasing a status.

Here is the source doc:

pc_statusup:

/**

* Raises a stat by the specified amount.

*

* Obeys max_parameter limits.

* Subtracts status points according to the cost of the increased stat points.

*

* @param sd The target character.

* @param type The stat to change (see enum _sp)

* @param increase The stat increase (strictly positive) amount.

* @retval true if the stat was increased by any amount.

* @retval false if there were no changes.

*/

==================================================

pc_statusp2:

/**

* Raises a stat by the specified amount.

*

* Obeys max_parameter limits.

* Does not subtract status points for the cost of the modified stat points.

*

* @param sd The target character.

* @param type The stat to change (see enum _sp)

* @param val The stat increase (or decrease) amount.

* @return the stat increase amount.

* @retval 0 if no changes were made.

*/

We have three options to resolve this issue:

1) Change the usage of statusup2 for statusup and loop through each status to increase them by 1 each time till the .@backup_status[<status>] amount. (without source mod)

2) Change the statusup arguments to receive an extra argument that is the amount of points we want to increase. (source mod required)

3) Use needed_status_point() to calculate the points that we need to subtract. (without source mod)

I choosed the second one and here is the final script and the .patch / .diff... I'm gonna send a PR regarding this but honestly I don't know if they will accept or not.

EDIT--

The second option breaks up statusup backward compatibility and should not be used.

Edited by Kaze
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  92
  • Reputation:   17
  • Joined:  08/11/12
  • Last Seen:  

you can actually done this without need of any custom source mod.

 

Example:

https://pastebin.com/dZx4Xjw0

Yes! I said the same thing on my previous posts. I have listed your solution as my first option to resolve this issue but Secrets gave us some info regarding a command that pretty much resolves the whole thing.  /meh 

By the way I released the latest version, without source mod like you said  /no1 

Thank you again!

PS: I love the way you script, it's so clean and easy to understand!  /lv

Edited by _Okuz_
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...