The Tutorial

    What is a Script

    The first thing to know is what exactly a script is. A scripts is a file that gives instructions to UOX and has the extension .scp .  They are easily edited in any word processing program or you can download a script editor. I use Microsoft word pad to do my scripting.

    Getting Started

    UOX comes with a lot of good documentation and I don't have something explained in here you can just read some of them, however my suggestion is to just dig right in! The first script you will probably want to edit is you server.scp. It is in you main UOX directory with all of the scripts.

    Editing your Server.scp

    You should know that 0=false and 1=true and //denotes a comment and has no effect on the script
     Here is the file, I took this from the uox docs: 

SECTION SERVER
{

CRASH_PROTECTION 0 // 0 = crash protection, 1 = save on crash, 2 = reload on crash (LEAVE AT 0!!!)
SKILLCAP 700 // total number of skill points that caps the player at
STATCAP 999 // total stat cap, works in conjunction with racial cap. If this is less than the sum of the
// racial cap, then hitting this stops you raising skills. If higher than sum of racial cap
// you hit the individual limits first
USESPECIALBANK 0 // 1 turns Region banks on. With region banks, you have a global gold bank available, but
// you also have a regional item bank. Thus, items in your Britain bank are only available in
// Britain, not in Minoc
SPECIALBANKTRIGGER WARE // Trigger word for opening your special bank. Default is "I wish to open my ware bank"
SAVE_PER_LOOP -1 // set to -1 or 0 disables it, any other number is the number of items/npcs to save in a loop
DECAYTIMER 666 // Time, in seconds, for an item to decay
PLAYERCORPSEDECAYMULTIPLIER 4 // multiply this by the decaytimer and that's the time for player corpses to decay
LOOTDECAYSWITHCORPSE 0 // if this is 0, then loot won't decay till after corpse does, otherwise decays at the same time
INVISTIMER 60 // number of seconds person remain visible for when Invisibility is cast on them
SKILLDELAY 5 // number of seconds between usage of a skill
SKILLLEVEL 5 // This value multiplied by an item's minskill value indicates the maximum skill diff to create
OBJECTDELAY 1 // number of seconds between using items
GATETIMER 30 // Number of seconds that a gate remains open
SHOWDEATHANIM 1 // If 1, it shows the death animation upon death
GUARDSACTIVE 1 // If 1, guards are active in guarded regions
ANNOUNCE_WORLDSAVES 1 // If 1, then all players are told when the world is saving
BG_SOUNDS 2 // Must be 1 - 10, Higher the number, less chance of background sounds
WWWACCOUNTS 0 // Enable/Disable auto-creation of accounts through web pages(?)
ARCHIVEPATH // Path to the directory where world will be archived
BACKUP_SAVE_RATIO 5 // Every # time the world is saved it is archived
UOXBOT 0 // No longer used anymore, leave as the default
POISONTIMER 90 // Number of seconds before Poison will wear off
JOINMSG 1 // If 1, then when a user joins, it tells everyone a join message
PARTMSG 1 // If 1, then when a user leaves, it tells everyone a leave message
LOG 1 // If 1, server logs some critical messages
ROGUE 1 // Turns on thieving if 1
WEATHERTIME 60 // Number of seconds between weather updates (not used, will be in future)
SHOPTIME 60 // How often (in seconds) shops spawn with the shops turned on
SHOWLOGGEDOUTPCS 1 // If 1, then Gms see logged off PCs
CHAR_TIME_OUT 100 // Number of seconds before PC times out (when logging off)
MAXSTEALTHSTEPS 10 // Maximum number of steps take able with stealth engaged
RUNNINGSTAMINASTEPS 15 // Number of steps you can run before stamina starts to drop
BOAT_SPEED 0.750000 // How often (in seconds) boats move
HTML 0 // If 0, then turned off, otherwise # of secs between HTML generation
CUT_SCROLL_REQUIREMENTS 1 // If 1, then scrolls take less skill than casting a spell out of your spellbook
PERSECUTION 1 // If 1, then a ghost can attack a living being to drain mana
AUTO_ACCT 1 // If not 0, then reloads accounts every 3 world saves
AUTO_CREATE_ACCTS 0 // If 1, new account made when not found on login
MSGBOARDPATH // Path to msgboard files, defaults to same dir as UOX
MSGPOSTACCESS 0 // If 0, no one but GMs post, otherwise everyone can
MSGPOSTREMOVE 0 // If 0, no one but GMs can remove, otherwise everyone can
MSGRETENTION 0 // Length of time to retain messages (0 indefinite), not sure on measurements
ESCORTACTIVE 0 // If 1, then escort quests are active (on board)
ESCORTINITEXPIRE 0 // Length of time that the escort is summoned for
ESCORTACTIVEEXPIRE 0 // Length of time in seconds before the escort quest expires on board
ESCORTDONEEXPIRE 0 // Length of time in seconds for which escort is alive once taken
FOOTSTEPS 0 // 0 is turned off, all else is on
COMMANDPREFIX ' // Sets the command prefix (eg: using ' means you would type 'command)
PORT 2593 // Sets the PORT address the server will be using
}

