A LOT of people have been asking how to set the default level of a new character to 100 (or any level). So here is a MORE EFFECTIVE way to do it...
HERE ARE THE STEPS...
1. Open/Login you SQL Server Management Studio
2. Expand the Databases Group
3. Expand the RanGame1 Database
4. Select New Query from the toolbar
5. From the New Query window on the right pane, copy and paste this SQL Trigger Code...
6. Execute the SQL Statement.
7. Verify if the SQL Trigger is created by Expanding dbo.ChaInfo tables, expand triggers. If you don't see NewChar_Level trigger under Triggers group, try refreshing your display.
This SQL Trigger has been tested by me and works 100%....
NOTE:
This should serve as your BASIC Template for SQL Triggering... You can do a lot of things with this... You could set the initial Stats, Stat Points, Money, Character Exp, Character Inventory, Character Skills etc. of a NEWLY CREATED CHARACTER... You would just have to be creative and update the SQL Trigger to suit your needs...
I hope this helps you...
HERE ARE THE STEPS...
1. Open/Login you SQL Server Management Studio
2. Expand the Databases Group
3. Expand the RanGame1 Database
4. Select New Query from the toolbar
5. From the New Query window on the right pane, copy and paste this SQL Trigger Code...
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: James29
-- Create date: 6/15/2006
-- Description: Sets the default level of a NEW CHARACTER
-- =============================================
CREATE TRIGGER [dbo].[NewChar_Level] ON [dbo].[ChaInfo]
after update
as
BEGIN
Update [ChaInfo] set [ChaInfo].ChaLevel=100
From Inserted
Where Inserted.ChaLevel = 1 and [ChaInfo].ChaName=inserted.ChaName
and [ChaInfo].UserNum =inserted.UserNum
END
6. Execute the SQL Statement.
7. Verify if the SQL Trigger is created by Expanding dbo.ChaInfo tables, expand triggers. If you don't see NewChar_Level trigger under Triggers group, try refreshing your display.
This SQL Trigger has been tested by me and works 100%....
NOTE:
This should serve as your BASIC Template for SQL Triggering... You can do a lot of things with this... You could set the initial Stats, Stat Points, Money, Character Exp, Character Inventory, Character Skills etc. of a NEWLY CREATED CHARACTER... You would just have to be creative and update the SQL Trigger to suit your needs...
I hope this helps you...
Last edited: