Aantioch_Infernum/_module/nss/createelvenlight.nss
EpicValor 7770601b3e Modified some areas, items, creatures
Added a forge to make a weapon into another weapon of a different base type.
2023-09-25 18:15:41 -05:00

46 lines
1.7 KiB
Plaintext

#include "x2_inc_itemprop"
#include "x3_inc_string"
void main()
{
ActionPauseConversation();
object oPC = GetPCSpeaker();
TakeGoldFromCreature(1000000, oPC, TRUE);
object oForge = GetNearestObjectByTag ("WeaponForge", OBJECT_SELF, 1);
object oOldWeapon = GetFirstItemInInventory(oForge);
string sItemTemplate1 = "aelvenlightblade";
effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
effect eVis2 = EffectVisualEffect(VFX_IMP_DIVINE_STRIKE_FIRE);
effect eVis3 = EffectVisualEffect(VFX_IMP_FROST_L);
string sOldWeapon = GetName(oOldWeapon);
string sNewWeaponName = StringToRGBString(sOldWeapon+" Reforged", "730");
if (!GetIsObjectValid(oOldWeapon)) return;
AssignCommand (oForge, ActionLockObject (oForge));
//Get the first itemproperty on the weapon
itemproperty ipLoop=GetFirstItemProperty(oOldWeapon);
object oNewWeapon = CreateItemOnObject (sItemTemplate1, oForge, 1);
//object oNewWeapon = GetNextItemInInventory (oForge);
//Loop for as long as the ipLoop variable is valid
while (GetIsItemPropertyValid(ipLoop))
{
//Add itemprops to new weapon
IPSafeAddItemProperty(oNewWeapon, ipLoop);
//Next itemproperty on the list...
ipLoop=GetNextItemProperty(oOldWeapon);
}
SetName(oNewWeapon, sNewWeaponName);
DestroyObject (oOldWeapon);
ActionPlayAnimation(ANIMATION_LOOPING_CONJURE2, 1.0, 5.5);
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oForge));
DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oForge));
DelayCommand(5.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oForge));
DelayCommand(6.5, ActionSpeakString("It is done"));
AssignCommand(oForge, DelayCommand (8.0, ActionUnlockObject (oForge)));
ActionResumeConversation();
}