Adding new magics - The Lemon guide

General assistance and guidelines for editing the server side of Soma.

Adding new magics - The Lemon guide

Postby Lovegun » Thu Jun 28, 2012 1:05 pm

Adding Magic

The first thing to do is create a new magic in the DB. To do this go to DBO.Magic.

My advice here is start simple so pick a spell that already exists and give it a new level.
We'll use Dragon Breath for this example as it currently only has 1 level.

Add the following row and key in the remaining values based on the Dragon Breath spell (smid 124)

151 1 Dragon Breath LVL 2

EDITING MAGIC.TBL

Once done go to the magicres folder and open magic.tbl using a hex editor. (Just google for one if you dont have one. I find HXD editor quite good)
Magicres\Magic.tbl

Ok now to anyone new with this don't panic! What you need to do is find the old dragon breath spell. The easiest way to do this is find the hex value of smid 124.
Using the decoder we can easily see that is 7c. Now just search for the hex value 7c and you should find a line like this:

7C 00 00 00 02 00 00 00 01 00 03 00 00 00 12 00 00 00 13 00 00 00 E8 03 00 00 DC 00 00 00 00 00 00 00 01 00 00 00 DD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

If you are struggling to find the end point look for the next starting point i.e. 7D. If you are still confused count the bytes. They are in blocks of 2 bytes so
27 lots of 4 digits or 54 bytes in total. (A byte being 2 digits).

Copy the line of hex and paste it at the bottom of your table after the last byte.

The first byte is the hex value of your magic id so the smid of dbo.magic in the DB.

If you're like me and struggle with hex-decimal conversion the following link will help.

http://home.paulschou.net/tools/xlate/

Using the decoder you can see that the decimal of 97 is 151 which in this case is Dragon Breath LVL 2

97 00 00 00 02 00 00 00 01 00 03 00 00 00 5C 00 00 00 19 00 00 00 E8 03 00 00 DC 00 00 00 00 00 00 00 01 00 00 00 DD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

This data controls the animations for the magic. Through trial and error you can create variations on existing animations.

Note the changes above. I have replaced the 12 with 5c and the 13 with 19

These 2 changes both affect the animations displayed.

These both relate to the magic being casted i.e before it is fired.

The first byte is the main animation
5C = blue magic lvl2 animation
54 = Blue magic lvl3 animation
55 = Blue magic lvl4 animation

The second byte is a smaller animation that occurs at the same time i.e.

03 = White circle of sparkles (White magic)
19 = Blue dots seen when using flute magics

Finally there is the byte "DD" in the example above.

This represents the magics animation as it leaves your player. So DD in this example is the dragon breath "phoenix"

There is alot of room for trial and error here. I will at some point expand this guide to list each of the codes for the animations.

There are also variations for spells like heal wind and weakening where things become a little more confusing. Again i'll expand on this later.

The last thing you need to do in here is amend the row count. This is held in offset 0 and needs to be incremented by 1 for each new magic you add.


EDITING SPR'S

Using the above as reference you should now be able to go and edit the SPR's.

The first 148 bytes of the SPR's is the header and the last 4 bytes is the row count.

Everything in between is a reference to the icons displayed for each of your magics.

Magic-S is the sunken button you see when you add it onto your belt Magic-B is the
normal button you see when you press F11

Both of these SPR's work in the same way.

What you need to do is change your hex editor to display 24 bytes per row. Each SPR line is 24 bytes so it makes the job far easier.
Now starting at the bottom (Ignoring the last 4 bytes which is row count) count backwards from your last magic ID (150 chain lightening)
upto the row for the magic you want to use the icon for.

So in this case we count up 26 rows to line 124 (124+26 = 150 = highest current smid before you added new one)
In SPR\Magic-S.SPR you should see this line. Copy and paste the line at the end of your file just before the 4 byte row count.
2E 00 00 00 71 02 00 00 32 00 00 00 9F 02 00 00 61 00 00 00 71 02 00 00
Edit the row counts at offsets 14 and 3864 incrementing each by 1.