SECTION SPEED
{

NICE 1 // accepts 0 to 3, 0 is most processor intensive, 2 is default (and nice)
LORDB_LAG_FIX 0 // irrelevant, no longer used
CHECK_ITEMS 0.750000 // How often items are checked for action (in seconds)
CHECK_NPCS 1.000000 // How often NPCs are checked for action (in seconds)
NPC_TILE_CHECK 24 // How far away (in tiles) that NPCs check for intelligence
CHECK_NPCAI 1.000000 // How often the NPCs AI is checked (must be no more than CHECK_NPCS)
CHECK_SPAWNREGIONS 300 // Number of seconds between spawn regions being checked for more spawns
CHECKMEM 3000000 // Doesn't affect anything, leave at default
CACHE_MULS 0 // Setting to 1 loads the statics, tiles and a map cache into RAM, significant speed boost
ACCOUNTFLUSH # // If # is 0, disabled, otherwise, # is mins between flushing
}

SECTION COMBAT
{

MAXRANGE 10 // Maximum range that can be attacked at (not active)
WRESTLESPEED 8 // Speed of wrestling (lower is quicker)
MAX_RANGE_SPELL 10 // Maximum range a spell can be cast at (not active)
MAXDMG 120 // Maximum damage that can be inflicted (not active)
DEATH_ON_THROAT 1 // indicates whether a critical neck hit is fatal (not active)
DIST_TO_POISON 2 // Distance within you can poison (not active)
COMBAT_HIT_MESSAGE 1 // Prints out combat hit messages if 1
MAX_ABSORBTION 20 // maximum amount that can be absorbed via armour
MAX_NON_HUMAN_ABSORBTION 100 // maximum amount that can be absorbed by NPCs
MONSTERS_VS_ANIMALS 1 // If 1, animals and monsters would attack each other
ANIMALS_ATTACK_CHANCE 45 // % chance that a monster will attack an animal
ANIMALS_GUARDED 1 // If 1, then animals are guarded in guard regions
NPC_DAMAGE_RATE 2 // Damage/Rate is the amount of damage that an NPC will sustain
NPC_BASE_FLEEAT 20 // base hp which NPCs flee at
NPC_BASE_REATTACKAT 40 // base hp which NPCs will attack at
ATTACKSTAMINA 0 // Amount of stamina gained (or lost, if negative) on attacking. Must have
// equal to at least the absolute value of this to attack as well
}

SECTION VENDOR
{

SELLBYNAME 0 // if 1, then item is sold by name rather than ID (doesn't work correctly)
SELLMAXITEM 7 // maximum number of items you can sell
TRADESYSTEM 0 // advanced trade system, if 1, then goods prices do fluctuate (based on GOOD settings)
RANKSYSTEM 0 // if 1, then difficulty is graded and varying quality pieces are made
}

