Reset Stat point Bug

03/26/2023 22:20 zoalalove#1
Hello Guys
i'm use query to Reset Stat and all good
this query It works fine, but there is a problem
when use it will see ur Stat point back - but still have phy or mag attack and def don't change
clarification
if you play Str and make reset stat u will have ur phy attack and def and u can get more def and attack when use stat point
I want to reset for that too
03/26/2023 23:45 leiwis#2
If it fails to reset, it means that something is wrong.

so

_AddLogItem in SRO_VT_LOG oR SHARDLOG

if(@Operation = 41 and @[Only registered and activated users can see links. Click Here To Register...]To = 255 and (@ItemRefID = 465562)) --Stat Reset Scroll--
begin
WAITFOR DELAY '00:00:03';
declare @[Only registered and activated users can see links. Click Here To Register...] smallint
declare @[Only registered and activated users can see links. Click Here To Register...] smallint
declare @[Only registered and activated users can see links. Click Here To Register...] tinyint
declare @[Only registered and activated users can see links. Click Here To Register...]tatPoint smallint
select @[Only registered and activated users can see links. Click Here To Register...] = MaxLevel from SRO_VT_SHARD.._Char where CharID = @CharID
set @[Only registered and activated users can see links. Click Here To Register...]tatPoint = @[Only registered and activated users can see links. Click Here To Register...]*3)-3
set @[Only registered and activated users can see links. Click Here To Register...] = @[Only registered and activated users can see links. Click Here To Register...]+19
UPDATE SRO_VT_SHARD.._Char SET Strength @[Only registered and activated users can see links. Click Here To Register...], Intellect @[Only registered and activated users can see links. Click Here To Register...], RemainStatPoint @[Only registered and activated users can see links. Click Here To Register...]tatPoint WHERE CharID=@CharID
end
03/27/2023 09:32 zoalalove#3
Gallery
03/27/2023 23:15 painmaker_#4
In case it's a PvP server, you don't need to reset any character's stats. You just have to adjust the character's stats to INT or STR as required.
Quote:
-- STR / INT
IF (@Operation = 41) and (@ItemRefID = 123123)-- STR -- By Developer Gamer
Begin
Update [SRO_VT_SHARD].[dbo].[_Char] Set Strength=456, Intellect=129, RemainStatPoint=0 WHERE CharID=@CharID
END
--END STR
--INT STAT SCROLL
IF (@Operation = 41) and (@ItemRefID = 123123) -- INT
Begin
Update [SRO_VT_SHARD].[dbo].[_Char] Set Strength=129, Intellect=456, RemainStatPoint=0 WHERE CharID=@CharID
End
--END INT STAT
03/28/2023 17:19 JellyBitz#5
Quote:
Originally Posted by painmaker_ View Post
You just have to adjust the character's stats to INT or STR as required.
I think you're getting the wrong approach leaving more space to bugs.

You all are navigating into bugs since you're not really setting the default values. Let me introduce you the maths.
Quote:
-- Check for Reset Scroll being used
IF (@Operation = 41) AND (@ItemRefID = YOUR_ITEM_ID)
BEGIN
-- Your server settings
DECLARE @StatsByLevel INTEGER = 3
DECLARE @BaseSTR INTEGER = 20
DECLARE @BaseINT INTEGER = 20
-- Reset character stat points
UPDATE [SRO_VT_SHARD].[dbo].[_Char]
SET Strength=@BaseSTR+(MaxLevel-1), Intellect=@BaseINT+(MaxLevel-1), RemainStatPoint=(MaxLevel-1)*@StatsByLevel
WHERE CharID=@CharID
END
03/28/2023 18:47 painmaker_#6
Quote:
Originally Posted by JellyBitz View Post
I think you're getting the wrong approach leaving more space to bugs.

