Register for your free account! | Forgot your password?

You last visited: Today at 00:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Momboxes

Discussion on Momboxes within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
Momboxes

as the br's in real co call them

lmao
so how do i make moonboxes give out items when you right click them?

LOTF
Arcotemple:) is offline  
Old 07/05/2009, 00:52   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by Arcotemple:) View Post
as the br's in real co call them

lmao
so how do i make moonboxes give out items when you right click them?
I assume this is coemu2

Under handlers>UseItem set up a case for it. The easiest way would be to add in a databse (yah so it's not "easy", but it saves hard coding all the possible rewards given by the moon box!)


Something along the lines of ummm

case MoonboxIdHere://MoonBox, NOT A COPY PASTE LOL. Would need a database set up

Code:
                    {
                        Struct.MbPrizes MbList = new Struct.MbPrizes();
                        int MbPrizeNumber = Nano.MbPrize.Count;
                        int P = Nano.Rand.Next(1, MbPrizeNumber);
                        if (Nano.MbPrizeNumber.TryGetValue(P, out RPoint))
                        {
                            GiveItem(RPoint.Itemcode, RPoint.Item+, RPoint.ItemSockets, 0, CSocket);///ANYTHING ELSE YOU HAVE LOADING FORM THE DATABASE!! Would basically be everything you would normally use to award an item except this type of script will roll a number between 1 and how many "prizes" you have in your database. It will select that number and then using the give item code do the RPoint.blablabla you can load the other specifics from the database (corresponding to that prize number)
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You have received an item from opening the moon box, how exciting!", Struct.ChatType.Top));
                        }
                        break;
                    }
Again, this code WILL NOT work, you would first have to setup a database for it, add a function to load the database into the server (under database.cs, look at lottery script for an example) and a few other things added to source.

This sytem WILL work though, I have something nearly identical working on my server to setup random scroll points (loads database of scroll points and randomly sends you to one of them whenever you use a random scroll)
pro4never is offline  
Old 07/05/2009, 01:00   #3
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
Quote:
Originally Posted by pro4never View Post
I assume this is coemu2

Under handlers>UseItem set up a case for it. The easiest way would be to add in a databse (yah so it's not "easy", but it saves hard coding all the possible rewards given by the moon box!)


Something along the lines of ummm

case MoonboxIdHere://MoonBox, NOT A COPY PASTE LOL. Would need a database set up

Code:
                    {
                        Struct.MbPrizes MbList = new Struct.MbPrizes();
                        int MbPrizeNumber = Nano.MbPrize.Count;
                        int P = Nano.Rand.Next(1, MbPrizeNumber);
                        if (Nano.MbPrizeNumber.TryGetValue(P, out RPoint))
                        {
                            GiveItem(RPoint.Itemcode, RPoint.Item+, RPoint.ItemSockets, 0, CSocket);///ANYTHING ELSE YOU HAVE LOADING FORM THE DATABASE!! Would basically be everything you would normally use to award an item except this type of script will roll a number between 1 and how many "prizes" you have in your database. It will select that number and then using the give item code do the RPoint.blablabla you can load the other specifics from the database (corresponding to that prize number)
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You have received an item from opening the moon box, how exciting!", Struct.ChatType.Top));
                        }
                        break;
                    }
Again, this code WILL NOT work, you would first have to setup a database for it, add a function to load the database into the server (under database.cs, look at lottery script for an example) and a few other things added to source.

This sytem WILL work though, I have something nearly identical working on my server to setup random scroll points (loads database of scroll points and randomly sends you to one of them whenever you use a random scroll)
lol sorry its lotf
Arcotemple:) is offline  
Old 07/05/2009, 02:17   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by Arcotemple:) View Post
lol sorry its lotf
The codes are very similar between them, I'm sure you could still use that example to guide you in the right direction.

Basically, add a function to load the database, then add a function to roll a number and pull the stuff out of the database and reward it.

You could also add chances or all sorts of other variables with that system and once the original code was implimented into the source you would not need to even restart the server to update the prizes/chances. Simply update the database and use a /reload command ingame.

Again, it would require a bit of work but it's still probably the best way to implement such a system.

Best of luck. PS: Lotf is a waste of time lol. Sure it's "easy" to do cause there are so many codes out there but in the end the source still sucks.
pro4never is offline  
Old 07/05/2009, 02:33   #5
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
hmm or maybe i could make moonboxes like the rarest thing in my server
like you right click and get 100k cps

would it work like this?
Quote:
else if (ItemParts[0] == "MOONBOXID")
{
CPs += 100000;
MyClient.SendPacket(General.MyPackets.Vital(UID, 30, CPs));
RemoveItem(ItemUID);
}
Arcotemple:) is offline  
Old 07/05/2009, 02:45   #6
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by Arcotemple:) View Post
hmm or maybe i could make moonboxes like the rarest thing in my server
like you right click and get 100k cps

would it work like this?
I don't know scripting in lotf but if you just want it to give a specific thing, or even a random pre-specified thing (you could have it chance based, or a small list of prizes) that's EASY to do. I was thinking you wanted a long list of prizes all with varying chances.

