Aller au contenu

Photo

Ring of Spell Storing?


  • Veuillez vous connecter pour répondre
11 réponses à ce sujet

#1
rjshae

rjshae
  • Members
  • 4 491 messages
Does anybody have some thoughts on how one might implement a ring of spell storing? The problem I run into is that the use of a single-use spell causes the item to vanish from the inventory, even if there are non-single use spells attached to the item. I was thinking that perhaps charges could be used, with a different charge level for each spell. Somehow, if the changes in charges could be tracked, then the ring could be updated to remove the used spell. I'm not sure how to do that, however, using tag-based scripts. Maybe have the four spells use 5, 6, 7 and 8 charges out of the 9 available, then have some script remove the used spell and set the charges back to 9. But how would I trap that change?

Modifié par rjshae, 12 octobre 2010 - 07:57 .


#2
kamalpoe

kamalpoe
  • Members
  • 711 messages
There's rings of spell sequencing on the Vault. http://nwvault.ign.c...s.Detail&id=142

#3
rjshae

rjshae
  • Members
  • 4 491 messages
At first I thought they were completely different, but the description sounds promising. I'll take a look. Thanks.

#4
I_Raps

I_Raps
  • Members
  • 1 262 messages
Those rings simply use the Sequencer that's already in place.

If you want to do more - how about a script that skips the game's "charges" property altogether and keeps track of its own "uses" variables? You might have to use a dialogue box for the description etc.

Modifié par I_Raps, 12 octobre 2010 - 09:54 .


#5
Quilistan

Quilistan
  • Members
  • 111 messages
I was also wondering about a ring of spell turning. Catch the next spell that is cast at you, and then you can use the spell from the ring when you choose.

#6
The Fred

The Fred
  • Members
  • 2 516 messages
I made a ring a bit like this once which could store a single spell. When you cast the spell on the ring, it is added as an itemproperty. When it's cast from the ring, the item property is removed. You might have an issue if someone casts a powerful spell on the ring in that the ring could then be sold to a store for a higher-than-fair price, since the property will increase the value, but otherwise the system more or less works fine.

What I did was use the spellhook system to trap the events of the spell being cast on the item, and the item casting the spell. I think NWN2 already traps the casting of spells on items and funnels it into tagbased scripting, but when the spell is cast out again, you need to check if it was cast by the ring, check which spell it was, and remove the item property from the spell. I'd use a property with something like 5 charges a use (or maybe one use/day) to minimise the cost increase of adding the property. You might have to reset the charges to full each time a spell is cast, though.

Modifié par The Fred, 13 octobre 2010 - 07:51 .


#7
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
I had a similar problem on an item with the charges (item was not a spell storing though). I just coded it so that if the ability was used in an invalid way I added the charge back to the item. If that was the final charge and the item disappeared, I had the script create a new copy of the item on the PC, added the charge back to it and re-equipped it back to the appropriate slot. The drawback though is that if the player has it assigned to a quickslot, it would disappear from there and they would have to reassign it.

If you'd like to see the code, let me know.

Modifié par _Knightmare_, 13 octobre 2010 - 11:08 .


#8
rjshae

rjshae
  • Members
  • 4 491 messages

_Knightmare_ wrote...

I had a similar problem on an item with the charges (item was not a spell storing though). I just coded it so that if the ability was used in an invalid way I added the charge back to the item. If that was the final charge and the item disappeared, I had the script create a new copy of the item on the PC, added the charge back to it and re-equipped it back to the appropriate slot. The drawback though is that if the player has it assigned to a quickslot, it would disappear from there and they would have to reassign it.

If you'd like to see the code, let me know.


I'm curious to know how you trapped the event where the item disappears. It doesn't seem to call the unequip script. Maybe with a heartbeat script?

Another approach I was thinking about was to have the stored spells in the ring appear as separate scroll-like items in the player's inventory when the ring was equipped, then remove the scrolls (and tally their usage) when the ring was unequipped.

Thanks.

#9
_Knightmare_

_Knightmare_
  • Members
  • 643 messages

rjshae wrote...

I'm curious to know how you trapped the event where the item disappears. It doesn't seem to call the unequip script. Maybe with a heartbeat script?


I just have it as part of the OnActivate tag-based script. Apparently, the used charge is removed before the tag-based script actually fires, so you can catch it there:

// Add the used charge back to the item
 int nCharges = GetItemCharges(oItem);
 if(nCharges == 0)
  {
  object oNewItem = CreateItemOnObject("item_resref", oPC, 1, "", TRUE);
  SetItemCharges(oNewItem, 1);
  return;
  }
 SetItemCharges(oItem, nCharges + 1);

Modifié par _Knightmare_, 13 octobre 2010 - 11:08 .


#10
rjshae

rjshae
  • Members
  • 4 491 messages
Unfortunately I think that would only work with a single Unique Power. I'm not sure how you would use it with multiple spells.

#11
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Don't really think that has anything to do with it. I believe that to the scripting, the act of using a charge and the effects of using that charge are different things. For my script, it just knows there's no charges left so recreate the item and add one charge back, doesn't matter what I say that used charge does.

#12
rjshae

rjshae
  • Members
  • 4 491 messages
What I ended up doing was putting together a "ring of arcane storing" that functions somewhat like a sorcerer's version of the "ring of spell storing". I set each spell to use an even number of charges (2 or 4), then gave the item an odd number (7) of total charges; that way the item never vanishes from running out of slots. Casting a matching spell back into the item adds back two charges (via an _ci script), up to the maximum allowed. It seems to work okay. The item is a little more flexible than a "ring of spell storing", but still fairly limited.

Modifié par rjshae, 26 octobre 2010 - 07:29 .