### NPC Character Definition Example Source: https://github.com/sphereserver/scripts-x/blob/main/npcs/README.txt This is a comprehensive example of a character definition for an NPC. It includes base definitions, fixed properties, tags, resources, events, speech, display settings, expansion settings, GM tools categories, and event triggers for creation and loot. ```plaintext [CHARDEF xxx] //base defs DEFNAME=c_char_defname DEFNAME2=c_old_xx //DEFNAME2 is allowed, but it's recommended to create a new entry in it's respective core/backwards_compatibility_version.scp with c_old_xx=c_char_defname NAME=Some Name ICON=i_xx // chars without icon set will default to i_pet_whisp SOUND=snd_xx //Preferably all chardefs should have sounds //Fixed values' properties and tags. Fixed only, ranges are not allowed here. DAM=15,20 DAMFIRE=20 FACTION=faction_demon // defnames in lowercase BLOODCOLOR=1 TAG.BARDING.DIFF=95.0 //Aversions, resources, etc DESIRES=r_dungeon_doom,t_coin,t_gold,t_gem,t_wand,t_potion,t_scroll,t_reagent AVERSIONS=t_trap,r_civilization RESOURCES=1 i_reag_blackmoor //TEVENTS TEVENTS=e_carnivores //TSPEECH TSPEECH=spk_human //ResDisp* RESDISPDNID=c_elemental_air RESLEVEL=2 RESDISPDNHUE=55 //Expansion settings ERALIMITLOOT=1 ERALIMITGEAR=1 ERALIMITPROPS=1 //GM Tools categories CATEGORY=Monsters SUBSECTION=Elementals DESCRIPTION=Elemental, Example ON=@Create //Even with fixed size, brain, color, fame/karma skills and stats must be added in @Create //Brain first NPC= //Fame/karma FAME=10000 KARMA=-10000 //Color, if required COLOR= //Stats STR={100 150} DEX={120 130} INT={15 20} MAXHITS={120 160} //From here, excepting skills, can be placed here for random values or in the [CHARDEF ] block for fixed values. //Resistances //Resphysical is also required, armor can be added for backwards but having armor doesn't mean that resphysical isn't required and viceversa. RESPHYSICAL={55 65} RESFIRE={30 35} RESCOLD={40 45} RESPOISON=0 // Any property with a value of 0 should not be added, just remove the whole line //Damages (if not fixed, fixed values are placed above) //DAMPHYSICAL can be added but if it's not present it will be defaulted to RESPHYSICAL = 100 - (RESFIRE+RESCOLD+RESPOISON+RESENERGY) DAMCOLD={30 35} //Skills MAGERY={350 500} MEDITATION={700} //RANGES should NEVER be added for a single value, this should be MEDITATION=700 //Other not-fixed properties HitLeechLife={35 40} ITEM=xx //Wearables (clothes, weapons, light sources, hairs, horns...) //Only wearables, to prevent loot items from being saved, loaded from/to save files, checked in rescount, forcont, etc over and over and being snopped/stolen? in undefined situations ON=@CreateLoot // loot behaviour, created after the char dies ITEM=xxx ON=@NPCRestock//Use this trigger for BUY/SELL templates only on vendors ITEM=xx ``` -------------------------------- ### Initialize DataTable for Clients Table Source: https://github.com/sphereserver/scripts-x/blob/main/web/outputs/clients.html Initializes a DataTable on the element with ID 'table-clients'. This enables features like sorting, searching, and pagination for the client data. It's typically used to enhance the interactivity of large tables. ```javascript $(document).ready(function () { $("#year-text").text((new Date).getFullYear()); $('#table-clients').DataTable({ order: [[0, 'desc']], search: true, pagging: true }); }); ``` -------------------------------- ### Initialize DataTable for Chars Table Source: https://github.com/sphereserver/scripts-x/blob/main/web/base/chars.html Initializes a DataTables instance for the character table with sorting, searching, and pagination enabled. This script runs when the document is ready. ```javascript $(document).ready(function () { $("#year-text").text((new Date).getFullYear()); $('#table-chars').DataTable({ order: [[0, 'desc']], search: true, pagging: true }); }); ``` -------------------------------- ### Configure NPC and Player Events in sphere.ini Source: https://github.com/sphereserver/scripts-x/blob/main/README.md Ensure these events are set in your sphere.ini for the script pack to function correctly. These are typically enabled by default. ```ini // Events related to all NPCs EventsPet=e_npc_generic_event // Events related to all players EventsPlayer=e_player_generic_event,e_player_crafting_event ``` -------------------------------- ### Initialize Items Data Table Source: https://github.com/sphereserver/scripts-x/blob/main/web/base/items.html Initializes a DataTables instance to display item data fetched from a JSON source. Use this to render and manage the item table on the page. ```javascript $(document).ready(function () { $('#table-items').DataTable({ sAjaxSource: '../datas/items.json', bDeferRender: true, columns: [ { items: 'name' } ], }); }); ``` -------------------------------- ### Vendor Configuration Source: https://github.com/sphereserver/scripts-x/blob/main/npcs/README.txt Configuration for vendor NPCs, including gold capacity, current gold, restock behavior, and markup for sales. ```plaintext set VENDCAP for their gold cap and VENDGOLD for setting their current amount on the fly. On each restock they will set VENDGOLD to VENDCAP if VENDGOLD is lower than VENDCAP Restocks are done each 10 minutes by default unless REGION.TAG.RESTOCKVENDORS=30 is set (in tenths of second, 30 = each 3 seconds) (and only for regions) REGION.TAG.NORESTOCK or a TAG.NORESTOCK in the vendor prevents any restock They have a MARKUP value (default = 15) when selling items to players, positive values increases the fee on the final price and negative decreases it. ``` -------------------------------- ### Initialize DataTables for Items Table Source: https://github.com/sphereserver/scripts-x/blob/main/web/base/areas.html Initializes the DataTables jQuery plugin to display item data. It fetches data from 'items.json' and defines the columns to be displayed: name, category, subsection, and description. ```javascript $(document).ready(function () { $('#table-items').DataTable({ ajax: '../datas/items.json', columns: [ { data: 'name' }, { data: 'category' }, { data: 'subsection' }, { data: 'description' }, ] }); }); ``` -------------------------------- ### Initialize DataTables for Guilds Table Source: https://github.com/sphereserver/scripts-x/blob/main/web/outputs/guilds.html Initializes the DataTables jQuery plugin for the guilds table. This enhances the table with features like sorting and pagination. Ensure the table has the ID 'table-guilds'. ```javascript $(document).ready(function () { $('#table-guilds').DataTable({ order: [[0, 'desc']] }); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.