In SPR\Magic-B.SPR repeat the above and you should find line
56 00 00 00 D9 02 00 00 39 00 00 00 0F 03 00 00 6F 00 00 00 D9 02 00 00

Remember to increment the row counts here too.

Now assuming you have done the above and saved all of your edits you should have a
Dragon Breath lvl2 pointing to the Dragon Breath Icons in the SPR files.

If for any reason the icons are not displaying the problem lies in the SPR's. If your icons are there then the problem lies in the DB or magic.tbl

Remix has half finished an SPR editor. Once you have finished editing the SPR's it is useful to load them up into this editor just to check the edits have worked.

Any questions or amendments by all means post below.

Credit goes out to

Rauban - For getting me started on this! (P.S. if anyone remembers Davina_ from rauban server say hi :p)
Miser - For putting up with all my whinging
Remix - For being Remix
Finito - For giving me all the offsets
and finally Ramy.....just for being there :)


All the best Lovegun :)
Lovegun
SD One Star
SD One Star
 
Posts: 17
Joined: Thu Jun 28, 2012 1:04 pm

Re: Adding new magics - The Lemon guide

Postby phoenixgolden » Thu Jun 28, 2012 3:02 pm

nicee :)
Phoenix.

Image

Human @Inca SomaDev (retired)
phoenixgolden
SD Pro 5 Star
SD Pro 5 Star
 
Posts: 1170
Joined: Sat Oct 08, 2011 9:24 pm

Re: Adding new magics - The Lemon guide

Postby Lovegun » Thu Jun 28, 2012 4:08 pm

Ok an addition already the "DC" code in the hex line also represents an animation for the post cast. Again until i've compiled a full list it's hard to define what each of the codes represents.

Some fun for you all. The following simulates lvl1 Blue Throwing knives ;)

magic.tbl
9C 00 00 00 05 00 00 00 03 00 03 00 00 00 4B 00 00 00 09 00 00 00 E8 03 00 00 D5 00 00 00 00 00 00 00 01 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

dbo.magic
156 1 Throwing Knives 3 1 0 3 1 1 8 1 999 0 0 0 5 5 -100 100 DECIMATES ALL! 0 100 100 6

You can point them to any icon you wish. (You may want to reduce their damage if you ever decide to use them. I was having fun wiping out vast hoardes of mobs)
Lovegun
SD One Star
SD One Star
 
Posts: 17
Joined: Thu Jun 28, 2012 1:04 pm

Re: Adding new magics - The Lemon guide

Postby Lovegun » Mon Jul 09, 2012 2:52 am

I've made a start (apologies for the descriptions).

I'll add to this when i get more time.


03 - White ring
04 - White slash
05 - White explosion
06 - Healing ring
07 - Large purple skull
08 - Small purple ring at feet
09 - LVL1 Blue magic cast
0A - Pinky purple explosion
0B - Bigger brighter pinky purple explosion
0C - Water spell
48 - Light arrow, the arrow
D2 - Sandy animation as if in sand storm.
D9 - Puffy yellow explosion effect from Death Blow spell
E0 - Lightening (Not from sky)
5C - LVL2 Blue magic cast
54 - LVL3 Blue Magic Cast
55 - LVL4 Blue magic cast
E2 - Crystal effect magic (floor up) from death blow
CA - Death Globe electric orb (ball of electric bolts)
76 - Red glowing cross
D3 - Pinky yellow fire effect
D4 - Ball of white ice\smoke
D1 - Circle of Dust
DD - Dragon Breath Phoenix
Lovegun
SD One Star
SD One Star
 
Posts: 17
Joined: Thu Jun 28, 2012 1:04 pm

Re: Adding new magics - The Lemon guide

Postby rhyse » Thu May 09, 2013 6:08 pm

sorted thanks
rhyse
SD Three Star
SD Three Star
 
Posts: 112
Joined: Sat Jun 06, 2009 2:37 pm


Return to Server Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron