Author Topic: Using items while polymorphed  (Read 462 times)

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Using items while polymorphed
« on: April 03, 2013, 10:58:03 am »


               I would like my shifter PC to have an ability to use items while polymorphed.
I found (in script forums archives) that the proposed solution was either by custom feat or spell.

I tried to make a potion with unique power, but it does not work - it can't target items, only PC.

1. I'm unsure how to "drop" custom player feat 1. onto the skin. On the other hand I know how to give spell to a polymorph(editing .2da). I have read Concept: OnPolymorphed and OnUnPolymorphed events without NWNX  so I guess I could edit my onequip if I knew what function I should use.
                  
                                                                            2. I'm unsure how to script feat/spell to force PC to use targeted item. It should check if polymorphed PC can use given item(like if he has the right alignment or race or simply check against given list of forbidden items).
While I guess the stuff like armour or weapons still can't be used/equipped, I would like that PC could use items like alchemist's bomb or custom items that grant other polymorphs/items with other special powers. Would I have to script every item with different code? Or could I just retrieve, for example spell, stored on a scroll/grenade item?
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Using items while polymorphed
« Reply #1 on: April 03, 2013, 05:10:07 pm »


               

werelynx wrote...

I would like my shifter PC to have an ability to use items while polymorphed.
I found (in script forums archives) that the proposed solution was either by custom feat or spell.

I tried to make a potion with unique power, but it does not work - it can't target items, only PC.

