RATDOG/_module/nss/ra_spbook_zana.nss
Jaysyn904 6c78e38de8 Area & Encounter work. Added override kobold skins.
Area & Encounter work.  Added override kobold skins.  Remade "Gorgon Den".  Setup spawning in "Gargoyle Den".   Setup spawning in "City of Baleas: Wizard's Tower".  Added CODI AI to more creatures & NPCs.
2022-12-04 23:14:34 -05:00

109 lines
5.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//::///////////////////////////////////////////////
//:: Zaraphia's Spellbook
//:: ra_spbook_zara.nss
//:: Copyright (c) 2021 Project RATDOG
//:://////////////////////////////////////////////
/*
For Wizards:
Produces scrolls for he following spells:
daze, detect magic, flare, ghost sound, light,
mage hand, prestidigitation, read magic, feather fall,
identify, mage armor, shield, sleep, alter self,
invisibility, mirror image, fireball, haste
burning hands, chill touch, mage armor, summon
monster I, blindness/deafness, ghoul touch, knock,
Melfs acid arrow, dispel magic, slow
For other Arcane magic users: Grants XP
For PCs w/ UMD: Grants XP
*/
//:://////////////////////////////////////////////
//:: Created By: Jaysyn
//:: Created On: 20221202
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "prc_class_const"
void main()
{
object oPC;
object oItem;
int nEvent =GetUserDefinedItemEventNumber();
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
oPC = GetItemActivator();
oItem = GetItemActivated();
int nLevel = GetHitDice(oPC);
int nLearnChance = (15 * GetAbilityModifier(3, oPC));
int nUmd = GetSkillRank(SKILL_USE_MAGIC_DEVICE,oPC, TRUE);
int nWiz = GetLevelByClass(CLASS_TYPE_WIZARD, oPC);
int nArc = GetLevelByClass(CLASS_TYPE_BARD, oPC)
+GetLevelByClass(CLASS_TYPE_SORCERER, oPC)
+GetLevelByClass(CLASS_TYPE_BEGUILER, oPC)
+GetLevelByClass(CLASS_TYPE_DREAD_NECROMANCER, oPC)
+GetLevelByClass(CLASS_TYPE_DUSKBLADE, oPC)
+GetLevelByClass(CLASS_TYPE_HEXBLADE, oPC)
+GetLevelByClass(CLASS_TYPE_WARMAGE, oPC)
+GetLevelByClass(CLASS_TYPE_WARLOCK, oPC)
+GetLevelByClass(CLASS_TYPE_DRAGONFIRE_ADEPT, oPC)
+GetLevelByClass(CLASS_TYPE_SHADOWCASTER, oPC);
if (nWiz >= 1)
{
FloatingTextStringOnCreature("You dig through the bandit's spellbook to find some new spells.",oPC);
//:: Spawn scrolls
if( d100() < nLearnChance - 5) {CreateItemOnObject("nw_it_sparscr112",oPC);} //:: Burning Hands scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("prc_scr_1137",oPC);} //:: Chill Touch scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("nw_it_sparscr104",oPC);} //:: Mage Armor scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("nw_it_sparscr105",oPC);} //:: Summon Creature I scroll
if( d100() < nLearnChance - 10) {CreateItemOnObject("nw_it_sparscr211",oPC);} //:: Blindness / Deafness scroll
if( d100() < nLearnChance - 10) {CreateItemOnObject("nw_it_sparscr209",oPC);} //:: Ghoul Touch scroll
if( d100() < nLearnChance - 10) {CreateItemOnObject("nw_it_sparscr216",oPC);} //:: Knock scroll
if( d100() < nLearnChance - 10) {CreateItemOnObject("nw_it_sparscr202",oPC);} //:: Melf's Acid Arrow scroll
if( d100() < nLearnChance - 15) {CreateItemOnObject("nw_it_sparscr309",oPC);} //:: Fireball scroll
if( d100() < nLearnChance - 15) {CreateItemOnObject("nw_it_sparscr301",oPC);} //:: Dispel Magic scroll
if( d100() < nLearnChance - 15) {CreateItemOnObject("nw_it_sparscr313",oPC);} //:: Slow scroll
if( d100() < nLearnChance - 0) {CreateItemOnObject("nw_it_sparscr003",oPC);} //:: Daze scroll
if( d100() < nLearnChance - 0) {CreateItemOnObject("x1_it_sparscr001",oPC);} //:: Flare scroll
if( d100() < nLearnChance - 0) {CreateItemOnObject("nw_it_sparscr004",oPC);} //:: Light scroll
if( d100() < nLearnChance - 0) {CreateItemOnObject("prc_scr_945",oPC);} //:: Mage Hand scroll
if( d100() < nLearnChance - 0) {CreateItemOnObject("prc_scr_957",oPC);} //:: Read Magic scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("nw_it_sparscr106",oPC);} //:: Identify scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("x1_it_sparscr103",oPC);} //:: Shield scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("nw_it_sparscr108",oPC);} //:: Sleep scroll
if( d100() < nLearnChance - 10) {CreateItemOnObject("prc_scr_1431",oPC);} //:: Alter Self scroll
if( d100() < nLearnChance - 5) {CreateItemOnObject("nw_it_sparscr207",oPC);} //:: Invisibility scroll
if( d100() < nLearnChance - 10) {CreateItemOnObject("prc_scr_1164",oPC);} //:: Mirror Image scroll
if( d100() < nLearnChance - 15) {CreateItemOnObject("nw_it_sparscr312",oPC);} //:: Haste scroll
}
else if (nArc >= 1)
{
GiveXPToCreature(oPC,(2000/nLevel));
FloatingTextStringOnCreature("You read the book, which provides you valuable arcane knowledge, the equivalent of hard-earned experience.",oPC);
}
else if (GetHasSkill(SKILL_USE_MAGIC_DEVICE,oPC))
{
GiveXPToCreature(oPC,((300+(nUmd*12))/nLevel));
FloatingTextStringOnCreature("You read the book, but not being an arcane spellcaster, you find much of it incomprehensible.",oPC);
}
else
{
FloatingTextStringOnCreature("You can't make heads or tails out of this book.",oPC);
}
}
}