Adding a new body option when creating a char,

Results 1 to 5 of 5
  1. #1
    num num num <3 rootbeer daniel131605 is offline
    MemberRank
    Jul 2008 Join Date
    New YorkLocation
    573Posts

    Adding a new body option when creating a char,

    Ok so you know when you make a character you get the basic hair and face and weapons, i want to add a new button that allows you to choose your head, or at least when you pick one of the options it changes the head. this is what i have so far and i've tested it and it works but the head piece doesn't go into the head slot in the inv.

    Code:
    USE [BlackGunzDB]
    GO
    /****** Object:  StoredProcedure [dbo].[spInsertChar]    Script Date: 05/05/2012 13:02:16 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    /* ??? ?? */
    ALTER PROC [dbo].[spInsertChar]
    	@AID		int,
    	@CharNum	smallint,
    	@Name		varchar(24),
    	@Sex		tinyint,
    	@Hair		int,  
    	@Face		int,
    	@Costume	int
    AS
    SET NOCOUNT ON
    BEGIN TRAN
    IF EXISTS (SELECT CID FROM Character where (AID=@AID AND CharNum=@CharNum) OR (Name=@Name))
    BEGIN	
    	ROLLBACK TRAN
    	return(-1)
    END
    
    DECLARE @CharIdent 	int
    DECLARE @ChestCIID	int
    DECLARE @LegsCIID	int
    DECLARE @MeleeCIID	int
    DECLARE @PrimaryCIID	int
    DECLARE @SecondaryCIID  int
    DECLARE @Custom1CIID	int
    DECLARE @Custom2CIID	int
      DECLARE @HeadCIID	int
    
    DECLARE @ChestItemID	int
    DECLARE @LegsItemID	int
    DECLARE @MeleeItemID	int
    DECLARE @PrimaryItemID	int
    DECLARE @SecondaryItemID  int
    DECLARE @Custom1ItemID	int
    DECLARE @Custom2ItemID	int
      DECLARE @HeadItemID	int
    
    SET @SecondaryCIID = NULL
    SET @SecondaryItemID = NULL
    
    SET @Custom1CIID = NULL
    SET @Custom1ItemID = NULL
    
    SET @Custom2CIID = NULL
    SET @Custom2ItemID = NULL
    
    INSERT INTO Character (AID, Name, CharNum, Level, Sex, Hair, Face, XP, BP, FR, CR, ER, WR, 
             		           GameCount, KillCount, DeathCount, RegDate, PlayTime, DeleteFlag)
    Values (@AID, @Name, @CharNum, 1, @Sex, @Hair, @Face, 0, 0, 0, 0, 0, 0, 0, 0, 0, GETDATE(), 0, 0)
    IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
    END
    
    
    SET @CharIdent = @@IDENTITY
    
      /* Melee */
      SET @MeleeItemID = 
        CASE @Costume
        WHEN 0 THEN 1
        WHEN 1 THEN 2
        WHEN 2 THEN 1
        WHEN 3 THEN 2
        WHEN 4 THEN 2
        WHEN 5 THEN 1
        END
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @MeleeItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @MeleeCIID = @@IDENTITY
      
      /* Head */
      SET @HeadItemID =
        CASE @Costume
        WHEN 0 THEN 700500
        WHEN 1 THEN 700500
        WHEN 2 THEN 21501
        WHEN 3 THEN 21501
        WHEN 4 THEN 21501
        WHEN 5 THEN 21501
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @HeadItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      SET @ChestCIID (changed it to HeadCIID and it didn't change) = @@IDENTITY
    
      /* Primary */
      SET @PrimaryItemID = 
        CASE @Costume
        WHEN 0 THEN 5001
        WHEN 1 THEN 5002
        WHEN 2 THEN 4005
        WHEN 3 THEN 4001
        WHEN 4 THEN 4002
        WHEN 5 THEN 4006
        END
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @PrimaryItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @PrimaryCIID = @@IDENTITY
    
      /* Secondary */
    IF @Costume = 0 OR @Costume = 2 BEGIN
      SET @SecondaryItemID =
        CASE @Costume
        WHEN 0 THEN 4001
        WHEN 1 THEN 0
        WHEN 2 THEN 5001
        WHEN 3 THEN 4006
        WHEN 4 THEN 0
        WHEN 5 THEN 4006
        END
    
      IF @SecondaryItemID <> 0 BEGIN
        INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @SecondaryItemID)
        IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
        END
    
        SET @SecondaryCIID = @@IDENTITY
      END
    END
      SET @Custom1ItemID = 
        CASE @Costume
        WHEN 0 THEN 30301
        WHEN 1 THEN 30301
        WHEN 2 THEN 30401
        WHEN 3 THEN 30401
        WHEN 4 THEN 30401
        WHEN 5 THEN 30101
        END
    
      /* Custom1 */
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @Custom1ItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @Custom1CIID = @@IDENTITY
    
      /* Custom2 */
    IF @Costume = 4 OR @Costume = 5
    BEGIN
      SET @Custom2ItemID =
        CASE @Costume
        WHEN 0 THEN 0
        WHEN 1 THEN 0
        WHEN 2 THEN 0
        WHEN 3 THEN 0
        WHEN 4 THEN 30001
        WHEN 5 THEN 30001
        END
    
      IF @Custom2ItemID <> 0
      BEGIN
        INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @Custom2ItemID)
        IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
        END
    
        SET @Custom2CIID = @@IDENTITY
      END
    END
    
    
    IF @Sex = 0		/* ??? ?? */
    BEGIN
    
      /* Chest */
      SET @ChestItemID =
        CASE @Costume
        WHEN 0 THEN 21001
        WHEN 1 THEN 21001
        WHEN 2 THEN 21001
        WHEN 3 THEN 21001
        WHEN 4 THEN 21001
        WHEN 5 THEN 21001
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @ChestItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @ChestCIID = @@IDENTITY
    
      /* Legs */
      SET @LegsItemID =
        CASE @Costume
        WHEN 0 THEN 23001
        WHEN 1 THEN 23001
        WHEN 2 THEN 23001
        WHEN 3 THEN 23001
        WHEN 4 THEN 23001
        WHEN 5 THEN 23001
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @LegsItemID)
      IF 0 <> @@ERROR BEGIN 
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @LegsCIID = @@IDENTITY
    
    END
    ELSE
    BEGIN			/* ??? ?? */
    
      /* Chest */
      SET @ChestItemID =
        CASE @Costume
        WHEN 0 THEN 21501
        WHEN 1 THEN 21501
        WHEN 2 THEN 21501
        WHEN 3 THEN 21501
        WHEN 4 THEN 21501
        WHEN 5 THEN 21501
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @ChestItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      SET @ChestCIID = @@IDENTITY
    
      /* Legs */
      SET @LegsItemID =
        CASE @Costume
        WHEN 0 THEN 23501
        WHEN 1 THEN 23501
        WHEN 2 THEN 23501
        WHEN 3 THEN 23501
        WHEN 4 THEN 23501
        WHEN 5 THEN 23501
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @LegsItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      SET @LegsCIID = @@IDENTITY
    
    END  
    
    UPDATE Character
    SET chest_slot = @ChestCIID, legs_slot = @LegsCIID, melee_slot = @MeleeCIID,
        primary_slot = @PrimaryCIID, secondary_slot = @SecondaryCIID, custom1_slot = @Custom1CIID,
        custom2_slot = @Custom2CIID, head_slot = @HeadCIID,
        chest_itemid = @ChestItemID, legs_itemid = @LegsItemID, melee_itemid = @MeleeItemID,
        primary_itemid = @PrimaryItemID, secondary_itemid = @SecondaryItemID, custom1_itemid = @Custom1ItemID,
        custom2_itemid = @Custom2ItemID, head_itemid = @HeadItemID
    WHERE CID=@CharIdent
    IF 0 = @@ROWCOUNT BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
    END
    COMMIT TRAN
    Code:
    <STR id="UI_CC_LIST_04_01">Starter Hat 1</STR>
    <STR id="UI_CC_LIST_04_02">Starter Hat 1</STR>
    <STR id="UI_CC_LIST_04_03">Starter Hat 2</STR>
    <STR id="UI_CC_LIST_04_04">Starter Hat 3</STR>
    <STR id="UI_CC_LIST_04_05">Starter Hat 4</STR>
    <STR id="UI_CC_LIST_04_06">Starter Hat 5</STR>
    ^^^ not sure how to make that a box when you're creating a character im pretty sure its in the default.mrs and in one of the .xml's and i can just add those under the head box

    Code:
    	<!-- Starter Set -->
    			<ITEM id="700500" name="Starter Hat" mesh_name="eq_head_travia_suit" totalpoint="0" 
    	  type="equip" res_level="0" res_sex="f" weight="5" hp="6" ap="8" iscashitem="false" slot="Head" 
    	  bt_price="0" maxwt="0" sf="0" fr="0" cr="0" pr="0" lr="0" color="#FFFFFFFF" desc="Only to keep for 7 days!" rent_period="7" />
    		
    </XML>
    SO far:
    Spoiler:



    Working on getting the button to work... not really sure how, working on getting the hat to stay on automatically so when you first get on its not in your inventory its on the head

    http://tinypic.com/player.php?v=u4fpy&s=6
    Last edited by daniel131605; 08-05-12 at 01:57 AM.


  2. #2
    Valued Member SandOfTime is offline
    MemberRank
    Mar 2011 Join Date
    112Posts

    Re: Adding a new body option when creating a char,

    Maybe the ID > 500000, Try change iditem to < 500000

  3. #3
    num num num <3 rootbeer daniel131605 is offline
    MemberRank
    Jul 2008 Join Date
    New YorkLocation
    573Posts

    Re: Adding a new body option when creating a char,

    Quote Originally Posted by SandOfTime View Post
    Maybe the ID > 500000, Try change iditem to < 500000
    i changed the id to be less that 500,000 but all it did was make it a normal item, so what i need to do is figure out how to make it expire in 7 days which i can't get, i used one of the items already made iron crow shotgun limited (7 days) and put it as a starting weapons and it didn't work i got some error and it wouldnt create the person any idea?

  4. #4
    Valued Member SandOfTime is offline
    MemberRank
    Mar 2011 Join Date
    112Posts

    Re: Adding a new body option when creating a char,

    sorry my english very bad :)
    you can try it:
    change
    INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @HeadItemID)
    to
    INSERT INTO CharacterItem (CID, ItemID,RentHourPeriod) Values (@CharIdent, @HeadItemID,168)
    p/s: 168 is hour :)

  5. #5
    num num num <3 rootbeer daniel131605 is offline
    MemberRank
    Jul 2008 Join Date
    New YorkLocation
    573Posts

    Re: Adding a new body option when creating a char,

    Code:
    USE [BlackGunzDB]
    GO
    /****** Object:  StoredProcedure [dbo].[spInsertChar]    Script Date: 05/05/2012 13:02:16 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    /* ??? ?? */
    ALTER PROC [dbo].[spInsertChar]
    	@AID		int,
    	@CharNum	smallint,
    	@Name		varchar(24),
    	@Sex		tinyint,
    	@Hair		int,  
    	@Face		int,
    	@Costume	int
    AS
    SET NOCOUNT ON
    BEGIN TRAN
    IF EXISTS (SELECT CID FROM Character where (AID=@AID AND CharNum=@CharNum) OR (Name=@Name))
    BEGIN	
    	ROLLBACK TRAN
    	return(-1)
    END
    
    DECLARE @CharIdent 	int
    DECLARE @ChestCIID	int
    DECLARE @LegsCIID	int
    DECLARE @MeleeCIID	int
    DECLARE @PrimaryCIID	int
    DECLARE @SecondaryCIID  int
    DECLARE @Custom1CIID	int
    DECLARE @Custom2CIID	int
    DECLARE @HeadCIID	int
    
    DECLARE @ChestItemID	int
    DECLARE @LegsItemID	int
    DECLARE @MeleeItemID	int
    DECLARE @PrimaryItemID	int
    DECLARE @SecondaryItemID  int
    DECLARE @Custom1ItemID	int
    DECLARE @Custom2ItemID	int
    DECLARE @HeadItemID	int
    
    SET @SecondaryCIID = NULL
    SET @SecondaryItemID = NULL
    
    SET @Custom1CIID = NULL
    SET @Custom1ItemID = NULL
    
    SET @Custom2CIID = NULL
    SET @Custom2ItemID = NULL
    
    INSERT INTO Character (AID, Name, CharNum, Level, Sex, Hair, Face, XP, BP, FR, CR, ER, WR, 
             		           GameCount, KillCount, DeathCount, RegDate, PlayTime, DeleteFlag)
    Values (@AID, @Name, @CharNum, 1, @Sex, @Hair, @Face, 0, 0, 0, 0, 0, 0, 0, 0, 0, GETDATE(), 0, 0)
    IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
    END
    
    
    SET @CharIdent = @@IDENTITY
    
      /* Melee */
      SET @MeleeItemID = 
        CASE @Costume
        WHEN 0 THEN 1
        WHEN 1 THEN 2
        WHEN 2 THEN 1
        WHEN 3 THEN 2
        WHEN 4 THEN 2
        WHEN 5 THEN 1
        END
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @MeleeItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @MeleeCIID = @@IDENTITY
    
      /* Primary */
      SET @PrimaryItemID = 
        CASE @Costume
        WHEN 0 THEN 5001
        WHEN 1 THEN 5002
        WHEN 2 THEN 4005
        WHEN 3 THEN 4001
        WHEN 4 THEN 4002
        WHEN 5 THEN 4006
        END
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @PrimaryItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @PrimaryCIID = @@IDENTITY
    
      /* Secondary */
    IF @Costume = 0 OR @Costume = 2 BEGIN
      SET @SecondaryItemID =
        CASE @Costume
        WHEN 0 THEN 4001
        WHEN 1 THEN 0
        WHEN 2 THEN 5001
        WHEN 3 THEN 4006
        WHEN 4 THEN 0
        WHEN 5 THEN 4006
        END
    
      IF @SecondaryItemID <> 0 BEGIN
        INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @SecondaryItemID)
        IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
        END
    
        SET @SecondaryCIID = @@IDENTITY
      END
    END
      SET @Custom1ItemID = 
        CASE @Costume
        WHEN 0 THEN 30301
        WHEN 1 THEN 30301
        WHEN 2 THEN 30401
        WHEN 3 THEN 30401
        WHEN 4 THEN 30401
        WHEN 5 THEN 30101
        END
    
      /* Custom1 */
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @Custom1ItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @Custom1CIID = @@IDENTITY
    
      /* Custom2 */
    IF @Costume = 4 OR @Costume = 5
    BEGIN
      SET @Custom2ItemID =
        CASE @Costume
        WHEN 0 THEN 0
        WHEN 1 THEN 0
        WHEN 2 THEN 0
        WHEN 3 THEN 0
        WHEN 4 THEN 30001
        WHEN 5 THEN 30001
        END
    
      IF @Custom2ItemID <> 0
      BEGIN
        INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @Custom2ItemID)
        IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
        END
    
        SET @Custom2CIID = @@IDENTITY
      END
    END
    
    
    IF @Sex = 0		/* ??? ?? */
    BEGIN
    
      /* Chest */
      SET @ChestItemID =
        CASE @Costume
        WHEN 0 THEN 21001
        WHEN 1 THEN 21001
        WHEN 2 THEN 21001
        WHEN 3 THEN 21001
        WHEN 4 THEN 21001
        WHEN 5 THEN 21001
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @ChestItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @ChestCIID = @@IDENTITY
    
      /* Legs */
      SET @LegsItemID =
        CASE @Costume
        WHEN 0 THEN 23001
        WHEN 1 THEN 23001
        WHEN 2 THEN 23001
        WHEN 3 THEN 23001
        WHEN 4 THEN 23001
        WHEN 5 THEN 23001
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @LegsItemID)
      IF 0 <> @@ERROR BEGIN 
    	ROLLBACK TRAN
    	RETURN (-1)
      END
    
      SET @LegsCIID = @@IDENTITY
      
      /* Head */
      SET @HeadItemID =
        CASE @Costume
        WHEN 0 THEN 76
        WHEN 1 THEN 76
        WHEN 2 THEN 76
        WHEN 3 THEN 76
        WHEN 4 THEN 76
        WHEN 5 THEN 76
        END
    
      INSERT INTO CharacterItem (CID, ItemID, RentHourPeriod, Cnt, RentDate) Values (@CharIdent, @HeadItemID, 168, 1, GETDATE())
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      
      SET @HeadCIID = @@IDENTITY
    END
    ELSE
    BEGIN			/* ??? ?? */
    
      /* Chest */
      SET @ChestItemID =
        CASE @Costume
        WHEN 0 THEN 21501
        WHEN 1 THEN 21501
        WHEN 2 THEN 21501
        WHEN 3 THEN 21501
        WHEN 4 THEN 21501
        WHEN 5 THEN 21501
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @ChestItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      SET @ChestCIID = @@IDENTITY
    
      /* Legs */
      SET @LegsItemID =
        CASE @Costume
        WHEN 0 THEN 23501
        WHEN 1 THEN 23501
        WHEN 2 THEN 23501
        WHEN 3 THEN 23501
        WHEN 4 THEN 23501
        WHEN 5 THEN 23501
        END
    
    
      INSERT INTO CharacterItem (CID, ItemID) Values (@CharIdent, @LegsItemID)
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      SET @LegsCIID = @@IDENTITY
      
        /* Head */
      SET @HeadItemID =
        CASE @Costume
        WHEN 0 THEN 75
        WHEN 1 THEN 75
        WHEN 2 THEN 75
        WHEN 3 THEN 75
        WHEN 4 THEN 75
        WHEN 5 THEN 75
        END
    
      INSERT INTO CharacterItem (CID, ItemID, RentHourPeriod, Cnt, RentDate) Values (@CharIdent, @HeadItemID, 168, 1, GETDATE())
      IF 0 <> @@ERROR BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
      END
      
      SET @HeadCIID = @@IDENTITY
    
    END  
    
    UPDATE Character
    SET chest_slot = @ChestCIID, legs_slot = @LegsCIID, melee_slot = @MeleeCIID,
        primary_slot = @PrimaryCIID, secondary_slot = @SecondaryCIID, custom1_slot = @Custom1CIID,
        custom2_slot = @Custom2CIID, head_slot = @HeadCIID,
        chest_itemid = @ChestItemID, legs_itemid = @LegsItemID, melee_itemid = @MeleeItemID,
        primary_itemid = @PrimaryItemID, secondary_itemid = @SecondaryItemID, custom1_itemid = @Custom1ItemID,
        custom2_itemid = @Custom2ItemID, head_itemid = @HeadItemID
    WHERE CID=@CharIdent
    IF 0 = @@ROWCOUNT BEGIN
    	ROLLBACK TRAN
    	RETURN (-1)
    END
    COMMIT TRAN

    woooohhooo i got it to work :D now all i need to do is make it so when you change the button it changes the hat
    Updated it so both male and females work*
    Last edited by daniel131605; 10-05-12 at 03:33 AM.



Advertisement