Aller au contenu

Photo

Polymorphing and Items


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

#1
henesua

henesua
  • Members
  • 3 863 messages
Is it possible via scripting to equip a weapon on a polymorphed creature?

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Mavrixio found a way to do it for Sinfar. Likely it involves the linux nwnx and the ForceEquip function to directly equip an item bypassing the normal action queue.

#3
henesua

henesua
  • Members
  • 3 863 messages
Hmmm... that makes sense, but is unfortunate for me since I am trying to do all of this without NWNX. Nevertheless I'd still like to hear how exactly it was done. Thanks.

#4
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
While I've never tried to do this, I don't see why it'd need NWNX. Here's our ForceEquip function, with some server specific stuff cut out:

void ForceUnequip (object oTarget, object oItem) {
    if (!GetIsObjectValid(oTarget) || GetObjectType(oTarget) != OBJECT_TYPE_CREATURE)
        return;

    if (!GetIsObjectValid(GetArea(oTarget))) {
        DelayCommand(5.0, ForceUnequip(oTarget, oItem));
        return;
    }

    if (GetIsDead(oTarget)) {
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oTarget);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oTarget)), oTarget);

        //if (GetIsPC(oTarget))
        //    AssignCommand(oTarget, ExecuteScript("fky_deathprocess", oTarget));
//swap in your custom 'on resurrection' script above, if you have one
        DelayCommand(0.1, ForceUnequip(oTarget, oItem));
    } else {
        AssignCommand(oTarget, ClearAllActions(TRUE));

        AssignCommand(oTarget, ActionUnequipItem(oItem));
        AssignCommand(oTarget, ActionDoCommand(SetCommandable(TRUE)));
        AssignCommand(oTarget, SetCommandable(FALSE));
    }
}

In principle, it should work the same with ActionEquipItem, though I'm not sure what poly status will do to that. My experience with polymorphed critters mostly extends to shifter scripts (though those get fairly complicated what with the occasionally chaotic order of event firing).

Funky

#5
WhiZard

WhiZard
  • Members
  • 1 204 messages

FunkySwerve wrote...

In principle, it should work the same with ActionEquipItem, though I'm not sure what poly status will do to that.


That's the tough part.  Polymorph weapons are in the creature weapon slot, not what a standard weapon would normally equip into.  Creature weapons do have the advantage that you can set the base damage (but you can't set the damage type (beyond expanding it by an extra melee damage property) the critical multiplier or the critical threat range).  What you could do is copy the weapon properties over like Bioware did for equipment merges.

#6
Shadooow

Shadooow
  • Members
  • 4 470 messages

WhiZard wrote...

FunkySwerve wrote...

In principle, it should work the same with ActionEquipItem, though I'm not sure what poly status will do to that.


That's the tough part.  Polymorph weapons are in the creature weapon slot, not what a standard weapon would normally equip into.  Creature weapons do have the advantage that you can set the base damage (but you can't set the damage type (beyond expanding it by an extra melee damage property) the critical multiplier or the critical threat range).  What you could do is copy the weapon properties over like Bioware did for equipment merges.

Not quite. I haven't tried equip different item into polymorphed character as well, so I will simply assume its possible. Then:
1) normal weapons can be by default equipped into creature slots as well (but since it can be expl0itable I made a baseitems.2da modification that prevents it, its on vault)
2) creature weapons are used only if there is no valid object in right hand in first place. You can still equip the weapon into normal slot  and creature weapons will be ommited then.
Thus you dont need to copy item properties, assumed its possible to equip item on polymorphed character. Which probably isn't, the item would be then lost after unpolymorph. The Sinfair uses a custom engine hack to bypass the equipping process AFAIK.

#7
WhiZard

WhiZard
  • Members
  • 1 204 messages

ShaDoOoW wrote...
I haven't tried equip different item into polymorphed character as well, so I will simply assume its possible.


Then to get this out of the way I have tested this many times and have tested this again just to confirm.  In a polymorph, the normal inventory slots are not available for ActionEquipItem() while the creature slots are.  Sure you can equip an item into these, but there is no way to view the item or to disarm it.

Modifié par WhiZard, 20 novembre 2011 - 06:29 .


#8
henesua

