Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 13:56

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

Advertisement



[Albetros source]Any one can explain me how to make random drop item event?

Discussion on [Albetros source]Any one can explain me how to make random drop item event? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
[Albetros source]Any one can explain me how to make random drop item event?

Hello EPVP member, any one can explain for me how i can make randomize position on map dropped item? like:

/dropdb <-- when i used player got msg

[SYSTEM]Suprise! Free DB on random pos in Twin City!

and server dropped 1 dbs on random title in city.

Thanks for explain i no have idea for it.. I have only build command and i am now on this step:
Quote:
private static bool Command_SantaEvent(Player user, string[] data)
{
if (user.Permission < PlayerPermission.GM) return false;
Kernel.SendToServer(new TalkPacket("SYSTEM", "ALLUSERS", "Suprise! Free DB on random pos in Twin City!", "", 0xffffff, ChatType.Center));
return true;
}
mejo33 is offline  
Thanks
1 User
Old 06/06/2014, 22:50   #2
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239
that command is just talkpacket?

u should look for grounditem packet 1101

search for it and check all the refences it would be helpful for u
abdoumatrix is offline  
Old 06/07/2014, 00:58   #3
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
So i looking for this packet and write code like that:
Quote:
private static bool Command_SantaEvent(Player user, string[] data)
{
if (user.Permission < PlayerPermission.GM) return false;
Kernel.SendToServer(new TalkPacket("SYSTEM", "ALLUSERS", "AlcoholistChuck lost GiftBag, search it on random pos in Twin City for your reward!", "", 0xffffff, ChatType.Center));

Entity killer;
GroundItem bag = new GroundItem(new Structures.ItemInfo(1088000), (ushort)400, (ushort)400, Kernel.Maps[user.Map.ID], user is Player ? user.UID : 0);
user.SendToScreen(Packet.GroundItem.Create(bag, 1), false);
return true;
}
And this is now work.. Can u ask me more Abdo? I dont get any error in console and debugger, but i dont see item on the ground in pos 400, 400, 1002

and i have other one questios.. i make script for BlackTulip, all works armor changed color etc.. but i dont know how can i save the color to database -> items -> color column.. can u help me too? there codes for black tulip.
Quote:
#region BlackTulip
case 723584:
var itm = user.Equipment.GetItemBySlot(ItemLocation.Armor);
itm.ChangeItemtype(item.Color = 2);
var id = item.StaticID;
var UID = item.UniqueID;
var Color = itm.Color;
itm.Color = 2;
user.Send(Packet.ItemInfoPacket.Create(itm, item.Color = 2));
user.Equipment.SetSlot(itm, (ItemLocation)itm.Location);
user.Send(Packet.ItemInfoPacket.Create(itm, 3));
user.Recalculate();
Database.ModifyItem(Color, "2", itm.UniqueID);
break;
#endregion
mejo33 is offline  
Old 06/07/2014, 01:17   #4
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239
Quote:
user.SendToScreen(Packet.GroundItem.Create(bag, 1), true);
as

Quote:
public override void SendToScreen(byte[] data, bool self)
---------------------

PHP Code:
 Database.ModifyItem(mainItem.Color"Color"mainItem.UniqueID); 
as

/// value , coloum name, itemuid
abdoumatrix is offline  
Thanks
1 User
Old 06/07/2014, 01:44   #5
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
Thanks for helps, all fully working but i need using randomize tiles can u help me too with what? i now using like that:
Quote:
private static bool Command_SantaEvent(Player user, string[] data)
{
if (user.Permission < PlayerPermission.GM) return false;
Kernel.SendToServer(new TalkPacket("SYSTEM", "ALLUSERS", "AlcoholistChuck lost GiftBag, search it on random pos in Twin City for your reward!", "", 0xffffff, ChatType.Center));


uint[] randposx = new uint[] { 400, 376, 391, 360, 382, 358, 409, 468, 462, 473, 510, 463, 394, 401, 472 };
uint[] randposy = new uint[] { 400, 404, 366, 347, 341, 317, 328, 341, 367, 399, 355, 291, 274, 242, 235 };
GroundItem gi = new GroundItem(new Structures.ItemInfo(729912), (ushort)randposx[Kernel.RandomNext(randposx.Length - 1)], (ushort)randposy[Kernel.RandomNext(randposy.Length - 1)], Kernel.Maps[user.Map.ID], 0);
user.SendToScreen(Packet.GroundItem.Create(gi, 1), true);
return true;
}
So.. its randomize x and y what ever.. I need build a tablice like
xpos = 400, 450, 500
ypos = 400, 450, 500
i dont know how to make it...

BTW released here fully working BlackTulip code:
Quote:
#region BlackTulip
case 723584:
var itm = user.Equipment.GetItemBySlot(ItemLocation.Armor);
itm.ChangeItemtype(item.Color = 2);
var id = item.StaticID;
var UID = item.UniqueID;
var Color = itm.Color;
itm.Color = 2;
user.Send(Packet.ItemInfoPacket.Create(itm, item.Color = 2));
user.Equipment.SetSlot(itm, (ItemLocation)itm.Location);
user.Send(Packet.ItemInfoPacket.Create(itm, 3));
user.Recalculate();
Database.ModifyItem(itm.Color, "Color", itm.UniqueID);
break;
#endregion
Thanks for Abdumatrix for help saving the colors to databases.
mejo33 is offline  
Old 06/07/2014, 13:52   #6
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239
u could use something like that one used in generateing monster
PHP Code:
   var spawnPoint = new Point(Kernel.RND.Next(spreadspread), Kernel.RND.Next(spreadspread));
                   for (var 
tries 0tries 10 && !Kernel.DmapHandler.Maps[(int)monster.Map.ID].Check(spawnPoint.XspawnPoint.Y); tries++)
                   {
                       
spawnPoint = new Point(Kernel.RND.Next(spreadspread), Kernel.RND.Next(spreadspread));
                   } 
as it check points vaild. etc


or just use this

Quote:
ushort[] randposx = new ushort[] { 400, 376, 391, 360, 382, 358, 409, 468, 462, 473, 510, 463, 394, 401, 472 };
ushort[] randposy = new ushort[] { 400, 404, 366, 347, 341, 317, 328, 341, 367, 399, 355, 291, 274, 242, 235 };

var rnd = Kernel.RandomNext(randposx.Length);

GroundItem gi = new GroundItem(new Structures.ItemInfo(729912), randposx[rnd], randposy[rnd], Kernel.Maps[user.Map.ID], 0);
abdoumatrix is offline  
Thanks
1 User
Old 06/07/2014, 15:40   #7
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
Ok its work but i got one new problem... The item drops only when player stay in this cords.. But when i am on center map twin city and use this command and go to cords i dont see item, when i stay in ex. 400, 400 the item will be dropped and see it. Where problem? user.SendToScreen? how to update map for world.
mejo33 is offline  
Old 06/07/2014, 17:07   #8
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239
Quote:
Originally Posted by mejo33 View Post
Ok its work but i got one new problem... The item drops only when player stay in this cords.. But when i am on center map twin city and use this command and go to cords i dont see item, when i stay in ex. 400, 400 the item will be dropped and see it. Where problem? user.SendToScreen? how to update map for world.
so u drop item too far away from u so u arrive the point it disappeared

isn't there a time for item to disappear? (15-20 sec.)
abdoumatrix is offline  
Old 06/07/2014, 17:49   #9
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
You play in lastCo? there is a santabag drop event, i need make it same. No drop item from reach player, item need to drop by random cords in map for all player.
mejo33 is offline  
Old 06/07/2014, 18:02   #10
 
elite*gold: 0
Join Date: May 2014
Posts: 11
Received Thanks: 1
Take a peek at monster drops to see how a item is generated and added to the ground.


Combine with dmap validity checks (examples in same item drop section) and a System.Random roll to find a random location on the twin city map.

NOTE: There is not currently a way to make the DB last longer than most ground items IIRC.... You could just add an overload to the ground item constructor to let you have it last longer on the ground if needed.

Very basic pseudo code

ushort _x = random.Next(selectedMap.Width);
ushort _y = random.Next(selectedMap.Height);

while(!ValidItemLocation(selectedMap, _x, _y))
{
_x = random.Next(selectedMap.Width);
_y = random.Next(selectedMap.Height);
}

DropItemOnGround(selectedMap, _x, _y);
TwitchTime is offline  
Reply


Similar Threads Similar Threads
[Help]how to make a shop in Albetros source
01/28/2013 - CO2 Private Server - 2 Replies
hi,i need to know how to make a shop in Albetros source 5517 so please anybdy help me
How to make Account ( albetros source )
08/27/2012 - CO2 Private Server - 24 Replies
Help me Please : http://i47.tinypic.com/af8niv.jpg
what make event drop
07/11/2012 - Metin2 Private Server - 0 Replies
what make event drop (with GM comand start all mob drop items )
Giving random stuff Albetros Source
03/14/2012 - CO2 Private Server - 3 Replies
Hi there, I know how to make a NPC, but I don't know how to give random stuff away. I use the Albetros source. Kind regards, Warzie005



All times are GMT +2. The time now is 13:56.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.