SECTION REGENERATE
{

HITPOINTS_REGENRATE 8 // Number of seconds before 1 hp regenerates
STAMINA_REGENRATE 3 // Number of seconds before 1 stam point regenerates
MANA_REGENRATE 5 // Number of seconds before 1 mana point regenerates
ARMOR_AFFECT_MANA_REGEN 1 // If 1, enables meditation. Higher damage, less the speed regen rate
}

SECTION HUNGER
{

HUNGERRATE 1000 // How often you get hungrier in seconds
HUNGER_DAMAGE 2 // How much health is lost when you are starving
HUNGER_DAMAGE_RATE 60 // How often you lose health when you are starving
}

SECTION RESOURCE
{

MINECHECK 2 // Dictates areas that can be mined. 0 is anywhere, 1 is mountains,floors 2 is
// those areas that are flagged as mining regions
ORE_PER_AREA 10 // Amount of ore in an area
ORE_RESPAWN_TIME 600 // How long it takes to respawn ore, in seconds
ORE_RESPAWN_AREA 0 // How many ore areas there are in the world
LOGS_PER_AREA 3 // How many logs are in the area
LOG_RESPAWN_TIME 600 // How long it takes for the logs to respawn
LOG_RESPAWN_AREA 10 // Number of log areas there are in the world
}

SECTION REPSYS
{

MURDER_DECAY 1000 // How quickly murder rate decays in number of seconds
MAXKILLS 5 // Maximum number of kills before you go red
CRIMINAL_TIME 600 // Time in seconds that you are grey when criminal
}

SECTION TRACKING
{

BASE_TRACKING_RANGE 10 // Minimum distance that a person can track
MAX_TRACKING_TARGETS 20 // Maximum number of targets that can be tracked
BASE_TRACKING_TIME 30 // Minimum time you can track for
TRACKING_MESSAGE_REDISPLAY_TIME 2 // How often the tracking info updates in seconds
}

SECTION BEGGING
{

BEGGING_RANGE 3 // How close you have to be to beg
BEGGING_TEXT0 Could thou spare a few coins?
BEGGING_TEXT1 Gold or live !
BEGGING_TEXT2 I have a family to feed, think of the children.
}

SECTION FISHING
{

BASE_FISHING_TIME 100 // Minimum amount of time needed for fishing
RANDOM_FISHING_TIME 50 // Random amount of time on top of the base time
}

SECTION SPIRITSPEAK
{

SPIRITSPEAKTIMER 300 // How long Spirit Speak lasts for (in seconds)
}

SECTION TIME_LIGHT
{
DAY 799
HOUR 1
MINUTE 42
AMPM 1
MOON1UPDATE 0
MOON2UPDATE 0
MOON1 7
MOON2 5

DUNGEONLIGHTLEVEL 7 // Light level for dungeon
WORLDFIXEDLEVEL 0 // This must be 255 for day/night cycling to work, fixed world light level
WORLDCURLEVEL 14 // current light level in the world
WORLDBRIGHTLEVEL 3 // brightest light setting for world
WORLDDARKLEVEL 25 // darkest setting the light can be
SECONDSPERUOMINUTE 5 // number of real seconds per UO minute
}

EOF

    Making an Item

    We will make a smith's hammer of vanquishing for this tutorial. First open items.scp and then search for smith's hammer, after you have found the item highlight all of this and hit ctr-c to copy it. Then scroll down to the bottom of the file and paste it with ctr-v. It should look like this: I will tell you wnat everything does in comments and what to change it to.

