Altercationz
:)
Hi,
To celebrate my returning back to retros (not something i'm proud of, bored to death lately) but enough of me let's get to the release.
I was on a hotel recently where they had a welcome bot which appears in your first room and greets you.
I loved the idea and the bot can be set to do pretty much anything which is why it's quite unique.
This probably isn't how the developer of the hotel I found it on did it but it does the job that's for sure.
The bot ID is randomly generated everytime a new player creates a room and this is checked by determining the users room count having it be less than 0 will send them the bot to welcome them, the method creates a new thread which holds the timer and kicks the bot out after a minute which is enough time for him to welcome the new player, if you think otherwise it can easily be changed.
This can be placed anywhere, I just threw it in Habbo.cs
Then the following code to be pasted in the create room method in the RoomManager.cs
It's as easy as that, enjoy.
"Giving credit where credit is due is a very rewarding habit to form. Its rewards are inestimable." - Loretta Young
The idea was taken from Hebbo Hotel.
The code above is not efficient enough so use the one below!
In the EnterRoom Method, "CheckFirstRoom" can be replaced with
and you must put
in Habbo.cs
To celebrate my returning back to retros (not something i'm proud of, bored to death lately) but enough of me let's get to the release.
I was on a hotel recently where they had a welcome bot which appears in your first room and greets you.
I loved the idea and the bot can be set to do pretty much anything which is why it's quite unique.
This probably isn't how the developer of the hotel I found it on did it but it does the job that's for sure.
The bot ID is randomly generated everytime a new player creates a room and this is checked by determining the users room count having it be less than 0 will send them the bot to welcome them, the method creates a new thread which holds the timer and kicks the bot out after a minute which is enough time for him to welcome the new player, if you think otherwise it can easily be changed.
This can be placed anywhere, I just threw it in Habbo.cs
Code:
public void CheckFirstRoom(GameClient User)
{
if (User.GetHabbo().UsersRooms.Count > 0)
{
return; // Already has a room.
}
else
{
// Bot Timer.
TimeSpan BotSent = DateTime.Now - BotDeployed;
WelcomeBotDeployed = true;
//Execute.
Room NewRoom;
Bot Noob = null;
int X = 3 - 10;
int Y = 3 - 10;
// Bot Id Randomizer.
Random Random = new Random();
int BotId = Random.Next(1, 9999);
List<RandomSpeech> Speech = new List<RandomSpeech>();
NewRoom = User.GetHabbo().CurrentRoom;
RoomUser Bot = NewRoom.GetRoomUserManager().DeployBot(new RoomBot(BotId, User.GetHabbo().CurrentRoomId, "bartender", "freeroam", "Disguised", "Welcome!", Noob.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref Speech, "", 0, Noob.OwnerId, false, 0, false, 0), null);
Bot.Chat("Welcome to the hotel!", false, 0);
// Have the bot do whatever else you wish here.
new Thread(() => Thread.Sleep(60000));
if (WelcomeBotDeployed)
// Bot has greeted new player, time to greet some more lets get rid of him!
NewRoom.GetRoomUserManager().RemoveBot(Noob.Id, true);
WelcomeBotDeployed = false;
}
}
Code:
Session.GetHabbo().CheckFirstRoom(Session); // Send bot to new room to greet the user.
It's as easy as that, enjoy.
"Giving credit where credit is due is a very rewarding habit to form. Its rewards are inestimable." - Loretta Young
The idea was taken from Hebbo Hotel.
The code above is not efficient enough so use the one below!
Code:
internal void WelcomeBot()
{
if (WelcomeTask != null)
{
WelcomeTask.Dispose();
}
if (WelcomeTimer != null)
{
WelcomeTimer.Dispose();
}
if (this.UsersRooms.Count < 0 && WelcomeBotDeployed)
{
return; // User has created a room already / or had the bot deployed.
}
else
{
WelcomeBotDeployed = true; // set in database forever. bool (0/1)
// Execute.
Room NewRoom = this.CurrentRoom;
Bot Noob = null;
int X = 3 - 10;
int Y = 3 - 10;
// Bot Id Randomizer.
Random Random = new Random();
int BotId = Random.Next(1, 9999);
List<RandomSpeech> Speech = new List<RandomSpeech>();
RoomUser Bot = NewRoom.GetRoomUserManager().DeployBot(new RoomBot(BotId, this.CurrentRoomId, "bartender", "freeroam", "Disguised", "Welcome!", Noob.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref Speech, "", 0, Noob.OwnerId, false, 0, false, 0), null);
Bot.Chat("Welcome to the hotel!", false, 0);
// Have the bot do whatever else here.
WelcomeTimer = new System.Timers.Timer();
WelcomeTimer.AutoReset = false;
WelcomeTimer.Elapsed += WelcomeBot_Elapsed;
WelcomeTimer.Interval = 60000; // time until the bot is kicked.
WelcomeTask = new System.Threading.Tasks.Task(WelcomeTimer.Start);
WelcomeTask.Start();
}
}
Code:
private void WelcomeBot_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (GetClient() == null)
{
WelcomeTask.Dispose();
WelcomeTimer.Dispose();
return;
}
Room Room = this.CurrentRoom;
foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
{
if (User == null || !User.IsBot) // make sure you're removing the bot.
continue;
RoomUser Bot = null;
if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out Bot))
return;
Room.GetRoomUserManager().RemoveBot(Bot.VirtualId, true);
// end the timer and task.
WelcomeTask.Dispose();
WelcomeTimer.Dispose();
}
}
Code:
WelcomeBot();
Code:
public Timer WelcomeTimer;
public Task WelcomeTask;
Last edited: