[Help] dropping code

06/24/2010 19:40 _MaryJuana#1
heya all!

i need a bit help with a drop command. Thats my simple code atm:
Code:
                                        if (Splitter[0] == "/massdrop")
                                        {
                                            if (Splitter[1] == "expball")
                                                MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));
                                        }
If i "activate" this command then only I get a exp ball in my inventory (coz thats the code) but i want that every char whos online get a expball DROPPED near his char would be nice if someone could help me because i have no idea and i tryed it now sometimes and always I fail :D
06/24/2010 19:46 pro4never#2
do a foreach loop through all connected clients.


Then don't add to character, rather drop it on the ground.



You will want to do a few things.

#1 Setup a command that runs through all connected clients (I don't use lotf but on CoEmu it would be something like:

foreach (KeyValuePair<int, Client> Char in World.AuthenticatedClients)
{
Char.Value.w/e
}


Now you want to write a drop item function. I'd go to where your items are already being dropped and use it as an example. Again... coemu example is in my linklist seeing as I've already coded this stuff for it and released most of it... but w/e.

basically you want to do a loop through the number of items you wanna drop, create an item structure to store the new item (in CoEmu it would be something like Struct.ItemData Item = new Struct.ItemData() )

Then populate the values for the new item (item uid and such) and then drop the item using your drop code based on the foreach loop coords (map/x/y of the Client.Value you have)


It's not super complicated but not working with lotf I can't provide super specific advice.
06/24/2010 19:59 _MaryJuana#3
your knowledge is great :P

...but i dont understand what u wanted to tell me im not a good coder still at learning but thats too "high" for me :/