[Release]New skill - Restore ([Guide])

11/30/2008 07:42 tao4229#1
Okay, so I was playing around with effects and I got here.
Big + thanks to ntlefty for telling me the statuseffect.ini file =D
____________

So first, my favorite effect in the CO client already is "mass"... It looks sweet.
Its a blue kinda vortex around you, but its temporary, so I edited it to loop forever.
Next, the CO Client has a ton of unused skills, one I found is the XP Skill - Restore. It's skill ID is 1105, and it only has one level: 0/Fixed. We're going to make use of both for our coolio skill.
_______________

What it does here: Shows an effect around your character(using a good way, not spamming it)
Adds HP slowly over 50 seconds.

_________________

I tried to comment very well, so if you don't understand, ask questions.
Don't ask retarted questions though, such as "how to change hp rate?:confused:".
I won't answer such questions, as it's not hard to do yourself.
________________

Reminder: I don't use LOTF, this hasn't been tested. Plx report bugs in a non-noobish way.
Ex: "um cant see efct plx help"
BEEEP! WRONG!

Ex: "My compiler is asking for a ';' here, do I need to add one?"
Ding Ding! Winner!
I will respond to these questions if I can.

_______________________________________


If you want to do it like me, start off by making it loop forever.

[Editin' 3deffect.ini]
So yeah, not that hard... open client\ini\3deffect.ini just in notepad.
ctrl + f(your handy search function!) and search for [mass].
This will lead you to where the client finds its data for the effect "mass".
All we're really concerned about is making it loop, so change the key of "LoopTime" to 99999999.(lol)

After that, the [mass] section should look like this....
Code:
[mass]
Amount=2
EffectId0=2809
TextureId0=5819
ASB0=5
ADB0=6
EffectId1=2810
TextureId1=5820
ASB1=5
ADB1=6
Delay=0
LoopTime=99999999
FrameInterval=40
LoopInterval=0
OffsetX=0
OffsetY=0
OffsetZ=0



Now for teh fun part, that i just figured you could do today!

Okay, so if you know a little about CO, they have these thingz called statflags. Flags in programming are an easy way to get a lot of bools(i guess) into a value, because a bool really only needs one bit(1 or 0). The way LOTF handles it = pretty gay.... anyways............ I found a flag thats not in use(by me or LOTF that I know of), and changed it so it'll show our coolio little effect! Nice 'eh?

[Editin' statuseffect.ini]
This file contains statflags + effects to show with them...
Guess what, let's add a new one with our effect.

The file itself may seem weird, but bare with me here.
The first serious of numbers is the statflag(in HEXADECIMAL LEARN IT), and the next string is effect. Not sure what the last one is xD.
Anyways...
Find where it says...
Code:
00000200 attackup40 NULL
and then the next two lines are
Code:
00000400 NULL NULL
00000800 NULL NULL
Right after those two lines add this line that I made...
Code:
00001000 mass NULL
See? StatFlag + effect + NULL.
Easy!
Now, for easier reference for you n00ps, use MS calc to convert from hex/normal(dec). 0x1000(hex starts with 0x in most high level languages) in decimal or normal format would be 4096.


Now REMEMBER THIS!!!!
People will only be able to see the effect and stuff IF YOU SEND OUT A PATCH WITH THESE FILES IN IT. DONT ASK STUPID QUESTIONS K?


[Source part!]

Okay, so now we did the easy part.
The next part is easy too, just add some variables to the top of our character class(Character.cs).

Doesn't matter where up there, I did it here...
right under..
Code:
public bool Flying = false;
just add these two variables...
Code:
public bool Restoring = false;//our little bool for the restore flag.
public DateTime RestoreTime = DateTime.Now;// a time for when restore started(like lotf does..)
Now that we've made our variables, first things first.
Lets add our newest bool to the GetStat() in Character.cs
This serves as a way to get the total statflag from all the bools(Not a good way!! but meh..)

Search Character.cs for
Code:
public ulong GetStat()
Now, just like the other bools,
add in the value...
Doesn't matter where as long as its in this method.
Code:
            if (BlueName)
                it++;
[b]
            if (Restoring)
                it += 4096;
[/b]
            if (TeamLeader)
                it += 64;
            if (Poisoned)
                it += 2;
Now that we've done that, we can actually move onto the skill part! :p

[Adding the skill to the database!]

Well, LOTF loads skills gayly(as usual)...
But here you go...

In Database.cs
search for
Code:
public static void DefineSkills()
Under it somewhere in the skills, add this little snippet.
Code:
//1105 is skill ID. 0 is highest level
SkillAttributes[1105] = new ushort[1][];//LOTF has this ushort[][][] for skills.
//your putting the ushort[][] SkillAttributes[1105] and initializing it as a "new ushort[1][]
SkillAttributes[1105][0] = new ushort[6] { 7, 0, 0, 0, 0, 0 };
//now you're setting the first item in the array to a new ushort[] with 6 values, which are then listed beside it(7...)
//Each value represents stuff in certain skills, but since restore is self cast, you dont need much info...
//the 7 refers to the SkillType i'll use later in the UseSkill() function in Character.cs
SkillsDone.Add(1105, 0);// Finally, add it to the hashtable of all the skills done, so the server knows that this skill has been done, and will process it if a client uses that skill.
Well, if you have powersource, or use those other database methods, DO NOT ASK. I WILLLLLLL NOTTTT HELLLLLLPPPP YOU! Challenge yourself to figure it out yourself!!

[Actually doing the skill in Character.UseSkill()]
Okay, well once the server receives a packet, it calls this method for the character to use a skill.
It's broken down into several #region's depending on skill type(that 7! remember the lucky 7!).
In this case, we'll be dealing with skill type 7, which is all those XPskills/self buffs(Fly, SM, Cyclone, etc).

To get here(if you cant find it >.>) search character.cs for..
Code:
public void UseSkill(ushort SkillId, ushort X, ushort Y, uint TargID)
This is a big section, and not very organized(HAH LOTF being organized. HAHA.)

Make your way to #region SkillAttributes7 (LUCKY 7!)
or look for skills until you find 8003/fly and 1025/SM, you'll know you're there.

Right under accuracy I added my skill usage.
find
Code:
if (SkillId == 1015)
                        {
                            XpList = false;
                            AccuracyOn = true;
                            AccuracyActivated = DateTime.Now;
                            MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
                            MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "Accuracy XP: Your accuracy wil be increased for 200 seconds.", 2005));

                        }