SECTION ITEM 98 //Change this to 9000 just so it doesn't bother the other items
{
NAME a smith's hammer // This is the name change to a magic smith's hammer and add
NAME2 a smith's hammer of vanquishing //The name seen when ided
ID 13E4 //The id found with inside UO that determines what the item is displayed as
LAYER 1 //Where the item is equipped 1 is a single handed weapon 
ITEMHAND 1 //This probably isn't needed it says the same thing layer does
LODAMAGE 6 //The least damage the weapon will do, change it to 15
HIDAMAGE 18 //The most damage the weapon will do, change it to 27
HP 50 //How much hp the item has
DECAY //The weapon will decay if left on the ground, NODECAY would make the item stay forever
VALUE 25 //How much the item will sell for
RESTOCK 10 //How much of the item a vendor will carry by default
STR 30 //How much str is needed to wield the weapon you can put any stat here if you want
SPD 30 //How fast the weapon is higher is better
WEIGHT 800 //How much in stones /10 the weapon weighs, this weighs  8 stones
GOOD 27 //used for trading
ALIGNMENT 0 //You can delete theese, UOXdev said you needed them, you don't
MODIFY1 0
MODIFY2 0
MODIFY3 0
MODIFY4 0
MODIFY5 0
FAME 0 //Don't delete anything after this
}

    There you just made your first item you can check it out by typing 'additem 9000 in the game be sure to read the docs for further info.

    Making an NPC 

    For this tutorial we will make the guards have your smith's hammer of vanquishing instead of halberds. :) Open up npc.scp and go change your guards.

SECTION NPC 2
{
NAMELIST 2 //What list the name is chosen from
TITLE the guard //What title the npc has
ID 0191 //What body found in Inside UO the npc has this is a human male
ITEM 15067 //?
HAIRCOLOR 15 //What color from colorlists.scp the npc's hair is 
SKINLIST 16 //What color the skin is from colorlists.scp
SPEECH 24 //What speech file the npc used
TAMING 1100 //How much taming skill is needed to tame it
STR 1000 1500 //Its min and max strength
DEX 85 100 //min and max dex
INT 450 500 //min and max int
KARMA 10000 //how much karma the npc has
FAME 10000 //How much fame the npc has
PARRYING 990 1000 //It's min and max parrying skill
MAGICRESISTANCE 990 1000 //It's min and max magic resist level
TACTICS 990 1000 //It's min and max tactics level
WRESTLING 990 1000 //It's min and max wrestling level
DAMAGE 1000 1000 //It's min and max damage
DEF 100 //How much AR it has
BACKPACK //you need this but not sure exactly what it does
ITEM 44 //Plate mail
ITEM 46 //Plate mail
ITEM 48 //Plate mail
ITEM 49 //Plate mail
ITEM 102 //Halberd change to 9000
FX1 -1 //I think teleport animations
FY1 -1
FZ1 -1
FX2 15
NPCAI 4 //What AI it uses in this case guard
RUNS //This npc has a fast speed
}

There you have it your guards now wield smith's hammers of vanquishing, yay!

    That should get you started scripting, have fun making items and npcs, I will put some tables down here for you to use as reference you might want to print them out, they are very useful. My next set of tutorials will include triggers and spawns. 

Item Types

