GetItemPropertyParam1Value

I’m trying to check how many spells are left on an item.

In this case, I have an item with a cast spell heal (11) with 1 uses/day.

Can that be checked through GetItemPropertyParam1Value ?

I’m wanting to check if the item has a heal left.

I would instead check to see if a particular item has any charges.
GetItemCharges() would be easier to use, as you can then check to see if the item is charged. This is of course if you know the particular item you’re scripting the search for.

I tried this, with no luck.

int charges = GetItemCharges(oItem);
if(charges < 1)
{
}

True, but that’s not what OP is asking for. There is no way in NWS to tell if item has any daily uses left. With creatures you would use GetHasSpell, but it doesn’t work with items. Also carrying an item that can cast spells doesn’t change the output of this function.

I figured as much. It was my first thought anyways.

Yeah, it’s the daily uses thing that can’t be called from the script. I’m not sure how you would go about this…it’s been a while and I’m still getting back into it.

Ok, thinking about this, there is a work-around.
You’ll have to Set Integers or Strings when the item in question is used, and delete those (integer/string) when the owner of the item property rests.
Instead of using the script to call the item property, and charges, simply use the script to call the integer set when the PC uses said item, and when they rest.

You’ll have to add routines that set and delete the integer/string in the global module ‘OnActivateItem’ script, and ‘OnPlayerRest’ script.

It’s about the only way I could figure out how to do a work-around with the same effect.

1 Like

Maybe set nHealUsed in the OnActivate script for the staff, and clear it out when the PC rests. There are probably some corner cases that won’t catch, but if you can’t directly query the item you’ll have to do something like that.

edit - Ghool beat me to it.

2 Likes

I ninja’d you. :wink:

1 Like

That should work! Thanks.

Note that my “no way” meant there is no direct NWS way to tell that.

Using on-activate handler, as other posters suggested, will work but then you end up with extra layer of complexity - players no longer can tell what the item will do (and activation usually means something story/module-specific).

You may therefore employ spell hooking to call one script when any spell is cast. Inside, check for matching item (GetSpellCastItem) and spell ID (GetSpellId). This will be pretty much transparent for players as they will see “standard” radial menu interface for the item.