henesua
  • Members
  • 3 863 messages
Whizard... I have not tried that. That is very useful information. I think along with all the rest in this thread, I've got a strategy for what I want to do. Prior to polymorph I check for an equipped weapon. After polymorph, I create a copy of the weapon and equip it to the creature slot. That should work well.

I'm still working on adapting some of the lycanthrope scripts right now, but will double back on getting weapons into the hands of wererats soon enough. (These are the Project Q wererat models)

Ah... just tested this... creature weapons don't display a model. So I'd need a complicated work around with an equipped weapon (from the polymorph equipped column), adjusting its apearance, merging properties etc... Hmm.... well I'll think about it.

Modifié par henesua, 20 novembre 2011 - 06:40 .


#9
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Deleted - misunderstood what you were trying to do here.

Modifié par Pstemarie, 20 novembre 2011 - 08:03 .


#10
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<putting on a tall, pointed white hat...>

henesua wrote...
Ah... just tested this... creature weapons don't display a model. So I'd need a complicated work around with an equipped weapon (from the polymorph equipped column), adjusting its apearance, merging properties etc... Hmm.... well I'll think about it.

Have you thought about altering the wererat to a "large" model (vice simple) and adding in the right hand node? Large creatures *can* equip weapons (they have the hand node to attach them to). Haven't looked at the Q Wererat, but if the node is present, try altering the anim type in the appearance.2da from s (simple) to l (large)...

Of course, I may be way off base here...

<...and sitting in a corner>

#11
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
The Q wererat does have the hand node.

#12
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<grins...>

WooHOO! There you go =)
Don't try to get around the "simple" anims... use the "large" ones.

<...like a rat in a cheese store>

#13
henesua

henesua
  • Members
  • 3 863 messages
the problem is not the model, but the way polymorph works. My aim is for players that become wererats to use their weapon when in the wererat form. Polymorph however does not allow items to be equiped to the normal equipment slots - only creature weapons.

Modifié par henesua, 20 novembre 2011 - 08:53 .


#14
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<frowns and...>

Haven't played with Polymorph (except in game) much. Thought it just used the appearance.2da for the model & animations, which would have made the right hand slot available if the wererat model was large instead of simple. I.e., thought it was the anim type that set those slots usable/unusable... else how does polymorph to certain humanoid shapes work?

Confused now.

<...puts the dunce cap back on>

#15
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Henesua, have you looked at the shifter functions in x2_inc_shifter. There are several functions that might interest you: ShifterMergeArmor, ShifterMergeItems, and ShifterMergeWeapon being the most notable.

Modifié par Pstemarie, 20 novembre 2011 - 08:52 .


#16
henesua

henesua
  • Members
  • 3 863 messages
I'll check them out, but I have looked at the wildshape spell which also accomplishes item merges.

#17
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

WhiZard wrote...

FunkySwerve wrote...

In principle, it should work the same with ActionEquipItem, though I'm not sure what poly status will do to that.


That's the tough part.  Polymorph weapons are in the creature weapon slot, not what a standard weapon would normally equip into.  Creature weapons do have the advantage that you can set the base damage (but you can't set the damage type (beyond expanding it by an extra melee damage property) the critical multiplier or the critical threat range).  What you could do is copy the weapon properties over like Bioware did for equipment merges.


You can equip any weapon you like directly to those slots. We do it all the time, to hide inappropriate weapon appearances. The purpose, of course, is to achieve the desired crit range and multiplier, though we originally did it in an attempt to boost abs with WM ab, before acaos wrote an engine hack to artificially raise ab.

The question is not whether or not non-creature slots are available to polymorphed critters, but whether the slots available behave the same as with a normal-nonpoly (I suspect they do).

Funky

Modifié par FunkySwerve, 20 novembre 2011 - 10:31 .


#18
WhiZard

WhiZard
  • Members
  • 1 204 messages

FunkySwerve wrote...
The question is not whether or not non-creature slots are available to polymorphed critters, but whether the slots available behave the same as with a normal-nonpoly (I suspect they do).


Are you actually testing this on polymorphed critters?  After one is fully polymorphed, nothing can be equipped into those slots (short of NWNX funcs if they can accomplish this).