0 Default type
1 Container/backpack
moreb1 > 0 Magically trapped
2 Opener for order gate
3 Order gate
4 Opener for Chaos gate
5 Chaos gate
6 Teleporter rune, acts like teleport was cast
7 Key
8 Locked container
moreb1 > 0 Magically trapped
9 Spellbook
10 This opens a map based on the serial num of the item
11 A book:Entry in misc.scp: %li", 
More1 => MSB of serial (most significant byte)
More2 => NSB of serial (next significant byte)
More3 => NSB of serial
More4 => LSB of serial (least significant byte)
12 Unlocked door
13 Locked door
14 Food item
15 Magic wand
MoreX => Circle
MoreY => Spell within circle
MoreZ => Charges left
16 Resurrection object
17 Full mortar/alchemy, more info at a later date
18 Enchanted item that displays a random message
19 Potion
35 itemID 0x14F0 => Townstone deed, will make townstone
otherwise => Townstone, use to find out information on the town
50 Recall rune
MoreX => Target X 
MoreY => Target Y 
MoreZ => Target Z
51 Start Gate *guess at info*
MoreX => Target X 
MoreY => Target Y 
MoreZ => Target Z
Ends up going into the gatex[], gatey[], gatez[] array
52 End Gate *guess at info*
MoreX => Target X 
MoreY => Target Y 
MoreZ => Target Z
Ends up going into the gatex[], gatey[], gatez[] array
60 Object Teleporter
MoreX => Target X 
MoreY => Target Y 
MoreZ => Target Z
61 Item Spawner 
MoreX => Item Number to spawn
MoreY => Respawn minimum time
MoreZ => Respawn maximum time
62 Monster/NPC Spawner
Amount => Number to spawn
MoreX => Npc Number to spawn
MoreY => Respawn minimum time
MoreZ => Respawn maximum time
63 Item Spawner Container
moreb1 > 0 Magically trapped
MoreX => Item Number to spawn
MoreY => Respawn minimum time
MoreZ => Respawn maximum time
64 Locked Item Spawner Container
moreb1 > 0 Magically Trapped
MoreX => Item Number to spawn
MoreY => Respawn minimum time
MoreZ => Respawn maximum time
65 Unlockable Item Spawner Container
moreb1 > 0 Magically Trapped
MoreX => Item Number to spawn
MoreY => Respawn minimum time
MoreZ => Respawn maximum time
69 Area spawner
More3 => X +/- offset
More4 => Y +/- offset
Amount => Amount to spawn
MoreX => Npc to spawn
MoreY => Minimum respawn time
MoreZ => Maximum respawn time
80 Single Use advancement gate
MoreX => entry in advance.scp to use
81 Multi Use advancement gate
MoreX => entry in advance.scp to use
82 Monster Gate
MoreX => entry in npcs.scp to change into
83 Race Gate
MoreX => Race to turn into
MoreY => 0 single use, 1 repeated use
85 Damage Object
MoreX + MoreY => Minimum Damage
MoreX + MoreZ => Maximum Damage
86 Sound Object
MoreX => First half of sound to play
MoreY => Second half of sound to play
MoreZ => Percent chance of sound playing
87 Trash Container
88 Sound Object plays when someone is near
MoreX => Sound effect to play
MoreY => Radius
MoreZ => Probability
100 Looks like hide/unhide object More detail to come later
101 Morph object
MoreX => Body to morph into
Changes to type 102
102 Unmorph object
unmorphs back to body before using it as type 101
Changes to type 101 again
103 Army Enlistment object
MoreX => Army to enlist in
104 Teleport Object
MoreX => Target X
MoreY => Target Y
MoreZ => Target Z
105 Drink Object
117 Backpack????
125 Escort NPC Spawner
More3 => X +/- offset
More4 => Y +/- offset
Amount => Amount to spawn
MoreX => Npc to spawn
MoreY => Minimum respawn time
MoreZ => Maximum respawn time
181 Fireworks wand
MoreX => Number of charges
185 Smoking object
MoreX => Duration in secs
202 Guildstone deed
203 Opens housing gump
217 Player Vendor Deed 
255 Worldforge type

Spell Table:

Bit dec Spell
1 1 MagicArrow
2 2 Harm
3 4 Clumsy
4 8 FeebleMind
5 16 Weaken
6 32 Fireball
7 64 Curse
8 128 Lighting
9 256 Paralyze
10 512 MindBlast
11 1024 Engerybolt
12 2048 Explosion
13 4096 FlameStrike
14 8192 Dragon Breath - 20 % of source health
15 16384 Dragon Breath - 40 % of source health
16 32768 Dragon Breath - 60 % of source health


UOX COLOR CHART

