Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[FIX]Character creation

Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
I don't like seeing naked man. %)

So, here it is.
Just open your database, than new SQL-editor window, copy-paste the code, change starting bounty if you want(my set is 1000).

CREDITS
Idea by Rotana.
Coded by Nekroido The Mighty :biggrin:.

Code:
USE [Gunz]
GO
/****** Объект:  StoredProcedure [dbo].[spInsertChar]    Дата сценария: 03/28/2007 10:06:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spInsertChar]
	@nAID INT,
	@nCharIndex INT,
	@szName nvarchar(32),
	@nSex INT,
	@nHair INT,
	@nFace INT,
	@nCostume INT
AS
BEGIN
	SET NOCOUNT ON;
	
	DECLARE @cnt INT
	SELECT @cnt=COUNT(*)
	FROM Character
	WHERE AID = @nAID
	
	DECLARE @cid INT
	SELECT @cid=COUNT(*)
	FROM Character

	INSERT INTO Character
	VALUES(@nAID,@szName,@cnt,1,@nSex,@nCostume,@nFace,@nHair,NULL,0,'1,000',0,0,0,0,0,0,0,0,0,0,0,0,@cnt,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,getdate(),getdate(),0)

    DECLARE @charid INT
    SELECT @charid=CID
    FROM Character
    WHERE Name=@szName


    DECLARE @head_slot INT
    DECLARE @chest_slot INT
    DECLARE @hands_slot INT
    DECLARE @legs_slot INT
    DECLARE @feet_slot INT
    DECLARE @fingerl_slot INT
    DECLARE @fingerr_slot INT
    DECLARE @melee_slot INT
    DECLARE @primary_slot INT
    DECLARE @secondary_slot INT
    DECLARE @custom1_slot INT
    DECLARE @custom2_slot INT

IF @nSex = 0
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,21001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,23001)

    SELECT @chest_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 21001
    SELECT @legs_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 23001

    UPDATE Character
    SET
    chest_itemid = 21001,
    legs_itemid = 23001,
    chest_slot = @chest_slot,
    legs_slot = @legs_slot
    WHERE CID = @charid
END
ELSE
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,21501)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,23501)

    SELECT @chest_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 21501
    SELECT @legs_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 23501

    UPDATE Character
    SET
    chest_itemid = 21501,
    legs_itemid = 23501,
    chest_slot = @chest_slot,
    legs_slot = @legs_slot
    WHERE CID = @charid
END

IF @nCostume = 0
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,1)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,5001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30301)

    SELECT @melee_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 1
    SELECT @primary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 5001
    SELECT @secondary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 4001
    SELECT @custom1_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 30301

    UPDATE Character
    SET
    melee_itemid = 1,
    primary_itemid = 5001,
    secondary_itemid = 4001,
    custom1_itemid =30301,
    melee_slot = @melee_slot,
    primary_slot = @primary_slot,
    secondary_slot = @secondary_slot,
    custom1_slot = @custom1_slot
    WHERE CID = @charid
END
ELSE IF @nCostume = 1
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,5002)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30301)

    SELECT @melee_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 2
    SELECT @primary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 5002
    SELECT @custom1_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 30301

    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 5002,
    custom1_itemid =30301,
    melee_slot = @melee_slot,
    primary_slot = @primary_slot,
    custom1_slot = @custom1_slot
    WHERE CID = @charid
END
ELSE IF @nCostume = 2
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,1)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4005)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,5001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30401)

    SELECT @melee_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 1
    SELECT @primary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 4005
    SELECT @secondary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 5001
    SELECT @custom1_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 30401

    UPDATE Character
    SET
    melee_itemid = 1,
    primary_itemid = 4005,
    secondary_itemid = 5001,
    custom1_itemid =30401,
    melee_slot = @melee_slot,
    primary_slot = @primary_slot,
    secondary_slot = @secondary_slot,
    custom1_slot = @custom1_slot
    WHERE CID = @charid
END
ELSE IF @nCostume = 3
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30301)

    SELECT @melee_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 2
    SELECT @primary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 4001
    SELECT @custom1_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 30401

    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 4001,
    custom1_itemid =30401,
    melee_slot = @melee_slot,
    primary_slot = @primary_slot,
    custom1_slot = @custom1_slot
    WHERE CID = @charid
END
ELSE IF @nCostume = 4
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4002)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30401)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30001)

    SELECT @melee_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 2
    SELECT @primary_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 4002
    SELECT @custom1_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 30401
    SELECT @custom2_slot = CIID
    FROM Items
    WHERE CID=@charid AND ItemID = 30001

    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 4002,
    custom1_itemid =30401,
    custom2_itemid =30001,
    melee_slot = @melee_slot,
    primary_slot = @primary_slot,
    secondary_slot = @secondary_slot,
    custom1_slot = @custom1_slot,
    custom2_slot = @custom2_slot
    WHERE CID = @charid
END
ELSE IF @nCostume = 5
BEGIN

    IF @nSex = 0
    BEGIN
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,1)
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,4006)
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,30101)
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,30001)

        SELECT @melee_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 1
        SELECT @primary_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 4006
        SELECT @custom1_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 30101
        SELECT @custom2_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 30001

        UPDATE Character
        SET
        melee_itemid = 1,
        primary_itemid = 4006,
        custom1_itemid =30101,
        custom2_itemid =30001,
        melee_slot = @melee_slot,
        primary_slot = @primary_slot,
        custom1_slot = @custom1_slot,
        custom2_slot = @custom2_slot
        WHERE CID = @charid
    END
    ELSE
    BEGIN
        -- Girl Doctor.
        -- She suppose to have two Minic 567 x2.
        -- But this is bug of our Gunz executable(You can't have same weapons in both range weapon slots).
        -- You may uncomment that sql-expressions.
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,1)
--        INSERT INTO Items ([CID],[ItemID])
--        VALUES(@charid,4006)
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,4006)
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,30101)
        INSERT INTO Items ([CID],[ItemID])
        VALUES(@charid,30001)

        SELECT @melee_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 1
        SELECT @primary_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 4006
--        SELECT @secondary_slot = CIID
--        FROM Items
--        WHERE CID=@charid AND ItemID = 4006
        SELECT @custom1_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 30101
        SELECT @custom2_slot = CIID
        FROM Items
        WHERE CID=@charid AND ItemID = 30001

        UPDATE Character
        SET
        melee_itemid = 1,
        primary_itemid = 4006,
--        secondary_itemid = 4006,
        custom1_itemid =30101,
        custom2_itemid =30001,
        melee_slot = @melee_slot,
        primary_slot = @primary_slot,
--        secondary_slot = @secodary_slot,
        custom1_slot = @custom1_slot,
        custom2_slot = @custom2_slot
        WHERE CID = @charid
    END
END

END

FIXED.

Now your character not only gets starting equipment, but equips it.
I found a bug in Gunz.exe, Girl Doctor has two Minic 567 x2 instead of one. And you can't equip same weapons in both ranged weapon slots.

You may also change spSelectCharItem(It was setting bounty to 10812564 %)). I removed that "autoset".
Code:
USE [Gunz]
GO
/****** Объект:  StoredProcedure [dbo].[spSelectCharItem]    Дата сценария: 03/28/2007 10:29:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spSelectCharItem]
	@CID INT
AS
BEGIN
	SET NOCOUNT ON;
	SELECT RentPeriodRemainder,CIID,ItemID
	FROM
	Items
	WHERE CID = @CID
END
 
Last edited:
Initiate Mage
Joined
Aug 4, 2006
Messages
88
Reaction score
0
Hmm I'm currently seeing..
Code:
    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 4002,
    custom1_itemid =30401,
    custom2_itemid =30001
    WHERE CID = @charid

    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4002)
Sholdn't those VALUES make use of the primary_itemid chest_itemid variables?

Also I'm noticing, the character does not equip the items when you enter the lobby and go to shop/inventory.. also I made a doctor and she did not have any revolvers. or any ranged weapon.
 
Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
Hmm I'm currently seeing..
Code:
    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 4002,
    custom1_itemid =30401,
    custom2_itemid =30001
    WHERE CID = @charid

    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4002)
Sholdn't those VALUES make use of the primary_itemid chest_itemid variables?

Also I'm noticing, the character does not equip the items when you enter the lobby and go to shop/inventory.. also I made a doctor and she did not have any revolvers. or any ranged weapon.
Dunno. =|
I've tested it and it worked perfect.

It could be server bug.
 
Joined
Jul 20, 2005
Messages
633
Reaction score
10
Hello:

your it release is very good, congratulations :D!

But and noticed errors:

the items appear in the inventory (not equipped) and it completes class begins without arms,
 
Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
Hello:

your it release is very good, congratulations :D!

But and noticed errors:

the items appear in the inventory (not equipped) and it completes class begins without arms,
 
Junior Spellweaver
Joined
Feb 19, 2007
Messages
178
Reaction score
0
Msg 8101, Level 16, State 1, Procedure spInsertChar, Line 22
An explicit value for the identity column in table 'Character' can only be specified when a column list is used and IDENTITY_INSERT is ON.

i got that..
 
Banned
Banned
Joined
Jan 13, 2007
Messages
1,898
Reaction score
65
um..if you have to change alter to create you have some realy big problems!
 
Initiate Mage
Joined
Apr 15, 2005
Messages
30
Reaction score
0
Server: Msg 8101, Level 16, State 1, Procedure spInsertChar, Line 22
An explicit value for the identity column in table 'Character' can only be specified when a column list is used and IDENTITY_INSERT is ON.

how to fix it?
 
Initiate Mage
Joined
Apr 15, 2005
Messages
30
Reaction score
0
sorry...i can't fix..when run in query it error..."Server: Msg 8101, Level 16, State 1, Procedure spInsertChar, Line 22
An explicit value for the identity column in table 'Character' can only be specified when a column list is used and IDENTITY_INSERT is ON."
how to fix it?please help me..anyone..??
 
Back
Top