156 lines
3.6 KiB
Plaintext
156 lines
3.6 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Weapon Types Include File
|
|
// opw_inc_weapons
|
|
// by Don Anderson
|
|
// dandersonru@msn.com
|
|
//
|
|
// This works for Bioware and ANY Weapon Hak!!
|
|
// Completely Rewritten for OAI by David Kelly
|
|
//
|
|
// Copy this into any Scripts that need Weapon Types or Info
|
|
// #include "opw_inc_weapons"
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "oai_inc_weapstat"
|
|
|
|
int IsWeapon(object oWeapon)
|
|
{
|
|
if (!GetIsObjectValid(oWeapon))
|
|
return FALSE;
|
|
|
|
switch (OAI_GetWeaponStat(oWeapon, OAI_STAT_CATEGORY))
|
|
{
|
|
case 1: // Melee
|
|
case 2: // Bows
|
|
case 7: // Thrown
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
int IsMeleeWeapon(object oWeapon)
|
|
{
|
|
if (!GetIsObjectValid(oWeapon))
|
|
return FALSE;
|
|
|
|
return OAI_GetWeaponStat(oWeapon, OAI_STAT_CATEGORY) == 1;
|
|
}
|
|
|
|
int IsRangedWeapon(object oWeapon)
|
|
{
|
|
if (!GetIsObjectValid(oWeapon))
|
|
return FALSE;
|
|
|
|
return OAI_GetWeaponStat(oWeapon, OAI_STAT_BASEAMMO) > 0;
|
|
}
|
|
|
|
int IsCrossbow(object oWeapon)
|
|
{
|
|
int nType = GetBaseItemType(oWeapon);
|
|
switch (nType)
|
|
{
|
|
case BASE_ITEM_HEAVYCROSSBOW:
|
|
case BASE_ITEM_LIGHTCROSSBOW:
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int IsBow(object oWeapon)
|
|
{
|
|
int nType = GetBaseItemType(oWeapon);
|
|
switch (nType)
|
|
{
|
|
case BASE_ITEM_LONGBOW:
|
|
case BASE_ITEM_SHORTBOW:
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int IsSling(object oWeapon)
|
|
{
|
|
int nType = GetBaseItemType(oWeapon);
|
|
switch (nType)
|
|
{
|
|
case BASE_ITEM_SLING:
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int IsLightMeleeWeapon(object oWeapon, int nSize=0)
|
|
{
|
|
if (!GetIsObjectValid(oWeapon))
|
|
return FALSE;
|
|
|
|
if (nSize == 0)
|
|
nSize = GetCreatureSize(OBJECT_SELF);
|
|
|
|
return OAI_GetWeaponStat(oWeapon, OAI_STAT_CATEGORY) == 1 &&
|
|
OAI_GetWeaponStat(oWeapon, OAI_STAT_WEAPONSIZE) < nSize;
|
|
}
|
|
|
|
int IsMediumMeleeWeapon(object oWeapon, int nSize=0)
|
|
{
|
|
if (!GetIsObjectValid(oWeapon))
|
|
return FALSE;
|
|
|
|
if (nSize == 0)
|
|
nSize = GetCreatureSize(OBJECT_SELF);
|
|
|
|
return OAI_GetWeaponStat(oWeapon, OAI_STAT_CATEGORY) == 1 &&
|
|
OAI_GetWeaponStat(oWeapon, OAI_STAT_WEAPONSIZE) == nSize;
|
|
}
|
|
|
|
int IsHeavyMeleeWeapon(object oWeapon, int nSize=0)
|
|
{
|
|
if (!GetIsObjectValid(oWeapon))
|
|
return FALSE;
|
|
|
|
if (nSize == 0)
|
|
nSize = GetCreatureSize(OBJECT_SELF);
|
|
|
|
return OAI_GetWeaponStat(oWeapon, OAI_STAT_CATEGORY) == 1 &&
|
|
OAI_GetWeaponStat(oWeapon, OAI_STAT_WEAPONSIZE) > nSize;
|
|
}
|
|
|
|
// now returns weapon size when can be weilding single handed by calling creature
|
|
int IsSingleHandedMeleeWeapon(object oWeapon, int nSize=0)
|
|
{
|
|
return IsMediumMeleeWeapon(oWeapon, nSize);
|
|
}
|
|
|
|
void SetRacialMovementRate(object oCreature)
|
|
{
|
|
//For HCR Systems
|
|
//ExecuteScript("hc_armor_encum", oCreature);
|
|
|
|
if(GetLocalInt(oCreature, "RACIAL_MOVEMENT") == 1) return;
|
|
|
|
int nRACIALMOVE = GetLocalInt(GetModule(),"RACIALMOVE");
|
|
if(nRACIALMOVE == 0) return;
|
|
|
|
int nType = GetRacialType(oCreature);
|
|
if(nType == RACIAL_TYPE_ANIMAL
|
|
|| nType == RACIAL_TYPE_BEAST
|
|
|| nType == RACIAL_TYPE_DRAGON
|
|
|| nType == RACIAL_TYPE_MAGICAL_BEAST
|
|
|| nType == RACIAL_TYPE_VERMIN)
|
|
return;
|
|
|
|
if(GetCreatureSize(oCreature) == CREATURE_SIZE_SMALL || nType == RACIAL_TYPE_DWARF)
|
|
{
|
|
int nSCMR = GetLocalInt(GetModule(),"SML_CREATURE_MOVEPEN");
|
|
|
|
effect eRate = SupernaturalEffect(EffectMovementSpeedDecrease(nSCMR));
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRate, oCreature);
|
|
SetLocalInt(oCreature, "RACIAL_MOVEMENT", 1);
|
|
return;
|
|
}
|
|
}
|
|
|
|
//void main(){}
|