Like on real co or qo or something where you can get mets/uni/elite/super/sockets/exp pots etcetcetc

Again I'm using coemu so scripting will be different but here is what I would do, something like


here is a script I use for my hero cards (qp item)
Code:
case 722839://HeroCard (AP)
                    {
                        RandomCP = Nano.Rand.Next(1, 10);
                        CPs(+RandomCP, CSocket);
                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You recieved " + RandomCP + " CPs from the HeroCard!!.", Struct.ChatType.Top));
                        break;

                    }
Modified for moon boxes/some chances

Code:
case 722839://Change item id to moon box id
                    {
                        MoonBoxRandom = Nano.Rand.Next(1, 101);
if MoonBoxRandom == 100
                        CPs(+10000, CSocket);
                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Wow! You received 10000 CPs from the MoonBox. Aren't you lucky!.", Struct.ChatType.Top));
else
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Awwww,you opened the moonbox but didn't find anything", Struct.ChatType.Top));

                        break;

                    }
Codes/values could be easily edited, remember you could also add more if's, so like add in a if MoonBoxRandom == 99, 98, 97 etc for different rewards. Or add in another random and make it give you the random amount of cp's instead of a predefined 10,000


Should be an easy script to convert to loft, just replace the chat structure, item id and how the random works (fairly sure lotf invokes random number differently, should be similar though)

Good luck
pro4never is offline  
Thanks
1 User
Old 07/05/2009, 03:17   #7
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
Here you go my friend gave me it.

Add
Code:
public int MoonBoxRandom = 0;
in character.cs definitions

Code:
// Created by Fail
            else if (ItemParts[0] == "MoonBoxID" || ItemParts[0] == "MoonBoxID") // 721020 - 721065 , 721080 - 721090
            {

                MoonBoxRandom = General.Rand.Next(1, 100); // Finds Random #s
                if (MoonBoxRandom >= 1 && MoonBoxRandom <= 25) // 25% Win Chance
                {
                    CPs += 1000;
                    MyClient.SendPacket(General.MyPackets.Vital((long)UID, 30, CPs));
                    MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "You opened a MoonBox and got 1000 silvers!", 2005));
                    RemoveItem(UID);
                }
                else
                {
                    MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "You weren't so lucky this time, Sorry!", 2005));
                    RemoveItem(UID);
                }

            }
I gave you also a range of MoonBoxIDs they are all of them, You just have to add them, I gave you an example how to add them in the code.

Press thanks if this helped
PeTe Ninja is offline  
Old 07/05/2009, 03:25   #8
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
yo pete thanks but why arent you ever on msn
lol
Arcotemple:) is offline  
Old 07/05/2009, 03:26   #9
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
i choose not to anymore, if you need my help just ask my friend you have his msn.
PeTe Ninja is offline  
Old 07/05/2009, 03:28   #10
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
Quote:
Originally Posted by PeTe Ninja View Post
i choose not to anymore, if you need my help just ask my friend you have his msn.
fail?
Arcotemple:) is offline  
Old 07/05/2009, 03:29   #11
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
yes fail
PeTe Ninja is offline  
Old 07/05/2009, 03:55   #12
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by PeTe Ninja View Post
Here you go my friend gave me it.

Add
Code:
public int MoonBoxRandom = 0;
in character.cs definitions

Code:
// Created by Fail
            else if (ItemParts[0] == "MoonBoxID" || ItemParts[0] == "MoonBoxID") // 721020 - 721065 , 721080 - 721090
            {

                MoonBoxRandom = General.Rand.Next(1, 100); // Finds Random #s
                if (MoonBoxRandom >= 1 && MoonBoxRandom <= 25) // 25% Win Chance
                {
                    CPs += 1000;
                    MyClient.SendPacket(General.MyPackets.Vital((long)UID, 30, CPs));
                    MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "You opened a MoonBox and got 1000 silvers!", 2005));
                    RemoveItem(UID);
                }
                else
                {
                    MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "You weren't so lucky this time, Sorry!", 2005));
                    RemoveItem(UID);
                }

            }
I gave you also a range of MoonBoxIDs they are all of them, You just have to add them, I gave you an example how to add them in the code.

Press thanks if this helped
Damn you and your Lotf farmiliarity!


I am really considering dling it to get some idea of how to add some new features to coemu... but I just shun the idea... I know I'll get in and be like "LOLOLOL SCRIPTING EASY I BE PRO!" and give up on my coemu server... But working on it has been good for me.. I'm actually starting to understand coding instead of just being a copy/paste whore :P

Then again I think I spent about ummm 40-50 hours in 3 days working on scripting my server last week... so something is BOUND to sink in. Seriously... I have no idea how I managed to pay attention that long, the one day I was scripting for 16 hrs straight... then did 12+ hours the next day almost as soon as I woke up

Sooooo not doing that again lol
pro4never is offline  
Old 07/05/2009, 05:14   #13
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
lol i can do ok in all sources. just need to know C# and u can too!!! ( thats not to you directly thats to all )
PeTe Ninja is offline  
Reply




All times are GMT +1. The time now is 00:05.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.