Knowledge: 6/10
Step 1: Visit OpenNos.GameObject/Item/then choose the wished handler.
For example:
- Special Item = Speaker, Bubbles, Fairy-Booster etc.
- Magic Item = Dowsing Rod, Airwaves etc.
- No Function Item = Quest Items, some Materials
Step 2: After u choose the handler, let's start with adding a case!
For this, you write:
Code:
case <INSERT_RANDOM_NUMBER>: break;
I personally start behind 9000
so: case 9000:
Step 3: After writing the code, you have to insert the case as effect to the wished item.
If you want to create your own Random Box, then search for the Item in the Database, and insert the case Number in "Effect" on the item values.
Item: Random Box of divine Fairys
Case Number: 9000
Effect Value: 9000
Step 4: Insert your code!
As i already said, we will add the Random Box of divine Fairy.
HELPER
The code i will show now, is a bit complexer. Its just to show you, how to add a randomizer for Random Boxes.
Code:
// Random Box of Divine Fairys
case 9000:
//For this Code, you have to add also 9000 as EffectValue to the Database
if (EffectValue == 9000)
{
int rnd = ServerManager.RandomNumber(0, 1);
if (rnd < 1)
{
short[] vnums =
{
//ID's of the Items, you will get
4129, 4130, 4131, 4132
};
//This Code counts the Items, you inserted
byte[] counts = { 1, 1, 1, 1};
int item = ServerManager.RandomNumber(0, 4);
session.Character.GiftAdd(vnums[item], counts[item]);
}
//This Code, deltes the Item from the Inventory session.Character.Inventory.RemoveItemFromInventory(inv.Id);
}
break;
Code:
//Item: White Tiger Costume Set
//ID: 5487
case 9001: //9000 already in use, so just go up
//Adds the Costume and the Hat to the inventory
session.Character.GiftAdd(4248, 1);
session.Character.GiftAdd(4256, 1);
//Deletes the Item from Inventory
session.Character.Inventory.RemoveItemFromInventory(inv.Id);
//You can also add a message, ON_USE
//session.SendPacket("msg 5 Success! You recieved your Items.");
break;







