Initial upload
Initial upload. PRC8 has been added. Module compiles, PRC's default AI & treasure scripts have been integrated. Started work on top hak for SLA / Ability / Scripting modifications.
This commit is contained in:
126
_module/nss/jw_createpl1_new.nss
Normal file
126
_module/nss/jw_createpl1_new.nss
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "prc_x2_itemprop"
|
||||
|
||||
// * Returns total attack bonus for the item
|
||||
int ReturnAttackBonus(object oItem);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
AssignCommand(oPC, ActionSpeakString("May this weapon be blessed by Gond, the Wonderbringer, Lord of All Smiths!", TALKVOLUME_TALK));
|
||||
AssignCommand(oPC, ActionPlayAnimation( ANIMATION_LOOPING_WORSHIP, 1.0, 8.0));
|
||||
|
||||
object oAnvil = GetNearestObjectByTag("ANVIL_GOND", OBJECT_SELF, 1);
|
||||
location locAnvil = GetLocation (oAnvil);
|
||||
object oFirstItem = GetFirstItemInInventory(oAnvil);
|
||||
object oSecondItem = GetNextItemInInventory(oAnvil);
|
||||
object oGem;
|
||||
object oWeapon;
|
||||
string sNewWeapon;
|
||||
int nIsGem = 0;
|
||||
int nIsWeapon = 0;
|
||||
|
||||
if (oSecondItem == OBJECT_INVALID)
|
||||
{
|
||||
SendMessageToPC(oPC, "Nothing happens. There seems to be something missing to perform the ritual correctly.");
|
||||
return;
|
||||
}
|
||||
if (GetTag(oFirstItem) == "NW_IT_GEM009")
|
||||
{
|
||||
oGem = oFirstItem;
|
||||
oWeapon = oSecondItem;
|
||||
nIsGem = 1;
|
||||
}
|
||||
else if (GetTag(oSecondItem) == "NW_IT_GEM009")
|
||||
{
|
||||
oGem = oSecondItem;
|
||||
oWeapon = oFirstItem;
|
||||
nIsGem = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC, "Nothing happens. There seems to be something missing to perform the ritual correctly.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IPGetIsMeleeWeapon(oWeapon))
|
||||
{
|
||||
nIsWeapon=TRUE;
|
||||
}
|
||||
|
||||
if (IPGetIsRangedWeapon(oWeapon))
|
||||
{
|
||||
nIsWeapon=TRUE;
|
||||
}
|
||||
|
||||
if (nIsWeapon!=TRUE)
|
||||
{
|
||||
SendMessageToPC(oPC, "You do not appear to have placed a weapon into the anvil.");
|
||||
return;
|
||||
}
|
||||
|
||||
int nEnhancement;
|
||||
// do Melee weapon
|
||||
if (IPGetIsMeleeWeapon(oWeapon))
|
||||
{
|
||||
nEnhancement=IPGetWeaponEnhancementBonus(oWeapon);
|
||||
//SendMessageToPC(oPC, "DEBUG - found a melee weapon.");
|
||||
if (nEnhancement>0)
|
||||
{
|
||||
SendMessageToPC(oPC, "This shrine cannot enchant your weapon any more than it is already.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(10.0, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), locAnvil));
|
||||
DelayCommand(12.0, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DIVINE_STRIKE_FIRE), locAnvil));
|
||||
DestroyObject(oGem, 0.0);
|
||||
IPSetWeaponEnhancementBonus(oWeapon,1);
|
||||
}
|
||||
}
|
||||
|
||||
// do ranged weapon
|
||||
if (IPGetIsRangedWeapon(oWeapon))
|
||||
{
|
||||
//SendMessageToPC(oPC, "DEBUG - found a ranged weapon.");
|
||||
nEnhancement=ReturnAttackBonus(oWeapon);
|
||||
|
||||
if (nEnhancement>0)
|
||||
{
|
||||
SendMessageToPC(oPC, "This shrine cannot enchant your weapon any more than it is already.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(10.0, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), locAnvil));
|
||||
DelayCommand(12.0, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DIVINE_STRIKE_FIRE), locAnvil));
|
||||
DestroyObject(oGem, 0.0);
|
||||
IPSafeAddItemProperty(oWeapon,ItemPropertyAttackBonus(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * Returns total attack bonus for the item
|
||||
int ReturnAttackBonus(object oItem)
|
||||
{
|
||||
itemproperty ipFirst = GetFirstItemProperty(oItem);
|
||||
int nBonus = 0;
|
||||
while (GetIsItemPropertyValid(ipFirst) == TRUE)
|
||||
{
|
||||
if (GetItemPropertyType(ipFirst) == ITEM_PROPERTY_ATTACK_BONUS)
|
||||
{
|
||||
int nSubType = GetItemPropertyCostTableValue(ipFirst);
|
||||
//SpeakString("Found an attack bonus! SubType = " + IntToString(nSubType));
|
||||
nBonus = nBonus + (nSubType);
|
||||
return nBonus; // * Quick exit. Got what I need
|
||||
}
|
||||
ipFirst = GetNextItemProperty(oItem);
|
||||
}
|
||||
//SpeakString("Attack Bonus = " + IntToString(nBonus));
|
||||
return nBonus;
|
||||
}
|
||||
Reference in New Issue
Block a user