#19
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<trying to get...>

henesua wrote...
the problem is not the model, but the way polymorph works. My aim is for players that become wererats to use their weapon when in the wererat form. Polymorph however does not allow items to be equiped to the normal equipment slots - only creature weapons.

Ok, so if I poly'd into a male drow (59), which comes equipped with a drow longsword (x2_wdrowls004), the weapon is equipped in my normal weapon slot, but I can not script a swap with another weapon? (Drow is "F" type appearance...)
Frost giant, another poly target that comes equipped is "L" appearance...

If the appearance has an anim type with a hand node and the polymorph type in polymorph.2da lists an equipped item, shouldn't we be able to swap an item (the weapon stored when poly'd, perhaps) with the equipped item and have the weapon appear in hand?

(edit: what is modeltype "FT"? In the appearance.2da for wererat (170)?)

<...a handle on the idea>

Modifié par Rolo Kipp, 21 novembre 2011 - 12:38 .


#20
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<blinking in the glare...>

Rolo Kipp wrote...
(edit: what is modeltype "FT"? In the appearance.2da for wererat (170)?)

Omnibus to the rescue: W=wings, T=tail... Got it :-)

<...as the light dawns>

Modifié par Rolo Kipp, 21 novembre 2011 - 12:51 .


#21
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<rooting around...>

Ben Harrison wrote (Omnibus)...
In polymorph.2da, enter the resref of an item blueprint in the EQUIPPED column of your polymorph type, and it'll be added to a polymorphed creature's inventory, and equipped automatically.
It's a good idea to make the polymorph type's CreatureWeapon1, CreatureWeapon2, and CreatureWeapon3 columns ****, also, to prevent equipped creature weapons from interfering with attack statistics.

Not precisely what we're looking for, either. But promising ;-)

<...in the cellar>

#22
Shadooow

Shadooow
  • Members
  • 4 470 messages

WhiZard wrote...

FunkySwerve wrote...
The question is not whether or not non-creature slots are available to polymorphed critters, but whether the slots available behave the same as with a normal-nonpoly (I suspect they do).


Are you actually testing this on polymorphed critters?  After one is fully polymorphed, nothing can be equipped into those slots (short of NWNX funcs if they can accomplish this).

I dodnt understand, so you responded to me its possible and now its not?

Rolo Kipp: I think henesua knows how to work with polymorph.2da, point is that he needs the weapon to be dynamic, while 2da allows to set only one specific and direct value.

A true solution could be a NWNX plugin that can Set2DAString, I think there is one for linux - but its only a theory.

#23
WhiZard

WhiZard
  • Members
  • 1 204 messages

ShaDoOoW wrote...

WhiZard wrote...

FunkySwerve wrote...
The question is not whether or not non-creature slots are available to polymorphed critters, but whether the slots available behave the same as with a normal-nonpoly (I suspect they do).


Are you actually testing this on polymorphed critters?  After one is fully polymorphed, nothing can be equipped into those slots (short of NWNX funcs if they can accomplish this).

I dodnt understand, so you responded to me its possible and now its not?


I have both times described that it does not work for non-creature slots.  Creature slots seem to deal damage as if there was something equipped after I used this command via script.

#24
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

WhiZard wrote...

FunkySwerve wrote...
The
question is not whether or not non-creature slots are available to
polymorphed critters, but whether the slots available behave the same as
with a normal-nonpoly (I suspect they do).


Are you
actually testing this on polymorphed critters?  After one is fully
polymorphed, nothing can be equipped into those slots (short of NWNX
funcs if they can accomplish this).


No...as I specifically said above, THAT is what I wasn't sure about. And sure enough, testing confirms it. Neither pcs nor npcs can equip a normal dagger (my test item) in either slot 4 or 14 (right hand and lclaw).

ShaDoOoW wrote...

A true solution could be a NWNX plugin that can Set2DAString, I think there is one for linux - but its only a theory.


Vman wrote one, and it works. And yeah, that's about the only option I can think of if you absolutely have to have it go on the fly, instead of editing polymorph.2da.

Funky

#25
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
It would have to be on the fly cause what he's trying to do is get a PC polymoprhed into a wererat to use whatever melee weapon the PC was armed with when he changed.