As I tried to explain in response to your pm, a potion can target whatever you like with script. What the item popup can and cannot target doesn't matter, at least for that purpose. Can you be more specific about what you're trying to do (why you're trying to target an item)?

1. I'm unsure how to "drop" custom player feat 1. onto the skin. On the other hand I know how to give spell to a polymorph(editing .2da). I have read Concept: OnPolymorphed and OnUnPolymorphed events without NWNX  so I guess I could edit my onequip if I knew what function I should use.

You would need two functions and this const to add player tool 1: IP_CONST_FEAT_PLAYER_TOOL_01

// Returns Item property Bonus Feat.  You need to specify the the feat
// constant(IP_CONST_FEAT_*).
itemproperty ItemPropertyBonusFeat(int nFeat)

// adds an item property to the specified item
// Only temporary and permanent duration types are allowed.
void AddItemProperty(int nDurationType, itemproperty ipProperty, object oItem, float fDuration=0.0f)

Bioware added some wrapper functions for adding ips, but I generally avoid them, and you likely wouldn't want them for this.

                                                                            2. I'm unsure how to script feat/spell to force PC to use targeted item. It should check if polymorphed PC can use given item(like if he has the right alignment or race or simply check against given list of forbidden items).
While I guess the stuff like armour or weapons still can't be used/equipped, I would like that PC could use items like alchemist's bomb or custom items that grant other polymorphs/items with other special powers. Would I have to script every item with different code? Or could I just retrieve, for example spell, stored on a scroll/grenade item?

If you're using NWNX, there's a function to force use of a specific item. Otherwise all you have to work with is Talent  functions. You might be able to force use of a healing potion reliably that way, but shifters can already use potions while shifted, so that doesn't accomplish much.

As per 1, you can create all those effects with custom functions, but yes, you'd have to code each of them. You don't have to use Unique Powers, though, as that just adds an unnecessary layer of events (unique power triggers spellscript nw_s3_actitem01, nw_s3_actitem01 triggers non-spellscript item activation script). Just hack a spell and appropriate it for your own uses in that particular situation. We've done this innumerable times for item special abilities and the like. Here's a copy of our Virtue spell, by way of example:
https://dl.dropbox.c...w_s0_virtue.nss

This technique has the added advantage of being able to tell what kind of unique power fired it, via spell id, allowing you to put multiple types of unique powers on a single item:

Activate Item 428
Activate Item Long 697
Activate Item Touch 795
Unique Power 386
Unique Power Self 413


If you explain with greater specificity what you're trying to accomplish, I can probably be of more help.

Funky
               
               

               
            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Using items while polymorphed
« Reply #2 on: April 03, 2013, 07:51:49 pm »


               Thank you for your reply '<img'>

FunkySwerve wrote...
a potion can target whatever you like with script

What I meant was:
1. I have eq of different items.
2. I polymorph and those items become unusable(red) even when they should not be like in case of polymorphing into a drow (or Lovely human Maiden)

3. Now what you say is that I could "mimic" all those items with the same amount of potions called "use XXX" like "Use fire grenade", "Use fancy item number 1", .... , "use fancy item number 999999" - I would have to create different potion for every item.

4. What I want is to have potion(or feat/spell) that I can target with every item in the inventory by means of clicking on feat/spell/potion and then choosing(with special icon) an item(target!);
Then it should do the item's job, like fire grenade(not at the most nearby enemy but at the location of player choosing)

If you're using NWNX

I should also mention the module I'm talking about is Single Player

Just hack a spell and appropriate it for your own uses in that particular situation

That would be nice but: how to add a spell to the skin? I've tried to do it in the toolset and checked it in game - I couldn't find a way to cast it. I'm aware I could add spells in polymorph.2da, but some polymorphs already use all 3 slots. I could replace them, I guess.

It seems like the best way was to make that a feat that can target(by a means of choosing feat then clicking on item) items. Then it would execute script similiar to your hacked virtue spell. If that's not possible I would have to "hack"  a spell.
Can such custom feat be a "spell-like" ability (like Shadow Dancer's darkness spell?) that can be chosen and then cast at item? (like a spell)
Where one can edit script for the mentioned feat? (or how should I call it?)
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Using items while polymorphed
« Reply #3 on: April 03, 2013, 09:20:03 pm »


               4. is not possible

Adding a spell to the skin is, but you wouldn't be able to use the skin to cast it. You would be able to use a feat, if it were on the hotbar, but I doubt it'd show up. You can try adding it to check, with
the functions I posted above, during the polymorph  - we add all sorts of props to our shifter's skins during ours. Some bioware feats have editable scripts; others are engine-level.

The polymorph.2da is your best bet, I suspect. Those will give you useable spells whose scripts you can code edits in. You could even toggle their effects with chat commands, if you wanted.

Funky
               
               

               
            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Using items while polymorphed
« Reply #4 on: April 05, 2013, 06:39:51 pm »


               Feat shows up and can "target" (click-on) items in inventory. Now the only thing remaining is to edit script governing the player tool 1.
I have found that it is called "x3_pl_tool01".

What I need to script is to activate "pointer" for items with let's say alchemist bomb so that I could choose a target instead of throwing it at nearest enemy.

How it should look like:
1. Click on hotbar (selecting custom player tool 1)
2. Click on Alchemist Fire (script checks item's tag and acts acordingly, calling for a pointer of "alchemist bomb's power")
3. Click on the target (some critter)
4. Target is on fire

Does such function exist in NWScript?
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Using items while polymorphed
« Reply #5 on: April 05, 2013, 07:43:34 pm »


               The targeter is controlled in the spells.2da, not by script.

Further, they're a playerside-required 2da, so you'd have to use a hak file if you wanted to add a new spell for targeting purposes. The column in question is TargetType, and you'd need to OR in bit 4 for area/ground. Here's the wiki on it:
http://nwn.wikia.com...da#Column_notes

Might be easier to find one that's already got that bit set.

Funky
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Using items while polymorphed
« Reply #6 on: April 05, 2013, 10:57:21 pm »


               

werelynx wrote...

Feat shows up and can "target" (click-on) items in inventory. Now the only thing remaining is to edit script governing the player tool 1.
I have found that it is called "x3_pl_tool01".

What I need to script is to activate "pointer" for items with let's say alchemist bomb so that I could choose a target instead of throwing it at nearest enemy.

How it should look like:
1. Click on hotbar (selecting custom player tool 1)
2. Click on Alchemist Fire (script checks item's tag and acts acordingly, calling for a pointer of "alchemist bomb's power")
3. Click on the target (some critter)
4. Target is on fire

Does such function exist in NWScript?

 


  This would be doable, using variables.  When you click on the item, it would store it as a local object on the player.  When you click on a target object, it would then have to check if there was a valid object stored, and if it was still in the user's inventory.  If so, then it would apply the effect based on the object type used.

  What you would have to watch out for, though, is that player tools are instant feats, so if there's not some sort of attack animation used, or spell cast, then they could unload an entire stack of alchemists fire in a single round, if not a single second, by rapid fire clicking.
               
               

               
            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Using items while polymorphed
« Reply #7 on: April 06, 2013, 12:15:26 pm »


               @Failed.Bard : you are right - I don't need another feat, targetting twice will do. Superb idea!
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Using items while polymorphed
« Reply #8 on: August 23, 2013, 03:32:18 pm »


               Oh, btw easy to accomplish via NWNX. I can add this into nwnx_cool if there is demand for that.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Using items while polymorphed
« Reply #9 on: August 23, 2013, 05:36:49 pm »


               That'd be great. That plugin doesn't sound familiar, though - is it win only?

Thanks,
Funky