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!

[Guide] Set Starting Default Level (SQL Trigger)

Status
Not open for further replies.
Initiate Mage
Joined
Mar 1, 2006
Messages
6
Reaction score
0
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...
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:
Initiate Mage
Joined
Mar 1, 2006
Messages
6
Reaction score
0
livewirecebu said:
can I use this trigger on my MSSQL 2000?

Yeah...

The steps are almost the same...

Just copy and paste the code... no edit necessary...

PS: Did you know that MUServer uses SQL triggers in the database as well...
Try to check the SQL Trigger for Character table.... (using 1.02 MX version).
And MU Database still uses SQL Server 2000 only.
 
Experienced Elementalist
Joined
Mar 25, 2006
Messages
218
Reaction score
19
Can u teach me how to set all the stats point by default example like all stats starts 5000. TQ.
 
Initiate Mage
Joined
Mar 1, 2006
Messages
6
Reaction score
0
austhistikated said:
Hey I already made it...
But the skill points are set to 0 and stat points are set to 3...
How to set the stat points to 300 and the skill points to 100??

That's very simple, all you need to do is play around with the SQL trigger...

Modify your SQL Trigger to look like this...

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 and Adds 300 Stat Points and 100 Skill points... This trigger will modify the exsiting NewChar_Level trigger.
-- =============================================
ALTER TRIGGER [dbo].[NewChar_Level] ON [dbo].[ChaInfo]
after update
as
BEGIN

Update [ChaInfo] set [ChaInfo].ChaLevel=100, [ChaInfo].ChaStRemain = 300, [ChaInfo].ChaSkillPoint = 100
From Inserted
Where Inserted.ChaLevel = 1 and [ChaInfo].ChaName=inserted.ChaName
and [ChaInfo].UserNum =inserted.UserNum

END

As I noted above, you just need to identify the correct field that you need to update and just add that field in the SQL Trigger... Be Creative....
 
Last edited:
Joined
Dec 21, 2005
Messages
833
Reaction score
20
Yah...
Lol thanks...
I already played with it...
But it's a bit different from you...
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

Update [ChaInfo] set [ChaInfo].ChaStRemain = 300
From Inserted
Where Inserted.ChaStRemain = 3 and [ChaInfo].ChaName=inserted.ChaName
and [ChaInfo].UserNum =inserted.UserNum

Update [ChaInfo] set [ChaInfo].ChaSkillPoint = 100
From Inserted
Where Inserted.ChaSkillPoint = 0 and [ChaInfo].ChaName=inserted.ChaName
and [ChaInfo].UserNum =inserted.UserNum

END
 
Joined
Jun 4, 2006
Messages
5
Reaction score
0
i get this error when i execute the query

Msg 8197, Level 16, State 4, Procedure NewChar_Level, Line 7
Object 'dbo.ChaInfo' does not exist or is invalid for this operation.
:wiggle:
 
Initiate Mage
Joined
Mar 1, 2006
Messages
6
Reaction score
0
shakarl14 said:
i get this error when i execute the query

Msg 8197, Level 16, State 4, Procedure NewChar_Level, Line 7
Object 'dbo.ChaInfo' does not exist or is invalid for this operation.
:wiggle:

That is because you did not select RANGAME1 database before you executed the SQL Statement...

The database you're using must still be "master" database... Change it to RANGAME1.
 
Initiate Mage
Joined
Mar 1, 2006
Messages
6
Reaction score
0
shakarl14 said:
hi james is that the one in the settings of obdc

nope... you'll be able to change the database inside SQL Server Management Studio. Try to follow the steps CAREFULLY...
 
Initiate Mage
Joined
Mar 1, 2006
Messages
6
Reaction score
0
shakarl14 said:
here is the pic

That's because you already Executed the SQL Statement before so it has already created an SQL Trigger named NewChar_Level.

Executing the SQL Statement twice will produce an error since the trigger you want to create already exists.

Try to remove the trigger first then you can re-execute the SQL Statement...

or instead of using "Create Trigger" try to change it to "ALTER TRIGGER"

Good luck
 
Initiate Mage
Joined
Oct 19, 2005
Messages
15
Reaction score
0
can u make me an sql trigger that puts an item on a lvl 1 character?
ex.
i want to put resu training rosary when a character is lvl 1

thx
 
Initiate Mage
Joined
Jun 17, 2006
Messages
18
Reaction score
0
austhistikated said:
Yah...
Lol thanks...
I already played with it...
But it's a bit different from you...

don't work because when some one use skill to 0 DB will update auto to 100
 
Initiate Mage
Joined
Oct 4, 2005
Messages
2
Reaction score
0
what if i want to change back to normal after i done it?
and where can i find the file if i want to edit it again?

and one more question. everytime i try to expand my RanGame1's database it pops up this

Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects .
 
Initiate Mage
Joined
Jun 17, 2006
Messages
18
Reaction score
0
4619286 said:
what if i want to change back to normal after i done it?
.

Delete Trigger named NewChar_Level to change back to normal
 
Status
Not open for further replies.
Back
Top