Code ExpBall in private Server

06/12/2008 06:02 Super.Pvper#1
Nevermind buddies, I got it the way to work i needed it to =D
06/12/2008 06:12 Lateralus#2
Um.. I don't know the variables/classes/methods. How am I expected to code it? >_>
06/12/2008 07:06 _Emme_#3
Simple make it connect to another file,where it is listed like

else if (Character.Level == 1)
Character.Level = 25;
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Level, Character.Level));
HeadController.SendVisibilityfield(StandardPackets .Effect.Packet("LevelUp", Character.PlayerID), Character);

StatPoints SP = StatSystem.KrijgPoints(Character.Level, Character.Class);

Character.Vitality = SP.Vitality;
Character.Strength = SP.Strength;
Character.Spirit = SP.Spritit;
Character.Agility = SP.Agility;

con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Agility, Character.Agility));
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Vitality, Character.Vitality));
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Strenght, Character.Strength));
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Spirit, Character.Spirit));

Character.HP = Character.MaxHP;
}
else
{
Dia.AddMessage("You used 5 expball's today. Are you sure you want to use more?");
Dia.AddOption("Yeah", 1);
Dia.AddOption("No thanks", 255);
Dia.Open();
}
if (Character.LevelUp)
HeadController.SendVisibilityfield(StandardPackets .Effect.Packet("LevelUp", Character.PlayerID), Character);
}
break;

that should be it. well,its alot of easier ways,um if you want more help or need an good coder,just tell me. [Only registered and activated users can see links. Click Here To Register...]
06/12/2008 07:07 _Emme_#4
Well,that code is just one i wrote,im pretty sure it wont fit into urs,but yeah just add me on msn.
06/12/2008 07:12 _Emme_#5
I think another way also is to do this:

case "120": = new string[] { "0", "8" }; break;
case "129": = new string[] { "0", "2.4" }; break;

The numbers after case are the levels,then the numbers after "new string" , is first the level,and ofcourse you dont get a whole level when you use an expball at 120,you get pcts. thats why its 8 after,gives 8 pcts.

well ofcourse you need to write a bunch of stuffs before to make the code working,but it shouldnt be too hard.
06/12/2008 14:36 Lateralus#6
Quote:
Originally Posted by emildayan1 View Post
Simple make it connect to another file,where it is listed like

else if (Character.Level == 1)
Character.Level = 25;
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Level, Character.Level));
HeadController.SendVisibilityfield(StandardPackets .Effect.Packet("LevelUp", Character.PlayerID), Character);

StatPoints SP = StatSystem.KrijgPoints(Character.Level, Character.Class);

Character.Vitality = SP.Vitality;
Character.Strength = SP.Strength;
Character.Spirit = SP.Spritit;
Character.Agility = SP.Agility;

con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Agility, Character.Agility));
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Vitality, Character.Vitality));
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Strenght, Character.Strength));
con.Send(UpdatePackets.Update.Ding(Character.Playe rID, UpdateThings.Spirit, Character.Spirit));

Character.HP = Character.MaxHP;
}
else
{
Dia.AddMessage("You used 5 expball's today. Are you sure you want to use more?");
Dia.AddOption("Yeah", 1);
Dia.AddOption("No thanks", 255);
Dia.Open();
}
if (Character.LevelUp)
HeadController.SendVisibilityfield(StandardPackets .Effect.Packet("LevelUp", Character.PlayerID), Character);
}
break;
No, this is absolutely horrid code. It's incomplete and you don't even have a case to break.

Quote:
Originally Posted by emildayan1 View Post
I think another way also is to do this:

case "120": = new string[] { "0", "8" }; break;
case "129": = new string[] { "0", "2.4" }; break;

The numbers after case are the levels,then the numbers after "new string" , is first the level,and ofcourse you dont get a whole level when you use an expball at 120,you get pcts. thats why its 8 after,gives 8 pcts.

well ofcourse you need to write a bunch of stuffs before to make the code working,but it shouldnt be too hard.
This is also incorrect, exp balls give raw experience, and it would be so much easier (and less sloppy) if you would measure it in raw experience rather than level/percentage.
06/13/2008 01:42 shitboi#7
i don't know how to code the thing you wanted. But my thoughts are the same as Lateralus.

say. 1 expball gives 50 000 000 exp on your server.

if (item_used == expball_id)
{ char.exp += 50000000;
evaluate_level();
}

this is what i have in mind.
06/13/2008 05:33 ChingChong23#8
else if (use_item[0] == 723700)
{

That's horrible coding, use a switch.

and Yeh emildayan1 there is no loop or switch to break.

Like lat said, we dont know the methods/variables to do anything. But ur closest will be how shitboi has it.

Make a formula in some class, do some maths then do something like

Formula formula = new Formula();

int itemId = use_item[0];
switch (itemId)
{
case 723700:
char.exp += formula.getExpBallFormula(); // <-- would tally up the percentage according to your level.
char.checkLevel(); // not sure how this is done in ur source, but it would check if you need to be leveled up.
inventory.removeItem(723700, 1); // however it is done in ur source
break;


}
06/13/2008 10:27 rioriorio#9
I HAV NO IDEA WHAT ANY OF YOU ARE SAYING
06/13/2008 19:32 lostsolder05#10
Quote:
Originally Posted by rioriorio View Post
I HAV NO IDEA WHAT ANY OF YOU ARE SAYING
then y u even replying 2 this topic? lol seems abit pointless 2 me ;)
06/13/2008 23:22 Orochisuke#11
Lol, Exp balls?

Anyway, just define a const for the amount exp an exp ball would give.
Code:
public const int ExpBallValue = 5e7; //50 million exp points
...
//in RequestEquipItem
case 723700:
{
int exp = ExpBallValue;
while(true)
{
//Start Pseudo-code
int req = ExpForNextLevel - Player.CurrentEXP; //Get the amount of exp for the next level minus what the player already has.
exp -= req; //subtract that amount from the exp available from the exp ball
if (exp <= 0) //Check if the exp is below zero, if so, we can't level from the amt remaining anymore
{
req = exp; //Make the two values equal. this way we add only what's left
}
Player.CurrentEXP += req; //Add the exp to the player
Player.LevelUp(); //Check for level up ie: show the anim, add the stats or stat points
//End pseudo code
}
}
break;
06/14/2008 02:55 Lateralus#12
Quote:
Originally Posted by Orochisuke View Post
Lol, Exp balls?

Anyway, just define a const for the amount exp an exp ball would give.
Code:
public const int ExpBallValue = 5e7; //50 million exp points
...
//in RequestEquipItem
case 723700:
{
int exp = ExpBallValue;
while(true)
{
//Start Pseudo-code
int req = ExpForNextLevel - Player.CurrentEXP; //Get the amount of exp for the next level minus what the player already has.
exp -= req; //subtract that amount from the exp available from the exp ball
if (exp <= 0) //Check if the exp is below zero, if so, we can't level from the amt remaining anymore
{
req = exp; //Make the two values equal. this way we add only what's left
}
Player.CurrentEXP += req; //Add the exp to the player
Player.LevelUp(); //Check for level up ie: show the anim, add the stats or stat points
//End pseudo code
}
}
break;
That's looking nice. Yeah, I'd go with his code.
06/20/2008 20:07 Super.Pvper#13
Nvm mates, I got it working the way I want it too =D