Register for your free account! | Forgot your password?

You last visited: Today at 03:19

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

Advertisement



Mana Trouble

Discussion on Mana Trouble within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2006
Posts: 93
Received Thanks: 9
Mana Trouble

I would just like a tip or hint as to were to look for ideals on how to fix this bug.
If anyone could help me with this (not code it for me) I would be very
appreciative.

My mana never runs out on taos, and when I have gourd as a trojan it says 0/800 but I can never get it up.
Valkmax is offline  
Old 11/10/2008, 07:04   #2
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
It's not a bug,it just has never been coded

Note: This is just an example / part of the code:


Define two things in Character.cs , CurMP, MaxMP, done?
Now lets say you want to gain 100 mana by using an item,it would look something like this:

if (ItemParts[0] == "ManaPotItemID")
{
CurMP += 100;
if (CurMP > MaxMP)
CurMP = MaxMP;
MyClient.SendPacket(General.MyPackets.Vital(UID,2, CurMP));

RemoveItem(ItemUID);
}


Okay,this is the number of the lines and I'll explain why they are there:


1 line : Checks if the item you rightclick on has the ID "ManaPotItemID"

2 line : Pluses your CurMP by 100, but this far,only the server know,not the client. So you still would have as much mana as you had before.


3 line : After your mana got plused ( server sided ) , it checks if it got higher than your max mana,because thats a bug.

4 line: If the mana was higher than max mana, it just takes your mana to max mana.


5. Send the packet to the client with your current mana ( server sided ) , so it upgrades on the client.


6 line : Removes the item you just used.


Hope it helped some


Emme
_Emme_ is offline  
Thanks
1 User
Old 11/10/2008, 07:29   #3
 
elite*gold: 0
Join Date: Aug 2006
Posts: 93
Received Thanks: 9
Thank you this is just what I needed to learn and understand at same time =)
Valkmax is offline  
Old 11/10/2008, 13:29   #4
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
Gourds and mana removing on skills aren't implemented.
*Bring it on?*
tao4229 is offline  
Old 11/10/2008, 17:11   #5
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
Mana removing on skills is pretty **** easy? lol
just to do

if (SkillID == ManaSkill)
{
if (skilllvl == blabla)
CurMP -= blabla;
sendpacket.


easy

And for gourd,pretty **** easy too. Just in the equip and unequip item part,do SOMETHING like this,its just in my head right now:


In Equip:

if (ItemID == Gourd)
{
MyChar.CurHP += 800;
SendPacket


In Unequip:

if (ItemID == Gourd)
{
CurHP -= 800;
SendPacket





Edit:
Maybe,just maybe this would work,you know at the use item part,such as exppots,expballs and all that,if you would do like this instead of equip


if (ItemParts[0] == Gourd)
{
CurHP += 800;
SendPacket
Equip(ItemUID);
}

Wouldnt that work? Lol
_Emme_ is offline  
Old 11/10/2008, 17:18   #6
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 912
Wouldn't you have to increase the MaxHP for adding gourd Emme?
kinshi88 is offline  
Old 11/10/2008, 19:43   #7
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
Does it do that on real co?
If so,you would just do:

CurHP += 800;
if (CurHP > MaxHP)
MaxHP = CurHP;



=]


Edit:
At unequip,you would do like:

CurHP -= 800;
MaxHP -= 800;
_Emme_ is offline  
Old 11/10/2008, 20:21   #8
 
elite*gold: 0
Join Date: Aug 2006
Posts: 93
Received Thanks: 9
Ok so this is what I have done and I still can't get mana to work,
Problems
1. Mana never goes down when casting spell (i.e nado)
2. Gourd Gives HP but not MP (i.e 0/800)
3. Mana pots don't seem to work but half way
Tao (full mana cause doe not go down)
Your mana is full you can not use this item (w/e)
Trojan with gourd 0/800
This item is not implemented yet blah (w/e)

Any tips would be nice,
Thanks in advance
If you rather pm things or msn me just let me know (will give msn to select people if needed)
#################
LOTF Source (TCWNN)
#################

CurMP, MaxMP
Code:
public ushort CurMP = 0;
public ushort MaxMP = 0;
Setting mana
Code:
public ushort BaseMana()
        {
            Ready = false;
            ushort mp = (ushort)(Spi * 15);
            if (Job == 133 || Job == 143)
                mp = (ushort)(Spi * 20);
            if (Job == 134 || Job == 144)
                mp = (ushort)(Spi * 25);
            if (Job == 135 || Job == 145)
                mp = (ushort)(Spi * 30);
            Ready = true;

            return (ushort)mp;
        }
Nado so it knows how much mana to remove (32,36,etc)
Code:
 SkillAttributes[1002] = new ushort[4][];
            SkillAttributes[1002][0] = new ushort[6] { 2, 0, 32, 505, 0, 0 };
            SkillAttributes[1002][1] = new ushort[6] { 2, 0, 36, 666, 0, 0 };
            SkillAttributes[1002][2] = new ushort[6] { 2, 0, 50, 882, 0, 0 };
            SkillAttributes[1002][3] = new ushort[6] { 2, 0, 62, 1166, 0, 0 };
            SkillsDone.Add(1002, 3);
Pots
Code:
else if (ItemParts[0] == "720014")
            {
                CurMP += 1000;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 0, CurMP));

                RemoveItem(720014);
            }
            else if (ItemParts[0] == "720015")
            {
                CurMP += 2000;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 0, CurMP));

                RemoveItem(720015);
            }
            else if (ItemParts[0] == "720016")
            {
                CurMP += 3000;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 0, CurMP));

                RemoveItem(720016);
            }
            else if (ItemParts[0] == "720017")
            {
                CurMP += 4500;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 0, CurMP));

                RemoveItem(720017);
            }
Gourd
Code:
ushort ExtraHP = 0;
                ushort ExtraAtk = 0;
                ushort ExtraMP = 0;

                if (ItemId == 137310)
                    ExtraHP = 30000;
                if (ItemId == 2100025)
                {
                    ExtraHP = 800;
                    ExtraMP = 800;
                }
                if (ItemId == 2100045)
                    ExtraMP = 400;


                ushort AddDef = (ushort)(TheItem[10] + ushort.Parse(PItem[5]));
                ushort AddMDef = (ushort)(TheItem[11] + ushort.Parse(PItem[7]));
                ushort AddMinAtk = 0;
                ushort AddMaxAtk = 0;
                if (Pos != 5)
                {
                    AddMinAtk = (ushort)(TheItem[8] + uint.Parse(PItem[3]) + ExtraAtk);
                    AddMaxAtk = (ushort)(TheItem[9] + uint.Parse(PItem[4]) + ExtraAtk);
                }
                else
                {
                    AddMinAtk = (ushort)((TheItem[8] + uint.Parse(PItem[3]) + ExtraAtk) / 2);
                    AddMaxAtk = (ushort)((TheItem[9] + uint.Parse(PItem[4]) + ExtraAtk) / 2);
                }
                ushort AddMAtk = (ushort)(TheItem[12] + ushort.Parse(PItem[6]));
                ushort AddHP = (ushort)(ItemEnchant + ExtraHP + ushort.Parse(PItem[2]));
                ushort AddMP = (ushort)(ItemEnchant + ExtraMP + ushort.Parse(PItem[2]));
                ushort AddDex = (ushort)(TheItem[14] + ushort.Parse(PItem[8]));
                byte AddDodge = (byte)(TheItem[13] + byte.Parse(PItem[9]));
With this
Code:
if (SkillID == ManaSkill)
{
if (skilllvl == blabla)
CurMP -= blabla;
sendpacket.

I don't understand why you would need to define the skill a second time? If that make since, cause in database. Under SkillAttributes you are telling it how much to remove already?

I am very lost and this is one of the main things I want to work so I can start fixing and adding more skills and then work on damage's. If anyone can help me with MANA in general I would be very happy. I am trying to learn C# I am new to it, but I am trying to learn and not copy and paste things.
Valkmax is offline  
Old 11/10/2008, 20:53   #9
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
You dont need to define it a second time,that was just an example =P
About gourd,you could just do:

CurMP += 800;
if (CurMP > MaxMP;
MaxMP = CurMP;

SendPacket


Unequip:

CurMP -= 800;
MaxMP -= 800;
if (CurMP < 0)
CurMP = 0;
SendPacket
_Emme_ is offline  
Old 11/10/2008, 21:34   #10
 
elite*gold: 0
Join Date: Aug 2006
Posts: 93
Received Thanks: 9
I think the problem with gourd is same with skills, it just does not know what mana is? I don't know :P I truly am lost here with this mana stuff and I haven't found anything on it besides whats in this post.
Valkmax is offline  
Old 11/10/2008, 21:41   #11
 
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
You're not alone man. The whole mana deal is confusing the hell out of me to. I've been trying for 2 days now to try and figure it out, and just no luck. If I figure something out, I'll update you, but the way this is progressing for me, doubt that's gonna happen.
Incariuz is offline  
Old 11/10/2008, 21:41   #12
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
No listen,this is how it works:

You define mana,now its CurMP on your source ( i think ).

Okay,client has no idea at all what curmp is,right? But still,you add like 100 mana,in the server.
Now,to let the client know,you need to send a packet to the client.

We have this far figure out that the mana type is 2, so, we have to send the current mana to the type 2.

So,you would do that like this:

SendPacket(General.MyPackets.Vital(MyChar.UID, 2, CurMP));

Okay,so what you do is:

SendPacket(General.MyPackets.Vital

Sends an vital packet


MyChar.UID

So it knows it should send it to your character.


2

The type is 2 for mana,so we send it to the mana bar. 0 is for HP, 12 is for Model, and 2 is for mana. ( There is alot more,those were just examples! )


CurMP

And for the value of the code,how much MP you should gain,there, we define CurMP. So if you have CurMP = 100 in the source, it will gain 100 MP in the client, mana bar.

Understand a bit better now? Hope you did.

Emme
_Emme_ is offline  
Old 11/10/2008, 21:42   #13
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
I noticed with your potions you're trying to remove an item by its ItemID. The parameter is supposed to be the ItemUID (unique ID) so the client knows exactly which item was used. So change it to ItemUID (a parameter for the method [UseItem(ulong ItemUID, string Item)]). An item's UID is really a uint, but that's another story.
nTL3fTy is offline  
Old 11/10/2008, 21:48   #14
 
elite*gold: 0
Join Date: Aug 2006
Posts: 93
Received Thanks: 9
Thank you all and emme I think I understand what you are saying I will try to miss with it some more and see what I can do.
@ntl I will change that thank you.

Did some missing and seems nothing is helping

So I added
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 2, CurMP));

After every
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 0, CurHP));