You all are navigating into bugs since you're not really setting the default values. Let me introduce you the maths.
i am not sharing reset stat scroll. However i respect your feedback.
03/30/2023 00:36 leo2111#7
Quote:
Originally Posted by zoalalove View Post
Gallery
Your problem is not coming from the reset stats query
That's phy / mag defense

You cannot reset that through a query, in this picture you might have had wearing a full set and holding a weapon. If you want to "reset" that, you simply have to wear a default set, _BASIC D1 items. D11, D12, D13, D14, D15, their minimum required level to wear them it's 101, so their defense/attack pwr. gets applied , even if your stats are reset.

About reset stats query, I would go for JelliyBitz's query, it's safer but to make it even more safer, I would put it in a try and add a rollback transaction if any error happens, because you never know...
USE SRO_VT_SHARD
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo]._ResetPlayerStats
@[Only registered and activated users can see links. Click Here To Register...]D INT,
@[Only registered and activated users can see links. Click Here To Register...]CodeName VARCHAR(250)
AS
SET NOCOUNT ON;
SET XACT_ABORT ON;
DECLARE @[Only registered and activated users can see links. Click Here To Register...]Value int
IF XACT_STATE() = -1
BEGIN
SET @[Only registered and activated users can see links. Click Here To Register...]Value = -1;
GOTO ErrorHandler;
END
BEGIN TRY
DECLARE @[Only registered and activated users can see links. Click Here To Register...]ByLevel INTEGER = 3
DECLARE @[Only registered and activated users can see links. Click Here To Register...]TR INTEGER = 20
DECLARE @[Only registered and activated users can see links. Click Here To Register...]T INTEGER = 20
DECLARE @[Only registered and activated users can see links. Click Here To Register...]16 VARCHAR(50) = (SELECT CharName16 FROM [SRO_VT_SHARD].[dbo]._Char WHERE CharID = @[Only registered and activated users can see links. Click Here To Register...]D)
/* Checks if any of the variables returns NULL OR nothing gets updated */
IF @[Only registered and activated users can see links. Click Here To Register...]D IS NULL OR @[Only registered and activated users can see links. Click Here To Register...]CodeName IS NULL OR @@ROWCOUNT = 0)
BEGIN
SET @[Only registered and activated users can see links. Click Here To Register...]Value = -2;
GOTO ErrorHandler;
END
BEGIN TRANSACTION;
UPDATE [SRO_VT_SHARD].[dbo].[_Char]
SET Strength @[Only registered and activated users can see links. Click Here To Register...]TR+(MaxLevel-1)
, Intellect @[Only registered and activated users can see links. Click Here To Register...]T+(MaxLevel-1)
, RemainStatPoint=(MaxLevel-1) @[Only registered and activated users can see links. Click Here To Register...]ByLevel
WHERE CharID @[Only registered and activated users can see links. Click Here To Register...]D
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
GOTO ErrorHandler;
END CATCH;
RETURN 0;
/*_# Give back the scroll in case of any error */
ErrorHandler:
IF XACT_STATE() <> 0
ROLLBACK TRANSACTION;
EXEC _ADD_ITEM_EXTERN @[Only registered and activated users can see links. Click Here To Register...]16, @[Only registered and activated users can see links. Click Here To Register...]CodeName, 1, 0
RETURN @[Only registered and activated users can see links. Click Here To Register...]Value

and on item usage, just execute the query

IF (@Operation = 41) AND (@ItemRefID = YOUR_ITEM_ID)
BEGIN
DECLARE @[Only registered and activated users can see links. Click Here To Register...]CodeName VARCHAR(250) = 'YOUR_SCROLL_CODENAME'
EXEC [SRO_VT_SHARD].dbo._ResetPlayerStats @[Only registered and activated users can see links. Click Here To Register...]D, @[Only registered and activated users can see links. Click Here To Register...]CodeName
END

This query can be used in any of the cases, you just change the variables, the selections, and in case of anything goes wrong , you will get your scroll back