Mana Trouble

11/11/2008 02:06 tao4229#31
Quote:
Originally Posted by Incariuz View Post
Ok, well I'm back at it now, so I'll look through and see what I can find.

Edit: I have noticed one thing though. A large variety of area's in the character.cs dealing with stamina involve SkillAttributes[4]. Would I perhaps need to make a #region SkillAttribute dealing with mana or something?
The #regions for skillattributes refer to the type of skill or the FIRST number in the array(IE: 2 for thunder etc).
11/11/2008 02:09 Incariuz#32
lol, I was just looking in Emme's thread and came upon you saying that and it triggered.

I'm reading through that section carefully right now, god I hope I get this. I have a feeling it's so simple, and my mind just isn't clueing into it.
11/11/2008 02:53 Valkmax#33
I have a feeling it is simple but, we just aren't doing some step right or leaving out 1 thing or something small.
11/11/2008 03:26 Incariuz#34
Well... I ran off to eat, back at it now. I'm gonna look through #region SkillAttributes2n6n12 now, hopefully something will come to me.
11/11/2008 03:44 Incariuz#35
Progress... Finally... Ok, sorry for double post, but figured this is important.

At #region SkillAttributes2n6n12

Code:
                            Stamina -= (byte)SkillAttributes[4];
                            MyClient.SendPacket(General.MyPackets.Vital(UID, 9, Stamina));
below it I added

Code:
                            CurMP -= (byte)SkillAttributes[2];
                            MyClient.SendPacket(General.MyPackets.Vital(UID, 2, CurMP));
it's draining mp for magic now. Only one small issue, when I cast the spell I have 7000/7000 MP but it jumped to like 66000/7000 after casting, then started removing off that new amount each attack. Going to see if I can work this out. If you figure anything out, lemme know.

Edit: And on a side note, you were originally right when setting up the mana usage for spells. So don't attempt with the way I stated before, it just results in mana usage.
11/11/2008 03:58 tao4229#36
Not going to quote that post but heres your error
(ushort.Maxvalue = AROUND 65534 or something)
You have CurMP at 0 right now, when you subtract an unsigned int, and it goes below zero, you get Type.MaxValue - the value you subtract. Here's your "like 66000/7000".

Fix: On login set CurMP to MaxMana() OR load CurMP from mysql(real way).
And don't typecast it to a byte, some mana useage is over 255.

Code:
CurMP -= [Color="Green"]/*(byte)*/[/Color]SkillAttributes[2];//Leave it as ushort.
11/11/2008 03:58 Valkmax#37
Thanks for the update I will be seeing what i can make happen, We will figure this out =)
11/11/2008 04:10 Incariuz#38
Ya, I wasn't thinking about the byte, was just happy it worked, lol. It's changed now, but still giving the same effect.

I'm not really sure what you meant by the rest, sorry. Brain is shutting down on me while lost in thought.
11/11/2008 04:24 Valkmax#39
Ok what he is saying (I think) Is we need to make it so max mana starts when you log in, so you do not get the error of 66000/700 (w/e). And to change byte to ushort? I might be wrong but I will miss with it and see =)
11/11/2008 04:29 Incariuz#40
Ya, change byte to ushort in the code I gave. For when we get to spells using more mana then 255 to avoid errors. And I just figured out the rest he said after I sent my message, lol. Had a blonde moment. But now I'm trying to find where to setup the mana on login. I'm guessing we also need to do something in the public void Revive script aswell for when we revive after death to avoid the error, but I'm not gonna mess with that till I get the login mana fixed.

Edit: Sorry to be a pest tao, but how would you load from MySQL? I'm assuming it means loading the last recorded amount of mp the player had, to avoid people logging on and off to receive maxmana. But I have no clue how I'd go about that.
11/11/2008 04:43 tao4229#41
Quote:
Originally Posted by Incariuz View Post
Ya, change byte to ushort in the code I gave. For when we get to spells using more mana then 255 to avoid errors. And I just figured out the rest he said after I sent my message, lol. Had a blonde moment. But now I'm trying to find where to setup the mana on login. I'm guessing we also need to do something in the public void Revive script aswell for when we revive after death to avoid the error, but I'm not gonna mess with that till I get the login mana fixed.

Edit: Sorry to be a pest tao, but how would you load from MySQL? I'm assuming it means loading the last recorded amount of mp the player had, to avoid people logging on and off to receive maxmana. But I have no clue how I'd go about that.
Search the entire solution for your login message :p

It's Client.cs
Packet type 1010(DataPacket/GeneralData/0x3F2 whatever the fk you wanna call it)
Subcase 74 I beleive.
11/11/2008 04:45 Valkmax#42
I think I see what you are saying I will toy with it and cross my fingers =)
Thanks again all that are helping
11/11/2008 04:53 Incariuz#43
Ok, client.cs it is. Wish me luck
11/11/2008 04:57 Valkmax#44
Ok I went to Case 74 and I added
Code:
MyChar.MaxMana();
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 2, MyChar.MaxMP));
Still getting same problem (is this correct ?)
11/11/2008 05:08 Incariuz#45
I don't think it's case 74 we need to work with tbh. Not sure which case it is yet, still searching through. But when I jumped to case 74, I didnt see anything about hp, so I left it alone.