| Code: |
This is another one of my tutorials for POL emulator. I am working with the 95 version of POL. If you can make POL 97 work then you are probably not in need of this tutorial. On the other hand, for those beginning, since 95 is the easiest install and release I suggest you go with that one.
--- How To Make A Custom Spell ---
Step One:
1. Navigate to your POL installation and open pkg\skills\spells.
2. Find ‘spells.cfg’ and open it with your favorite text editor.
3. Scroll all the way to the bottom.
4. Insert this code between the lines, it is probably best if you hand type it for memory purposes.
_____________________________________________________________
Spell 70
{
SpellId 70
Name Crimson Tide
Script crimsonTide
Circle 8
Animation 0x22
PowerWords Alchendor Manifest
Val 10
}
Spell 170
{
SpellId 170
Name Crimson Tide
Script crimsonTide
Circle 8
Animation 0x22
PowerWords Alchendor Manifest
Reagent bloodmoss
Reagent bloodmoss
Reagent bloodmoss
Reagent spidersilk
}
_____________________________________________________________
I will give a brief explanation of what we just did. First off the ‘spell 70 and 170’ is really simple. I figured the best place to start a new spell would be with 70, it leaves a safe gap from 64, which is the last registered spell. Also we use 170 because if you look above 64 also has 164 ect. This is to differ from spells and scrolls, one uses reagents the other does not.
SpellId Follows the same procedure.
Name Name of the spell.
Script Script that is ran in the pkg\skills\spells folder.
Circle Basically spell difficulty found in the config folder.
Animation Animation the player performs when casting.
PowerWords Words spoken over the players head when cast.
Val Point value?
Reagent Reagents used in the spells section.
Step Two:
1. Next we head off to pkg\items\magic.
2. Open itemdesc.cfg.
3. Insert the code between the lines at the bottom of the document.
_____________________________________________________________
Item 0x5000
{
Name crimsontidescroll
Desc Crimson Tide Scroll
Script scroll
Spellid 70
Graphic 7981
Color 1543
VendorBuysFor 100
VendorSellsFor 210
}
_____________________________________________________________
Item All new items must have an id. Custom starts at 0x5000 - 0xFFFF
Name Internal Name: .create crimsontidescroll
Desc What the player sees when clicked once.
Script The script the scroll runs when used.
Spellid The spell id we setup earlier.
Graphic The picture id refered to in UO.
Color The hue of the object.
VendorBuysFor How much the scroll sells for.
VendorSellsFor How much the vendor sells it for.
Step Three:
Now it is time to program the spell. Earlier we told the scripts that the spell was going to access crimsonTide. There is a reason for this. In the pkg\skills\spells folder you will find the names of many different spells. This is because they are the scripts that run when the spell is cast or a scroll is double clicked in game. So.
1. Navigate to pkg\skills\spells folder.
2. Make a new file called ‘crimsonTide.src’ this will be our source code.
3. Insert the code in between the lines and save the file.
_____________________________________________________________
include "summon";
include "include/spellRestrictions";
program crimson_tide( parms )
var circle := 8;
var delivery := "indirect";
var noto := "neutral";
var result := maincast(parms, delivery, circle, noto, 61);
if(result == 0)
return;
endif
var caster := result[1];
var cast_on := result[2];
summon_creature( caster, 8, "summonedbloodelemental", cast_on );
endprogram
_____________________________________________________________
AHHH!!! May very well be the fist words out of your mouth. Let me explain what this spell does. It summons an elemental that we will create in a moment. I will very briefly explain the code from top to bottom. It is your job to learn the coding part, which a lot can be learned from studying this file and Racalac’s E-Script guide located in your DOCs folder. A good way to learn may be to study and compare this code.
1. Include the summoning scripts.
2. Include the folder scripts\include and the spellresctrictions.inc file.
3. Setup our program.
4. Declare our variables including spell circles.
5. If we successfully cast the spell then summon the creature and set its master.
6. End our custom program to save memory.
Step Four:
If you check the code above you will see that we are summoning a ‘summonedbloodelemental’. If you ask, where do we put that, you asked the right question. This creature does not exist at the moment. So we need to create it. We are going to put it with the rest of the NPCs.
1. Navigates to your CONFIG folder.
2. Open ‘npcdesc.cfg’.
3. Insert the code between the lines at the bottom of ‘npcdesc.cfg’.
_____________________________________________________________
NpcTemplate summonedbloodelemental
{
Name a blood elemental
script spellKillPCs
ObjType 0x10
Color 37
TrueColor 37
Gender 0
STR 615
INT 515
DEX 185
HITS 615
MANA 515
STAM 185
MoveMode L
MagicResistance 100
Tactics 100
Wrestling 100
Magery 110
evaluatingintelligence 100
cast_pct 95
num_casts 45
spell magicArrow 5
spell paralyze 5
spell curse 5
spell harm 5
spell poison 5
spell fireball 10
spell lightning 10
spell eBolt 10
spell explosion 10
spell fstrike 10
spell meteorSwarm 10
spell manaDrain 5
spell manaVamp 10
AttackSpeed 40
AttackDamage 9d9
AttackAttribute Wrestling
AttackHitSound 0x119
AttackMissSound 0x239
deathsound 0x11b
damagedsound 0x11a
idlesound1 0x117
idlesound2 0x118
Magicitemchance 100
MagicAdjustment 2
AR 45
lootgroup 68
dstart 10
provoke 85
corpseitm blood
corpseamt 1
CProp noloot i1
cprop nocorpse i1
CProp Karma i-37
CProp Fame i37
CProp Equipt sbackpack
AttackHitScript :combat:wrestlingHitScript
OpensDoors 1
}
_____________________________________________________________
This script pretty well speaks for itself, though; my favorite part is at the bottom. OpensDoors 1. This is great for people trying to run from it, it will open the door going after them.
Last Step:
Navigate to your scripts folder and right click ecompile.exe then click make shortcut, drag that to your desktop or something. Then double click it after all files are saved. This will compile your .src scripts to something the server can read. Anytime you change .src scripts you need to compile if you change a .inc or .cfg there is no need to compile.
Tip: When testing scripts that you compiled there is no reason to restart the server, simple just type .unloadall. Now, go ingame and type .create crimsontidescroll.
Tip: To edit spell circle difficulty open, config\circles.cfg. :p
Happy spell spamming from your friendly druid.
By: Runtest
|