HoS_PRC8/_mod/_module/nss/hos_pcsetup_h.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

321 lines
15 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
// hos_pcsetup_h - various functions used for initializing and setting up
// equipment on PCs. By Jeremy "Diabolus" Greene. 05/27/2004
////////////////////////////////////////////////////////////////////////////////
#include "prc_inc_racial"
void fnDelayedEquip(object oPC, object oItem, int nSlot)
{
if(GetItemInSlot(nSlot,oPC)!=oItem)
{
AssignCommand(oPC,ActionEquipItem(oItem,nSlot));
DelayCommand(3.0, fnDelayedEquip(oPC,oItem,nSlot));
}
}
string fnMatchWeaponFocus(object oPC)
{
if(GetHasFeat(FEAT_WEAPON_FOCUS_BASTARD_SWORD,oPC)) return "nw_wswbs001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_BATTLE_AXE,oPC)) return "nw_waxbt001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_CLUB,oPC)) return "nw_wblcl001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_DAGGER,oPC)) return "nw_wswdg001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_DART,oPC)) return "nw_wthdt001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_DIRE_MACE,oPC)) return "nw_wdbma001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_DOUBLE_AXE,oPC)) return "nw_wdbax001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_DWAXE,oPC)) return "x2_wdwraxe001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_GREAT_AXE,oPC)) return "nw_waxgr001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_GREAT_SWORD,oPC)) return "nw_wswgs001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_HALBERD,oPC)) return "nw_wplhb001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_HAND_AXE,oPC)) return "nw_waxhn001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_HEAVY_CROSSBOW,oPC)) return "nw_wbwxh001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_HEAVY_FLAIL,oPC)) return "nw_wblfh001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_KAMA,oPC)) return "nw_wspka001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_KATANA,oPC)) return "nw_wswka001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_KUKRI,oPC)) return "nw_wspku001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_LIGHT_CROSSBOW,oPC)) return "nw_wbwxl001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_LIGHT_FLAIL,oPC)) return "nw_wblfl001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_LIGHT_HAMMER,oPC)) return "nw_wblhl001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_LIGHT_MACE,oPC)) return "nw_wblml001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_LONG_SWORD,oPC)) return "nw_wswls001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_LONGBOW,oPC)) return "nw_wbwln001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_MORNING_STAR,oPC)) return "nw_wblms001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_RAPIER,oPC)) return "nw_wswrp001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SCIMITAR,oPC)) return "nw_wswsc001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SCYTHE,oPC)) return "nw_wplsc001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SHORT_SWORD,oPC)) return "nw_wswss001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SHORTBOW,oPC)) return "nw_wbwsh001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SHURIKEN,oPC)) return "nw_wthsh001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SICKLE,oPC)) return "nw_wspsc001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SLING,oPC)) return "nw_wbwsl001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_SPEAR,oPC)) return "nw_wplss001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_STAFF,oPC)) return "nw_wdbqs001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_THROWING_AXE,oPC)) return "nw_wthax001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_TWO_BLADED_SWORD,oPC)) return "nw_wdbsw001";
else if(GetHasFeat(FEAT_WEAPON_FOCUS_WAR_HAMMER,oPC)) return "nw_wblhw001";
// whip? else if(GetHasFeat(FEAT_WEAPON_FOCUS_DIRE_MACE,oPC)) return "x2_it_wpwhip";
else return "";
}
void fnGiveMe5Potions(object oPC)
{
object oItem=CreateItemOnObject("nw_it_mpotion001",oPC,5);
// SendMessageToPC(oPC,"Create 5 potions...");
} // fnGiveMe5Potions()
void fnEquipStartingEquipment(object oPC)
{
object oItem;
string sRef="";
int nClass=GetClassByPosition(1,oPC);
int nAL=GetAlignmentGoodEvil(oPC);
oItem=CreateItemOnObject("nw_it_torch001",oPC);
DelayCommand(2.0,fnGiveMe5Potions(oPC)); // Cure light wounds potions
if(nClass==CLASS_TYPE_BARBARIAN)
{// barbarian
oItem=CreateItemOnObject("nw_aarcl002",oPC); // Studded Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
if((sRef=fnMatchWeaponFocus(oPC))=="")
{
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_waxbt001",oPC); // Battleaxe
else oItem=CreateItemOnObject("nw_waxgr001",oPC); // Greataxe
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
}
else
{
oItem=CreateItemOnObject(sRef,oPC); // item matching weapon focus
if(GetSubString(sRef,4,2)=="bw") // character has missile weapon
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
if(GetSubString(sRef,6,2)=="ln"||GetSubString(sRef,6,2)=="sh")
{
oItem=CreateItemOnObject("rts_mw_arr",oPC); // Arrows
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_ARROWS);
}
else if(GetSubString(sRef,6,2)=="xl"||GetSubString(sRef,6,2)=="xh")
{
oItem=CreateItemOnObject("rts_mw_bolt",oPC); // Bolts
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BOLTS);
}
else
{
oItem=CreateItemOnObject("rts_mw_bul",oPC); // Bullets
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BULLETS);
}
}
else if(GetSubString(sRef,4,2)=="db"||GetSubString(sRef,4,4)=="axgr"||GetSubString(sRef,4,4)=="swgs"||GetSubString(sRef,4,2)=="pl"||GetSubString(sRef,4,4)=="blfh") fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND); // two-handed weapon
else
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // one-handed weapon, add a Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
}
}
} // barbarian
else if(nClass==CLASS_TYPE_BARD)
{ // bard
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_wswdg001",oPC); // Dagger
else oItem=CreateItemOnObject("nw_wblcl001",oPC); // Club
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
} // bard
else if(nClass==CLASS_TYPE_CLERIC)
{ // cleric
oItem=CreateItemOnObject("nw_wblml001",oPC); // Mace
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
} // cleric
else if(nClass==CLASS_TYPE_DRUID)
{ // druid
oItem=CreateItemOnObject("nw_wspsc001",oPC); // Sickle
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
} // druid
else if(nClass==CLASS_TYPE_FIGHTER)
{ // fighter
oItem=CreateItemOnObject("nw_aarcl003",oPC); // Scale Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
if((sRef=fnMatchWeaponFocus(oPC))=="")
{
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_wswls001",oPC); // Longsword
else oItem=CreateItemOnObject("nw_wswgs001",oPC); // Greatsword
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
}
else
{
oItem=CreateItemOnObject(sRef,oPC); // item matching weapon focus
if(GetSubString(sRef,4,2)=="bw") // character has missile weapon
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
if(GetSubString(sRef,6,2)=="ln"||GetSubString(sRef,6,2)=="sh")
{
oItem=CreateItemOnObject("rts_mw_arr",oPC); // Arrows
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_ARROWS);
}
else if(GetSubString(sRef,6,2)=="xl"||GetSubString(sRef,6,2)=="xh")
{
oItem=CreateItemOnObject("rts_mw_bolt",oPC); // Bolts
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BOLTS);
}
else
{
oItem=CreateItemOnObject("rts_mw_bul",oPC); // Bullets
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BULLETS);
}
}
else if(GetSubString(sRef,4,2)=="db"||GetSubString(sRef,4,4)=="axgr"||GetSubString(sRef,4,4)=="swgs"||GetSubString(sRef,4,2)=="pl"||GetSubString(sRef,4,4)=="blfh") fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND); // two-handed weapon
else
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // one-handed weapon, add a Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
}
}
} // fighter
else if(nClass==CLASS_TYPE_MONK)
{// monk
oItem=CreateItemOnObject("nw_it_mpotion006",oPC); // Potion of Antidote
oItem=CreateItemOnObject("nw_it_mpotion005",oPC); //Potion of Barkskin
if (MyPRCGetRacialType(oPC)==RACIAL_TYPE_HUMAN||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFELF)
{ // monks outfit
if (nAL==ALIGNMENT_GOOD) oItem=CreateItemOnObject("lightmonkoutfit",oPC);
else if (nAL==ALIGNMENT_NEUTRAL) oItem=CreateItemOnObject("redmonkoutfit",oPC);
else if (nAL==ALIGNMENT_EVIL) oItem=CreateItemOnObject("darkmonkoutfit",oPC);
} // monks outfit
else oItem=CreateItemOnObject("nw_cloth016",oPC);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
} // monk
else if(nClass==CLASS_TYPE_PALADIN)
{ // paladin
oItem=CreateItemOnObject("nw_aarcl002",oPC); // Studded Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
if((sRef=fnMatchWeaponFocus(oPC))=="")
{
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_wswss001",oPC); // Shortsword
else oItem=CreateItemOnObject("nw_wswls001",oPC); // Longsword
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
}
else
{
oItem=CreateItemOnObject(sRef,oPC); // item matching weapon focus
if(GetSubString(sRef,4,2)=="bw") // character has missile weapon
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
if(GetSubString(sRef,6,2)=="ln"||GetSubString(sRef,6,2)=="sh")
{
oItem=CreateItemOnObject("rts_mw_arr",oPC); // Arrows
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_ARROWS);
}
else if(GetSubString(sRef,6,2)=="xl"||GetSubString(sRef,6,2)=="xh")
{
oItem=CreateItemOnObject("rts_mw_bolt",oPC); // Bolts
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BOLTS);
}
else
{
oItem=CreateItemOnObject("rts_mw_bul",oPC); // Bullets
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BULLETS);
}
}
else if(GetSubString(sRef,4,2)=="db"||GetSubString(sRef,4,4)=="axgr"||GetSubString(sRef,4,4)=="swgs"||GetSubString(sRef,4,2)=="pl"||GetSubString(sRef,4,4)=="blfh") fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND); // two-handed weapon
else
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_ashsw001",oPC); // one-handed weapon, add a Small Shield
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
}
}
} // paladin
else if(nClass==CLASS_TYPE_RANGER)
{ // ranger
oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
if((sRef=fnMatchWeaponFocus(oPC))=="")
{
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_wswss001",oPC); // Shortsword
else oItem=CreateItemOnObject("nw_wswls001",oPC); // Longsword
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_wswdg001",oPC); // Dagger
else oItem=CreateItemOnObject("nw_wswss001",oPC); // Shortsword
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
}
else
{
oItem=CreateItemOnObject(sRef,oPC); // item matching weapon focus
if(GetSubString(sRef,4,2)=="bw") // character has missile weapon
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
if(GetSubString(sRef,6,2)=="ln"||GetSubString(sRef,6,2)=="sh")
{
oItem=CreateItemOnObject("rts_mw_arr",oPC); // Arrows
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_ARROWS);
}
else if(GetSubString(sRef,6,2)=="xl"||GetSubString(sRef,6,2)=="xh")
{
oItem=CreateItemOnObject("rts_mw_bolt",oPC); // Bolts
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BOLTS);
}
else
{
oItem=CreateItemOnObject("rts_mw_bul",oPC); // Bullets
SetItemStackSize(oItem,99);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_BULLETS);
}
}
else if(GetSubString(sRef,4,2)=="db"||GetSubString(sRef,4,4)=="axgr"||GetSubString(sRef,4,4)=="swgs"||GetSubString(sRef,4,2)=="pl"||GetSubString(sRef,4,4)=="blfh") fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND); // two-handed weapon
else
{
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
if(MyPRCGetRacialType(oPC)==RACIAL_TYPE_GNOME||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFLING) oItem=CreateItemOnObject("nw_wswdg001",oPC); //one-handed weapon, add a Dagger
else oItem=CreateItemOnObject("nw_wswss001",oPC); // one-handed weapon, add a Shortsword
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_LEFTHAND);
}
}
} // ranger
else if(nClass==CLASS_TYPE_ROGUE)
{ // rogue
oItem=CreateItemOnObject("nw_wswss001",oPC); // Short Sword
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
oItem=CreateItemOnObject("nw_it_trap001",oPC); //Minor Spike Trap
} // rogue
else if (nClass==CLASS_TYPE_SORCERER||nClass==CLASS_TYPE_WIZARD)
{ // sorc/wiz
oItem=CreateItemOnObject("nw_wswdg001",oPC); // Dagger
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_RIGHTHAND);
oItem=CreateItemOnObject("nw_it_sparscr109",oPC); // Scroll of Magic Missile
oItem=CreateItemOnObject("nw_it_mpotion005",oPC); //Potion of Barkskin
if (nAL==ALIGNMENT_GOOD)
oItem=CreateItemOnObject("lightrobes",oPC);
else if (nAL==ALIGNMENT_NEUTRAL)
oItem=CreateItemOnObject("redrobes",oPC);
else if (nAL==ALIGNMENT_EVIL)
oItem=CreateItemOnObject("darkrobes",oPC);
fnDelayedEquip(oPC,oItem,INVENTORY_SLOT_CHEST);
}// sorc/wiz
}
//void main(){}