Auto Join Guild

04/10/2019 03:14 [GameAdvisor]Finn#1
Hi epvp. i think auto join guild when character is new create is possible but anyone know what query of that?
Ex. i create guild for UoF and AoL
then new character auto join guild base on his Faction..
if someone know this query im glad :)

Thanks in advance :)
04/10/2019 16:21 oldjayy#2
Assuming there will be only one guild per faction following could do the job.
You will need to add it to your usp_Create_Char_R stored procedure.

Quote:
DECLARE @GuildID INT
DECLARE @faction tinyint
SET @faction = (SELECT Country FROM UserMaxGrow WHERE UserUID = @UserUID)
SET @GuildID = (SELECT GuildID FROM Guilds WHERE Country = @faction)
INSERT INTO GuildChars(GuildID, CharID, GuildLevel, Del, JoinDate, LeaveDate)
VALUES(@GuildID,@CharID,5,0,getdate(),NULL)
04/10/2019 17:29 [GameAdvisor]Finn#3
Quote:
Originally Posted by oldjayy View Post
Assuming there will be only one guild per faction following could do the job.
You will need to add it to your usp_Create_Char_R stored procedure.
Thank you sir but in my mined is like starter gears
Starting guild I put the guild id on table like when i add starting item on BaseGearDefs.

Ex. I make guild for Dark so all new create dark auto join on dark guild i put and same to Light guild.

Thanks for answer if you know sir :)
04/10/2019 20:36 oldjayy#4
Quote:
USE PS_GameData
CREATE TABLE dbo.StarterGuilds
(
GuildID int,
Faction tinyint
)
Quote:
DECLARE @GuildID INT
DECLARE @faction tinyint
SET @faction = (SELECT Country FROM UserMaxGrow WHERE UserUID = @UserUID)
SET @GuildID = (SELECT GuildID FROM StarterGuilds WHERE Faction = @faction)
INSERT INTO GuildChars(GuildID, CharID, GuildLevel, Del, JoinDate, LeaveDate)
VALUES(@GuildID,@CharID,5,0,getdate(),NULL)
Faction 0 is AoL 1 is UoF
04/10/2019 21:41 [GameAdvisor]Finn#5
Quote:
Originally Posted by oldjayy View Post
Faction 0 is AoL 1 is UoF
Thank you sir.. i see its already insert in guildchars the new character i create.. but the problem is not show the guild on character i create..
04/12/2019 12:58 oldjayy#6
Quote:
DECLARE @GuildID INT
DECLARE @faction tinyint
SET @faction = (SELECT Country FROM UserMaxGrow WHERE UserUID = @UserUID)
SET @GuildID = (SELECT GuildID FROM StarterGuilds WHERE Faction = @faction)

INSERT INTO GuildChars(GuildID, CharID, GuildLevel, JoinDate)
VALUES(@GuildID, @CharID, 5, GETDATE())

UPDATE Guilds SET TotalCount += 1 WHERE GuildID=@GuildID
Make sure the guild exists in dbo.Guilds in a correct way.
04/12/2019 23:14 [GameAdvisor]Finn#7
Quote:
Originally Posted by oldjayy View Post
Make sure the guild exists in dbo.Guilds in a correct way.
yes sir its exists but when i create new character is not show .. then only show if i restart the server!
03/12/2021 07:40 Realp0rta#8
-------------------------------------------------------------------------------------------------------

DECLARE @[Only registered and activated users can see links. Click Here To Register...]D INT
DECLARE @[Only registered and activated users can see links. Click Here To Register...] tinyint
SET @[Only registered and activated users can see links. Click Here To Register...] = (SELECT Country FROM UserMaxGrow WHERE UserUID = @[Only registered and activated users can see links. Click Here To Register...]ID)
SET @[Only registered and activated users can see links. Click Here To Register...]D = (SELECT GuildID FROM StarterGuilds WHERE Faction = @[Only registered and activated users can see links. Click Here To Register...])
SET @[Only registered and activated users can see links. Click Here To Register...]D = (SELECT @[Only registered and activated users can see links. Click Here To Register...] FROM Chars)

INSERT INTO GuildChars(GuildID, CharID, GuildLevel, JoinDate)
VALUES @[Only registered and activated users can see links. Click Here To Register...]D, @[Only registered and activated users can see links. Click Here To Register...], 5, GETDATE())

UPDATE Guilds SET TotalCount += 1 WHERE GuildID @[Only registered and activated users can see links. Click Here To Register...]D
-------------------------------------------------------------------------------------------------------