Maybe everyone has this figured out…I don’t
I wonder if there is a fix out there to enchant CEP weapons (i.e Heavy Mace). I can’t cast spells like flame weapon or such spells on it.
Is there a fix for this?
Maybe everyone has this figured out…I don’t
I wonder if there is a fix out there to enchant CEP weapons (i.e Heavy Mace). I can’t cast spells like flame weapon or such spells on it.
Is there a fix for this?
You need to update the spell scripts.
To summarize: The base item type of these exotic weapons needs to be added to the function
“IPGetIsMeleeWeapon” which can be found in “x2_inc_itemprop”.
Since it is an include, all the spell-scripts (such as “x2_s0_flmeweap”) need to be recompiled. Sounds like fun!
Thanks Proleric,
But I do not know scripting
Do you or anyone else have these scripts for the CEP weapons already done? I am using the most current CEP haks and the scripts do not have these. Just wondering why the CEP doesn’t do this for the CEP weapons.
Thanks Mmat for your reply. I read the same thing that Proleric gave me in the link above. Unfortunately I do not know how to script. I know basic stuff, but nowhere on the level to do all this. Do you happen to have these scripts already done? If so maybe you can upload them for the community to use for the CEP users. Would be nice as a CEP add-on on their site here.
To fix the problem, means to mess around with a lot of original scripts. It’s not only the spell which doesn’t work, alchemists fire etc. don’t work too. It’s simply too risky and too much work to do this. And such a addon needs to be maintained in the future.
The following makes the flameweapon spell available for the maul and the hefty mace (other exotic weapons could be added with ease). It’s a quick and very dirty hack, but it seems to work. It will overwrite the original script.
x2_s0_flmeweap.zip (3.6 KB)
Use at your own risk.
Thanks man!!..much appreciated!!
Thanks man!!..much appreciated!!
So using your script I added the rest of the CEP weapons (that I think I needed):
#include “nw_i0_spells”
#include “x2_i0_spells”
#include “x2_inc_spellhook”
void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLevel)
{
IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(124,nCasterLevel), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
return;
}
int IPGetIsExtraWeapon(object oItem)
{
int nItem = GetBaseItemType(oItem);
return ((nItem == 317) || //Hefty Mace
(nItem == 318) || //Maul
(nItem == 319) || //mercurial longsword
(nItem == 320) || //mercurial greatsword
(nItem == 322) || //goad
(nItem == 323) || //windfirewheel
(nItem == 301) || //heavypick
(nItem == 302) || //lightpick
(nItem == 303) || //sai
(nItem == 304) || //nunchaku
(nItem == 309) || //daggerassn
(nItem == 310) || //katar
(nItem == 300));//fuscina trident 1h
}
object IPGetTargetedOrEquippedExtraWeapon()
{
object oTarget = GetSpellTargetObject();
if (!GetIsObjectValid(oTarget)) return OBJECT_INVALID;
if (GetObjectType(oTarget) == OBJECT_TYPE_ITEM)
{
if (IPGetIsExtraWeapon(oTarget))
return oTarget;
else
return OBJECT_INVALID;
}
object o = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
if (GetIsObjectValid(o) && IPGetIsExtraWeapon(o)) return o;
return OBJECT_INVALID;
}
void main()
{
if (!X2PreSpellCastCode()) return;
effect eVis = EffectVisualEffect(VFX_IMP_PULSE_FIRE);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
int nCasterLvl = GetCasterLevel(OBJECT_SELF);
if(nCasterLvl > 10) nCasterLvl = 10;
if (nMetaMagic == METAMAGIC_EXTEND) nDuration = nDuration * 2;
object oMy = IPGetTargetedOrEquippedExtraWeapon();
if (!GetIsObjectValid (oMy)) oMy =IPGetTargetedOrEquippedMeleeWeapon();
if (GetIsObjectValid (oMy))
{
SignalEvent(GetItemPossessor(oMy), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
if (nDuration>0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMy));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMy), TurnsToSeconds(nDuration));
AddFlamingEffectToWeapon(oMy, TurnsToSeconds(nDuration),nCasterLvl);
}
return;
}
else
{
FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
return;
}
}
It works…took a bit of experimenting with the brackets (I don’t know scripting)…seems to work so far.
So I went to look at the “Dark Flame” Cleric spell…thinking the script would be the same to add the effects…nope…totally different looking…I thought I could just insert the small segment of script like above into it…nope…must be something else I’m not thinking about.
Instead of adding baseitem types to IPGetIsMeleeWeapon() it’s probably better to fix IPGetIsMeleeWeapon() so that it does not compare baseitem types but reads baseitems.2da and checks if the item in question actually is a melee weapon or not: e.g. only for melee weapons there should be a 0 in column PropColumn.
int IPGetIsMeleeWeapon(object oItem)
{
return (Get2DAString("baseitems", "PropColumn", GetBaseItemType(oItem)) == "0");
}
Column “PropColumn” is used to determine the valid item properties for an item type and links into itemprops.2da. Column 0 in itemprops.2da is “0_Melee”.
Or you could check if the item is a weapon (column WeaponType > 0) but not a ranged weapon (column RangedWeapon == “”).
I added some other CEP weapons I missed and I tested your script…they all work as they should.
Now I have to figure out the dark flame spell to do the same there.
Thanks Mmat
That all sounds complicated. What Mmat suggested is easy and works.
But I’m sure your way works too…if I understood it
What’s this? You told us that you can’t do scripting
Ok, experimenting is one way to learn. And I already guessed that you will be able to add some lines. Btw. Kamiryns approach will work too, but stay on code you can understand … even after a year.
I took the liberty of adding this to the Lexicon entry for IPGetIsMeleeWeapon. It’s a great improvement over the current function that works for any custom melee weapon added to baseitems.2da.
Thanks everyone.
I think maybe on the next CEP update this should be done for all the CEP weapons.