HELP! One step away from my goal but I'm lilacsoul dependant!
omedon666
Member Posts: 48
So, ok, sadly trying to build a PW module today means the lone veteran on the team has to teach everyone else, and so I don't have a scripting team like I had back in the heyday! For 99% of what I need done I can copy-paste from my old PW or create using lilacsoul, but sadly I've hit a narrow but bottomless chasm that I hope someone can help me with!
The progression model for the action side of my module involves looting "unique power self only" items that enchant all of the items in one's inventory with the applicable enhancement bonus or other effect, replacing existing instances of said enhancement bonus as desired and as enabled by lilacsoul. I COULD identify the item by location, but I'd rather use tags so I can also simultaneously utilize a tag-based nodrop script I have hanging around in my old mod. Anyway, I thought I was totally fine in making this happen within my usual sphere of lack-of-knoweldge via lilacsoul, but sadly my script is stopping at only enchanting one item (the first it finds), and I really need it to check for more with one click (the activated item has a single charge) and apply to all items sharing the applicable tag (lunar_weapon).
I can do ALL of this except that check for more items. I have a feeling this is a really easy fix, but it's just beyond my (and my entire team's) reach. If someone could advise I'd really appreciate it!
I don't know the forum code for the ol "block of script" feature that the official forums had back in the day, so I'll just copy paste here. The visual effect listed in this script works fine, it's the enhancement bonus application that I'm concerned with!
PLEASE HELP! If I can get this once it's just a matter of changing really easy to find variables (I can do that) and my whole system clicks!
/* Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625 */
#include "x2_inc_itemprop"
void main()
{
object oPC;
object oTarget;
oTarget = GetItemActivator();
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), GetLocation(oTarget));
oPC = GetItemActivator();
object oItem;
oTarget = oPC;
oItem = GetItemPossessedBy(oTarget, "lunar_weapon");
itemproperty ipAdd;
ipAdd = ItemPropertyEnhancementBonus(1);
IPSafeAddItemProperty(oItem, ipAdd);
}
The progression model for the action side of my module involves looting "unique power self only" items that enchant all of the items in one's inventory with the applicable enhancement bonus or other effect, replacing existing instances of said enhancement bonus as desired and as enabled by lilacsoul. I COULD identify the item by location, but I'd rather use tags so I can also simultaneously utilize a tag-based nodrop script I have hanging around in my old mod. Anyway, I thought I was totally fine in making this happen within my usual sphere of lack-of-knoweldge via lilacsoul, but sadly my script is stopping at only enchanting one item (the first it finds), and I really need it to check for more with one click (the activated item has a single charge) and apply to all items sharing the applicable tag (lunar_weapon).
I can do ALL of this except that check for more items. I have a feeling this is a really easy fix, but it's just beyond my (and my entire team's) reach. If someone could advise I'd really appreciate it!
I don't know the forum code for the ol "block of script" feature that the official forums had back in the day, so I'll just copy paste here. The visual effect listed in this script works fine, it's the enhancement bonus application that I'm concerned with!
PLEASE HELP! If I can get this once it's just a matter of changing really easy to find variables (I can do that) and my whole system clicks!
/* Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625 */
#include "x2_inc_itemprop"
void main()
{
object oPC;
object oTarget;
oTarget = GetItemActivator();
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), GetLocation(oTarget));
oPC = GetItemActivator();
object oItem;
oTarget = oPC;
oItem = GetItemPossessedBy(oTarget, "lunar_weapon");
itemproperty ipAdd;
ipAdd = ItemPropertyEnhancementBonus(1);
IPSafeAddItemProperty(oItem, ipAdd);
}
0
Comments
void main() { int iEvent = GetUserDefinedItemEventNumber(); if (iEvent != X2_ITEM_EVENT_ACTIVATE) return; object oPC = GetItemActivator(); int iSlot; object oItem; itemproperty ipAdd = ItemPropertyEnhancementBonus(1); //Add item property to anything in a slot with tag... for(iSlot = 0; iSlot < NUM_INVENTORY_SLOTS; iSlot++) { oItem = GetItemInSlot(iSlot, oPC); if(GetIsObjectValid(oItem) && GetTag(oItem) == "lunar_weapon") { IPSafeAddItemProperty(oItem, ipAdd); } } //Add item property to anything in inventory with tag... oItem = GetFirstItemInInventory(oPC); while(GetIsObjectValid(oItem)) { if (GetTag(oItem) == "lunar_weapon") { IPSafeAddItemProperty(oItem, ipAdd); } oItem = GetNextItemInInventory(oPC); } //Slam down some visualFX for awesomeness ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oPC); }
Again, thank you so much!
Not a real cockblock, just odd is all.
Just under and just above the void main add a couple lines:
#inlcude "x2_inc_switches" void main() { int iEvent = GetUserDefinedItemEventNumber(); if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;
I updated the previous code as well.