Then I added every
CurMP = MaxMP;
after
CurHP = MaxHP;

Then
MaxMP = BaseMaxMP();

After every
MaxHP = BaseMaxHP();

Then did this
Code:
public ushort BaseMaxMP()
        {
            Ready = false;
            ushort mp = (ushort)(Spi * 15);
            if (Job == 133 || Job == 143)
                mp = (ushort)(Spi * 20);
            if (Job == 134 || Job == 144)
                mp = (ushort)(Spi * 25);
            if (Job == 135 || Job == 145)
                mp = (ushort)(Spi * 30);
            Ready = true;

            return (ushort)mp;
        }
after
Code:
   public ushort BaseMaxHP()
        {
            Ready = false;
            double hp = Vit * 24 + Str * 3 + Agi * 3 + Spi * 3;
            if (Job == 11)
                hp *= 1.05;
            if (Job == 12)
                hp *= 1.08;
            if (Job == 13)
                hp *= 1.1;
            if (Job == 14)
                hp *= 1.12;
            if (Job == 15)
                hp *= 1.15;
            Ready = true;
            return (ushort)hp;
        }
And still nothing has change so I don't know what I am doing wrong
Valkmax is offline  
Old 11/10/2008, 22:26   #15
 
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
I noticed an error with the coding you did for using pots. Seems there are 2 ID's for each, and you need to have both added for them to work.

So simply add this above the ones you already added, and they work. However, the weekest pill hasn't been coded, I'll search them after and add.

Code:
else if (ItemParts[0] == "1001030")
            {
                CurMP += 1000;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 2, CurMP));

                RemoveItem(ItemUID);
            }
            else if (ItemParts[0] == "1001040")
            {
                CurMP += 2000;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 2, CurMP));

                RemoveItem(ItemUID);
            }
            else if (ItemParts[0] == "1002030")
            {
                CurMP += 3000;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 2, CurMP));

                RemoveItem(ItemUID);
            }
            else if (ItemParts[0] == "1002040")
            {
                CurMP += 4500;
                if (CurMP > MaxMP)
                    CurMP = MaxMP;
                MyClient.SendPacket(General.MyPackets.Vital(UID, 2, CurMP));

                RemoveItem(ItemUID);
            }
Oh, and go to all your codes and change the send packets to...

Code:
MyClient.SendPacket(General.MyPackets.Vital(UID, 2, CurMP));
nothing major, you just used 0 instead of 2. Pots are usable once that's done. I'm going to keep trying to figure out the whole spells using mana still.
Incariuz is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Pets mana recovering from Mana tunnel
02/23/2010 - Mabinogi - 28 Replies
So, Anybody have any idea how to start with this? It'd be one awesome thing to have pets recover Mana by mana tunnels. You could sit there gathering herbs all day from your gnu or whatever pet:handsdown: Golem unlimited range mod might be nice too. Both very possible... IDAPRO+OllyDBG .dll edits maybe?
TROUBLE!!
01/27/2010 - Dekaron Private Server - 10 Replies
im having trouble with df start times, i made times all right and used search but it still didnt help...the problem is when i start the df in the db at 15:00 and then wait until 14:59 to 15:00 the event dosen't start and when i talk to the NPC it says something like "It is not time for the application period", any1 know why its doing that? EDIT; df works ok when i use the gm command for it but not for the times...
trouble
06/20/2008 - Eudemons Online - 2 Replies
when i start my client for the private server its all black like the world biggest lag ever, but when i start the orginal eudemons there is no problem at all, can any1 help me out?????



All times are GMT +2. The time now is 03:19.


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.