MMD_PRC8/_module/nss/use_contraption.nss
Jaysyn904 adeff59f82 Initial commit
Initial commit.
2024-08-02 23:18:00 -04:00

227 lines
10 KiB
Plaintext

#include "x2_inc_itemprop"
void main()
{
object oPC = GetLastUsedBy();
object oBox = OBJECT_SELF;
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
object oWep = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
object oHelm = GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
int iRoll = d20();
int iUsed = GetLocalInt(oBox,"usedgc");
if (iUsed !=1)
{
switch (iRoll)
{
case 1:
{
itemproperty ipAdd = ItemPropertyACBonus(1);
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your armor has been enchanted with protective magicks.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 2:
{
itemproperty ipAdd = ItemPropertyBonusSavingThrow(IP_CONST_SAVEBASETYPE_WILL,2);
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your armor has been enchanted with protective magicks.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 3:
{
itemproperty ipAdd = ItemPropertySkillBonus(SKILL_INTIMIDATE,5);
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);;
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your armor now has a more menacing aura about it.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 4:
{
itemproperty ipAdd = ItemPropertyHaste();
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your armor has been enchanted to make you blindingly quick.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 5:
{
itemproperty ipAdd = ItemPropertySpellImmunitySchool(IP_CONST_SPELLSCHOOL_ILLUSION);
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your armor now gives you immunity to illusions and phantasms.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 6:
{
itemproperty ipAdd = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_2,IP_CONST_DAMAGESOAK_5_HP);
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your armor has been reinforced with adamantine bands.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 7:
{
itemproperty ipAdd = ItemPropertyFreeAction();
if ( oArmor != OBJECT_INVALID) IPSafeAddItemProperty(oArmor,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("If you are ever unable to move, your armor can move you about as you will.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 8:
{
itemproperty ipAdd = ItemPropertyKeen();
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been made keen.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 9:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with fire.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 10:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with frost.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 11:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_MAGICAL,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with magic.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 12:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_DIVINE,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with divine power.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 13:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with acid.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 14:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_NEGATIVE,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with negative energy.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 15:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with lightning.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 16:
{
itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGEBONUS_1d6);
if ( oWep != OBJECT_INVALID) IPSafeAddItemProperty(oWep,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your weapon has been empowered with thunder.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 17:
{
itemproperty ipAdd = ItemPropertyRegeneration(d4());
if ( oHelm != OBJECT_INVALID) IPSafeAddItemProperty(oHelm,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your helm has been endowed with fast-healing.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 18:
{
itemproperty ipAdd = ItemPropertyACBonus(d4());
if ( oHelm != OBJECT_INVALID) IPSafeAddItemProperty(oHelm,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your helm now emanates a deflective field around you.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 19:
{
itemproperty ipAdd = ItemPropertyImmunityToSpellLevel(d4());
if ( oHelm != OBJECT_INVALID) IPSafeAddItemProperty(oHelm,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your helm has been endowed spell immunity.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
case 20:
{
itemproperty ipAdd = ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,d4());
if ( oHelm != OBJECT_INVALID) IPSafeAddItemProperty(oHelm,ipAdd);
SetLocalInt(oBox,"usedgc",1);
FloatingTextStringOnCreature("Your helm will now make you physically stronger while worn.",oPC);
effect eShow = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eShow,oPC);
break;
}
}
}
effect eSmoke = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
effect eBoom = EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION);
DelayCommand(4.0f,ApplyEffectToObject(DURATION_TYPE_INSTANT,eSmoke,oBox));
DelayCommand(4.0f,ApplyEffectToObject(DURATION_TYPE_INSTANT,eBoom,oBox));
DestroyObject(oBox,6.0f);
}