Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 02:49

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

Advertisement



[Mini-Release] HeroCards w/ random reward

Discussion on [Mini-Release] HeroCards w/ random reward within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
[Mini-Release] HeroCards w/ random reward

Ok so not a huge release but I figured I'd give people an example of how to do some nice "random" cp rewards (or any rewards tbh) from item use.

*NOTE* For the record, this is for CoEmu2.0.nano, obvious from the scripting but just figured I'd make sure nubs knew.


Under Use item put this anywhere in the case section. Simply look for case numbers, paste this one line above one of them so you aren't cutting into any other script. Again you should know this from adding/modifying ANYTHING in there, but if this is your first script. That's how you do it.


Code:
case 722839://HeroCard (AP)//this is simply which item is being used, herocard item id is 722839 but you can change it to any item you want
                    {
                        int AwardCPN = 1;
///simply had to declare it first, 1 is not used
                        RandomCP = Nano.Rand.Next(1, 101);
///rolls number 1-100 (for some reason it never rolls top number so I'm using 1-101, I assume that's normal I dunno I'm new to programing lol)
                        if (RandomCP <= 100)
//saying if it rolls less than 100 (top number)
                        {
                            AwardCPN = Nano.Rand.Next(1, 11);//rolls 1-10
                            CPs(+AwardCPN, CSocket);
//awards the number rolled
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You received  " + AwardCPN + " CPs from the HeroCard!!.", Struct.ChatType.Top));
//spits out how much you received in the top left corner of the screen
                        }
                        if (RandomCP == 100)
///if 100 is rolled originally, top number in this case but you could add other if statements for if it rolls lets say 99, 98 etc
                        {
                            CPs(+500, CSocket);
///awards 500 cp, can be changed easy
                            ConquerPacket.ToServer(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", "CONGRATULATIONS! " + CSocket.Client.Name + " Is so lucky to win 500 CP from opening a HeroCard!!", Struct.ChatType.NewBroadcast), 0);
//sends out a server broadcast saying who won the cp, note you have to have broadcast working on your server for this section to work but broadcast fix is already on forum and is easy as hell

                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Woa!! Something random happened: You won 500 CPs from the HeroCard! You are just so lucky!.", Struct.ChatType.Top));
//again, top left corner states how much you won

                        }
                        break;

                    }

So I went a little comment crazy there describing what everything does for noobs but you can always remove those if you don't need them.

Feel free to use/modify the script as you see fit. You can change it to any item you want, you can change what is given, the rewards, anything in there.

The script itself is fairly basic but I feel that noobs especially should take a look at it. The principles behind it are/can be used for countless applications.
pro4never is offline  
Thanks
8 Users
Old 07/06/2009, 14:29   #2
 
elite*gold: 20
Join Date: Jul 2007
Posts: 613
Received Thanks: 486
thnx but notice that if ur random returns with 100 this will be awarded twice so u should remove the = from ur first if " if (RandomCP <= 100) " to be " if (RandomCP < 100) " or add an else word be4 ur second if to be licke this " else if (RandomCP == 100) " thanks again
samehvan is offline  
Old 07/06/2009, 15:55   #3
 
elite*gold: 0
Join Date: May 2008
Posts: 103
Received Thanks: 3
i have this error Error 1 The name 'RandomCP' does not exist in the current context
m7med is offline  
Old 07/06/2009, 16:09   #4
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
i think peopel whoa re releaseing item info like this should release all at once or none at all
PeTe Ninja is offline  
Old 07/06/2009, 20:49   #5
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by samehvan View Post
thnx but notice that if ur random returns with 100 this will be awarded twice so u should remove the = from ur first if " if (RandomCP <= 100) " to be " if (RandomCP < 100) " or add an else word be4 ur second if to be licke this " else if (RandomCP == 100) " thanks again
Ooops I thought I had fixed that, I posted an older version of it I guess :P

Simpy remove the = in the first part and it will work as you said


Quote:
Originally Posted by m7med View Post
i have this error Error 1 The name 'RandomCP' does not exist in the current context
Code:
public static int RandomCP;
Not that hard to define something rofl

Quote:
Originally Posted by PeTe Ninja View Post
i think peopel whoa re releaseing item info like this should release all at once or none at all
it is complete, all you had to do was say public stat int RandomCP;

You have to define it just like any other code.
pro4never is offline  
Thanks
1 User
Old 07/07/2009, 08:38   #6
 
sawickas's Avatar
 
elite*gold: 0
Join Date: Sep 2008
Posts: 617
Received Thanks: 38
For coemu or lotf?
sawickas is offline  
Old 07/07/2009, 09:16   #7
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 99
That's very helpful for people that are learning like me. Thanks =)
Jay1029 is offline  
Old 07/07/2009, 15:59   #8
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by sawickas View Post
For coemu or lotf?
Please look at the code and you will see it is for coemu.

The scripting looks completely different between them and is easily distinguished.
pro4never is offline  
Old 07/07/2009, 17:11   #9
 
n0mansland's Avatar
 
elite*gold: 0
Join Date: Aug 2008
Posts: 780
Received Thanks: 255
Quote:
*NOTE* For the record, this is for CoEmu2.0.nano, obvious from the scripting but just figured I'd make sure nubs knew.
or he could atleast read the whole post before asking what's it for x.x... unless you just added that but I don't see "last edited"

anyway cool release good job
n0mansland is offline  
Old 07/07/2009, 20:57   #10
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by n0mansland View Post
or he could atleast read the whole post before asking what's it for x.x... unless you just added that but I don't see "last edited"

anyway cool release good job
ooh I forgot I had put that there but now that you mention it I did post it there to avoid stupid comments like his.


Also fyi, I bought domain/hosting for my server lastnight, everything will be switched over to it as soon as I transfer over my databases and **** ^^

I have 1 year of hosting pre-payed so the site will be up 24/7 for the next year at least unless I shut it down, will be forwarding current site to that one for people who are too stupid to read that it's updated.

YAY PROGRESS ^^
pro4never is offline  
Old 07/08/2009, 02:27   #11
 
n0mansland's Avatar
 
elite*gold: 0
Join Date: Aug 2008
Posts: 780
Received Thanks: 255
Haha that's cool, I got a house system up Database coding works really well with that stuff. I'm adding house admin right now..

Needa edit the database so it saves HousePoints and need to figure out instances..
n0mansland is offline  
Old 07/08/2009, 02:42   #12
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by n0mansland View Post
Haha that's cool, I got a house system up Database coding works really well with that stuff. I'm adding house admin right now..

Needa edit the database so it saves HousePoints and need to figure out instances..
Yah database works awesome.

For a second I thought you had instancing working aww well.


Ps: New hosting/forums/remote database is online

alchemyco.org
pro4never is offline  
Reply


Similar Threads Similar Threads
[Release]Random S4 Hacks
05/20/2013 - S4 League Hacks, Bots, Cheats & Exploits - 53 Replies
smth
[Release] Random treasure event
02/02/2010 - CO2 PServer Guides & Releases - 6 Replies
Ok so this is going to be a scattered release as I don't plan on going through my source and finding every possible thing you could ever need. If there are problems post away and I may help but for the most part you will be on your own to get this working. What is this? This is a quest/event I designed at like 4 am one night when I couldn't sleep after getting pissed off at all the BAD quests released (not pointing fingers... but you all gotta admit there have been some very pointless...
[Release] Random teleport via database
01/17/2010 - CO2 PServer Guides & Releases - 8 Replies
Ok so I had a similar system on my oooolldd coemu server but seeing as I have no backup of it I figured I'd re-code it. This has proven a very useful learning experience for me. Data structures are not something I've ever been comfortable using and so I've always avoided them like the plague xD. Huge thanks to Korvacs: Your advice is always appreciated. This is for Co1 CoFuture but seeing as it's a database system you can convert it for CoEmu with virtually NO hassle. If people can't...
[RELEASE] Random Things For All Types Of Sources!
11/06/2009 - CO2 PServer Guides & Releases - 9 Replies
Well Guys i havent really released much, imma be making some random things for all types of sources, To try to improve my coding, yes im not great at coding, i can do it though, I'll try to make something new each day, I'll be posting things such as, NPC's, Quests, Commands, Alot more i cannot think about at moment. LOTF Santa Claus First of all you'll need to search in Client.cs for: CurrentNPC = NPCID; Below that Add: if (CurrentNPC == 950)//Santa Claus {...
[RELEASE] SEA 0.1.17 Random TP
07/17/2009 - Dragonica Hacks, Bots, Cheats & Exploits - 4 Replies
Just because I can :P This serves no purpose whatsoever but to randomly teleport you around the map once per second for lulz.



All times are GMT +1. The time now is 02:49.


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.