And under it add my new code...
Code:
if (SkillId == 1105)
                        {
                            XpList = false;//turn off xp list
                            XpCircle = 0;//reset xp counter
                            Restoring = true;//turn on the restore flag we added, so the server keeps adding HP + the c00l effect.
                            RestoreTime = DateTime.Now;//So the server will know when to remove the restore.
                            MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));//Send the update to the client, so it starts the effect we added.
                            World.UpdateSpawn(this);//send the update to everyone else
                        }
I commented pretty well there soo.....

Moving on....

[Adding the actual skill part(what it does!)]
So we all know(well...) that LOTF has a timer for characters, and most of this stuff justs loops on the timer(not a good idea but... as i said before.. `Meh.`)

To find the timer elapsed method, it's easiest to search around in Character.cs for if (StigBuff)
And find where it actually removes stig.
That code is like this...
Code:
if (StigBuff)
                if (DateTime.Now > Stigged.AddSeconds(20 + StigLevel * 5))
                {
                    StigBuff = false;
                    MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
                    World.UpdateSpawn(this);
                }
Right under it we'll add the code for Restore.
Code:
if (Restoring)//If this person has the restore flag on...
            {
                if (CurHP < MaxHP)//Dont want to update if they have more than full HP, thats gay.
                {
                    CurHP += (ushort)(MaxHP / 15);//Obvious, add their MaxHP divided by 15... change this if you like.
                    if (CurHP > MaxHP)
                        CurHP = MaxHP;//So the HP isn't higher than max, that'd be gay also.

                    MyClient.SendPacket(General.MyPackets.Vital(UID, 0, CurHP));//Send the packet so the client updates health.
                }
                if (DateTime.Now > RestoreTime.AddSeconds(50))//If they've been restoring for more than 50 seconds
                {
                    Restoring = false; //Remove the flag for restoring(The effect + Adding HP)
                    MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));//Send the statflag packet
                    World.UpdateSpawn(this);//update the character with new flag.
                }
            }
