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.
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.
*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.