Create New Character Trigger

Results 1 to 5 of 5
  1. #1
    Proficient Member advenire is offline
    MemberRank
    Jan 2004 Join Date
    Seoul, Korea.Location
    180Posts

    Create New Character Trigger

    It might works for both version. (3.x/4.x) :batman:

    CREATE TRIGGER [Create_Character_Set] ON [dbo].[tblGameID1]
    FOR INSERT
    AS
    BEGIN
    DECLARE @GAMEID CHAR(14)

    declare @Time datetime
    set @Time=cast(convert(varchar, GetDate(), 120) as datetime)

    SELECT @GAMEID= GAMEID FROM INSERTED
    BEGIN
    update tblGameID1 set Permission = '2048' // Permission Set
    update tblGameID1 set Map = '2' // Start Map
    update tblGameID1 set Money = '10000000' // Start Money
    update tblGameID1 set StoryQuestState = '-1' // Quest Crack

    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')
    INSERT INTO tblSpecialItem1 VALUES(6,200,4,1,1,100,100,1,@GAMEID,1,4,@Time,'','','','','')

    END
    END


    It was created by FREEZONE™ - Redmoon Freeserver Develop Team. (http://club.ipop.co.kr/renovatio) - For Korean ONLY!!
    Last edited by advenire; 20-01-06 at 06:43 AM.


  2. #2
    Proficient Member holmancarey is offline
    MemberRank
    Jul 2005 Join Date
    Union, MOLocation
    177Posts
    Sweet, no more constantly giving out commands to new players, lol. Thanks m8

  3. #3
    Proficient Member holmancarey is offline
    MemberRank
    Jul 2005 Join Date
    Union, MOLocation
    177Posts
    Sry for the double post...

    Your trigger works like a champ, all except for one minor issue. When someone creates a new character it changes all of the characters to what's specified in the trigger.

    This should make it to where all it changes are the characters that do not have commands. I just cut all the rest of it out so people aren't making new characters, pulling the stuff they get off of em then deleting and remaking them to get a helacious amount of stuff. I know I would do it, lol.

    Code:
    CREATE TRIGGER [Create_Character_Set] ON [dbo].[tblGameID1] 
    FOR INSERT 
    AS 
    BEGIN 
    DECLARE @GAMEID CHAR(14) 
    
    declare @Time datetime 
    set @Time=cast(convert(varchar, GetDate(), 120) as datetime) 
    
    SELECT @GAMEID= GAMEID FROM INSERTED 
    BEGIN 
    update tblGameID1 set Permission = '2114' where Permission = '0'
    
    END 
    END
    Now all I gotta do is change all my chars and all the GMs back >_<, lol

  4. #4
    Member Nickyy is offline
    MemberRank
    Jan 2005 Join Date
    62Posts
    Um you arn't seriously going to use that trigger are you?? Both are quite wrong.

    I believe what your looking for is this:

    CREATE TRIGGER [Create_Character_Set] ON [dbo].[tblGameID1]
    FOR INSERT
    AS
    BEGIN

    UPDATE tblGameID1 SET Permission = 2114
    WHERE gameid = (SELECT gameid FROM inserted)

    END

    or if you wish to add the other values for a 3.8 server ( advenire's won't work on a 4.4 for quest, its different)

    CREATE TRIGGER [Create_Character_Set] ON [dbo].[tblGameID1]
    FOR INSERT
    AS
    BEGIN

    UPDATE tblGameID1 SET Permission = 2114, Money = 10000000, Map = 2, StoryQuestState = -1
    WHERE gameid = (SELECT gameid FROM inserted)

    END
    Last edited by Nickyy; 18-02-06 at 11:28 PM.

  5. #5
    Proficient Member holmancarey is offline
    MemberRank
    Jul 2005 Join Date
    Union, MOLocation
    177Posts
    Your right, that is much morte logical. Just goes to show I have a lot more to learn before I master SQL. The way i figured how to do it worked but the way you mention is the first way I tried to figure out. Thanks for lettin me know how to do it right man. It's kind of funny because I tried to get it to do that at first but I was tryin to enter in at the end of the permission set if '%' instead of the WHERE GameID = (SELECT gameid from Inserted). I didn't know you dould do that. I will definatelty remember for future refernce. Although mine did work in a round about way, lol

    Thanks Nickyy



Advertisement