There you have it!
_______________

I believe that's all, someone test and get back to me.
I hope that doing this super in depth guide will give people some insight...
This goes out to Incariuz mainly for being cool :p.
_______________

I HAVE NOT TESTED THIS, DONT COMPLAIN, ILL FIX IT IF I MESSED UP.
11/30/2008 07:46 sherwin9#2
Nice ;)

Going to test it soon

Ciao!
11/30/2008 08:42 Incariuz#3
Awesome work, love the regen idea, could be a usefull skill for my future classes. I haven't tested yet, but I will in a few hours. If I find any bugs, I'll try and correct them to help save you some time.
11/30/2008 11:04 YukiXian#4
Were you'f got that skill from?
And what about the Status Effect?
11/30/2008 11:55 Korvacs#5
Very nice work
11/30/2008 12:09 Kiyono#6
Works great but if you get attacked with the skill activated your HP resets after a hit from a mob other then that good work.
11/30/2008 12:29 alexbigfoot#7
nice one! great job...go go buddy!
11/30/2008 13:09 µ~Xero~µ#8
Tao i have to thank u alot not 4 the skill .. but 4 the guide now i wont have any probs :D

Btw if u getting attacked it resets so just add a// save() // with just saves your hp and it should be fixed :D

And a question.. im a bit dumb i think :( But how much ms pass till it heals again?
11/30/2008 13:43 Incariuz#9
On second thought, won't be trying this till much later then expected. Need a break from coding for a bit. Giving me a headache. ><
11/30/2008 13:49 © Haydz#10
Really good work tao, also ntlefty or however you spell his name. Now i can play around and add stupid flags to my source LOL...
11/30/2008 14:22 Incariuz#11
Ok, I couldn't help it, I was too curious so I added it. XD

Everything works perfect, I can't fin an issue with it. I'm not sure what you meant by it resetting Xero. It continue's healing for the alloted xp time, it doesn't reset the timer or anything.
11/30/2008 14:22 nTL3fTy#12
I see you finished it, good work. :)
11/30/2008 15:18 Kiyono#13
So how did you got the MagicType.dat "readable"
11/30/2008 15:49 tao4229#14
Quote:
Originally Posted by © Haydz View Post
Really good work tao, also ntlefty or however you spell his name. Now i can play around and add stupid flags to my source LOL...
That was teh main point of the guide.
Was going to screw around, I did restore before a different way
1 + 1 = 2 ;D
Quote:
Originally Posted by µ~Xero~µ View Post
Tao i have to thank u alot not 4 the skill .. but 4 the guide now i wont have any probs :D

Btw if u getting attacked it resets so just add a// save() // with just saves your hp and it should be fixed :D

And a question.. im a bit dumb i think :( But how much ms pass till it heals again?
I don't get what you're saying but...
Once I understand it I'll work on it.

The ms delay is the delay of your timer for stamina and everything.(Usually around 500ms i think).

Quote:
Originally Posted by Djago160 View Post
Works great but if you get attacked with the skill activated your HP resets after a hit from a mob other then that good work.
What do you mean the HP Resets?
Quote:
Originally Posted by YukiXian View Post
Were you'f got that skill from?
And what about the Status Effect?
I actually have had that skillID for a while, I seriously guessed that one.
The status effect I just used one that isn't in use already.
11/30/2008 16:30 Ultimatum#15
Nice work tao =D