00 00 = DEFAULT
00 01 = SOLID BLACK
09 6d = GOLD
09 6c = DARK GREY
06 6d = DARK RED
05 99 = DARK GREEN
08 4e = LIME GREEN
05 4a = TEAL GREEN
05 44 = BLUE-GREEN
08 4c = MEDIUM BLUE
05 2f = DARK BLUE
08 4d = YELLOW
05 1d = PURPLE BLACK
05 1e = PEARL BLUE
83 F8 = FLESH
Transparent=66 77a
00 02 - 03 E9 Colors you get when using 'DYE without parameters
03 EA - 04 22 Skincolors with dyed undewear
83 EA - 84 22 Skincolors without dyed underwear
04 23 - 04 4D Multicolor
55 55 Transparent only used in items.scp
-------------------------------- This CColors are also used as Hair colors
04 4E -> 04 55 Black
04 56 -> 04 5D Bronze 
04 5E -> 04 65 Gold
04 66 -> 04 6D Yellow Gold
04 6E -> 04 75 Copper
04 76 -> 04 7D Dark Copper
--------------------------------

04 81 - 04 B0 Multicolor
04 B1 -> 04 B9 Red
04 BA -> 04 C2 Red
04 C3 -> 04 CB Red
04 CC -> 04 D4 Blueish Red
04 D5 -> 04 DD Blueish Red
04 DE -> 04 E6 Blue
04 E7 - 05 14 Multicolor
05 15 -> 05 1D Blue
05 1E -> 05 26 Blue
05 27 -> 05 2F Blue
05 30 -> 05 38 Blue
05 39 -> 05 41 Blue
05 42 -> 05 4A Blue
05 4B - 05 78 Multicolor
05 79 -> 05 81 Blueish Green
05 82 -> 05 8A Green
05 8B -> 05 93 Green
05 94 -> 05 9C Green
05 9D -> 05 A5 Brownish Green
05 A6 -> 05 AE Brownish Green
05 AF - 05 DC Multicolor
05 DD -> 05 E5 Brown
05 E6 -> 05 EE Brown
05 EF -> 05 F7 Brown
05 F8 -> 06 00 Brown
06 01 -> 06 09 Brown
06 0A -> 06 12 Reddish Brown
06 13 - 06 40 Multicolor
06 41 -> 06 49 Pink
06 4A -> 06 52 Pink
06 53 -> 06 5B Pink
06 5C -> 06 64 Pink
06 65 -> 06 6D Red
06 6E -> 06 76 Red
06 77 - 06 A4 Multicolor
06 A5 -> 06 AD Greenish Brown
06 AE -> 06 B6 Greenish Brown
06 B7 -> 06 BF Greenish Brown
06 C0 -> 06 C8 Brown
06 C9 -> 06 D1 Brown
06 D2 -> 06 DA Brown
07 09 -> 07 11 Brownish Green
07 12 -> 07 1A Brownish Green
07 1B -> 07 23 Brownish Green
07 24 -> 07 2C Brown
07 2D -> 07 35 Brown
07 36 -> 07 3E Brownish Red
07 3F -> 07 47 Brownish Red
07 48 -> 07 50 Brownish Red
07 51 -> 07 59 Greyish Red
07 5A -> 07 62 Grey with a little red
07 63 -> 07 6B Grey with a little blue
07 6C -> 07 74 Greyish Blue
07 D1 -> 07 D6 Green
07 D7 -> 07 DC Beige
07 DD -> 07 E2 Red
08 35 -> 08 3A Blue
08 3B -> 08 40 Beige
08 41 -> 08 46 Red
08 47 -> 08 4C Blue
08 4D -> 08 52 Yellow - Green
08 99 -> 08 9E Red
08 9F -> 08 A4 Green
08 A5 -> 08 AA Beige
08 AB -> 08 B0 Blue
08 FD -> 09 02 Silver
09 03 -> 09 08 Gold
09 09 -> 09 0E Bronze/Copper
09 61 -> 09 66 Silver
09 67 -> 09 6C Silver
09 6D -> 09 72 Gold
09 73 -> 09 78 Silver-Gold
09 79 -> 09 7E Copper-Gold

Hosted by www.Geocities.ws

1