Skip to content

HELP! One step away from my goal but I'm lilacsoul dependant!

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);

}

Comments

  • NeverwinterWightsNeverwinterWights Member Posts: 339
    edited February 2018
    Haven't tested but compiles. You need to loop through all inventory slots and regular inventory. Something like so?

    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); }
    Post edited by NeverwinterWights on
  • omedon666omedon666 Member Posts: 48
    edited February 2018
    NeverwinterWights , that did it! Thank you so much! I know that was probably super simple for an actual script-person, but for me it was a huge chasm! I can take it from there and adapt it to all the properties I want to use in the future!

    Again, thank you so much!
  • omedon666omedon666 Member Posts: 48
    edited February 2018
    One problem I am having though, and I had this before and I wasn't sure why, is when I pick up or acquire 2nds and 3rds of my item that activates to fire this script, just picking it up is making it fire off, which is weird. Like it doesn't expend a charge, it just fires, then it's in my inventory, then I can activate it and make it fire again.

    Not a real cockblock, just odd is all.
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    edited February 2018
    Oh right. Forgot about the TagBased check thing at the beginning.
    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.
  • omedon666omedon666 Member Posts: 48
    That did it! Thank you! :smiley:
Sign In or Register to comment.