Author Topic: Question on placeable states  (Read 624 times)

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Question on placeable states
« Reply #15 on: August 27, 2011, 05:51:11 pm »


               <Furiously pedaling an infernal contraption...>

henesua wrote...

Those animation constants are only stand ins for integers. If you want to figure out whether any integers links to the animations stored on the model, you should write a script that cycles through everything from 0 to 255.


Beautiful!

And I should have thought of it :-/

 *That* said, I enjoy using, er, working with helper-creatures :-) (witness my pathfinding searchers in the SummonPack script). And if that's the only way to get access to a large number of states, I'll gladly (or at least willingly) go that route.

If the placeable struct is simply too limited (only four anim structs) and we have to go the inanimate-animated creature route (I do *so* love oxymorons!), how could we:

  1. Stop the object from considerately bumping out of the way of PCs? I.e. pin it in place?

  2. Give it such a tiny pers space and big geometry that a PC could appear to be inside it (thinking of my floating ring of symbols? Hmm, perhaps having the walk-mesh/material part of creature off-center of the effect?

Sure, they're icky sometimes... but that's why you keep a rag in your pouch, right? =)

<...cycling through various emotional states>
               
               

               


                     Modifié par Rolo Kipp, 27 août 2011 - 05:06 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Question on placeable states
« Reply #16 on: August 27, 2011, 06:51:31 pm »


               EffectCutsceneGhost() solves the bumping issues, at least 95% of them.  A creature under that effect does still seem to have a minisule center point that you can bump against, but it seldom comes into play.
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Question on placeable states
« Reply #17 on: August 27, 2011, 07:16:21 pm »


               Ok, first a bit of an update about what I did and what my findings were:

I'm simply too lazy this morning to do loop a to cycle through all the animation constant integers.  Or rather, I haven't scripted even something simple like that in so long I was too lazy to relearn it.  But your idea is the best way to do it, Heneusa.  What I did do was hook up an OnChat so the integers I spoke would be applied to the placeable.  This was very quick for me to do and it got me 90% of what I wanted, anyway. 

The model I used was c_antoine and I chose him because unlike most (all?) other creature models, he comes with a fairly complete set of animations and he's not supermodeled into anybody or anything.  I was going to go with a tail but the sample I loaded up didn't have as many animations as I thought it should.  Anyway, c_antoine's local animations (not supermodeled) keeps it tight and gives me the surety that if he didn't display an animation it wasn't because there was something breaking with the supermodeling.  He's got bow, etc.

What I did was rename his model base to plc_a01 and export him (no need to reset the animroot because the anims are animrooted to the rootdummy instead of the modelbase).  Then in a text editor (NotePad++ FTW) and changed his first few animation names to on, off, and a few other ones related to placeables.  But I left the bulk of his animations untouched.

The results: No luck.  Or, more accurately, no luck for integers other than the 200-203 range (which are for placeables) but no love for anybody else.  Any attempts to get him to play animations other than those had absolutely no effect.  It seems that placeables are more structured (animation-wise) than I thought.  NWN, IMO, is overly forgiving as a general rule and I think the reason why it's so structured for placeable animations is because the states for placeables have a distinct pattern of flow whereas creature animations don't necessarily do.  For instance, as a creature I could go from walking to spasming to casting a spell, say, and that would make "sense".  Such is the unpredictable life of a creature model.  But as a placeable (activatable placeables for example), there's a definite "flow" from off to off2on to on to on2off and so they're more rigid because their functioning dictates it.  At least that's my hypothesis, anyway.  Also, and I give this sort of thing more weight than others might, those off/off2on/on/on2off/open/close animation name strings are in a different part of the nwmain.exe than the other animations.  Again, maybe a portend of nothing to anyone but me.

Want to play with it yourself?  Download it HERE.  Extract the module to the modules folder, the plc_a01.mdl to your override folder and go to town.  The antoine on the right will be moving when you first launch the module.  He's set to "deactivated", the other is not moving- he's not set to anything.  On loading just speak an integer and see what he does.  It helps to have the NWN Lexicon open to the animation constants section.  The OnChat script is called "chatanimfnf" but that's just because it doesn't include a duration or a speed in the ActionPlayAnimation- I was sending out durations and speeds in some of the other scripts I'd tried for OnChat and I just wanted to make sure that wasn't getting in the way of getting a FNF (like head turn) to play.

Rolo Kipp wrote...
 *That* said, I enjoy using, er, working with helper-creatures :-) (witness my pathfinding searchers in the SummonPack script). And if that's the only way to get access to a large number of states, I'll gladly (or at least willingly) go that route.

If the placeable struct is simply too limited (only four anim structs) and we have to go the inanimate-animated creature route (I do *so* love oxymorons!), how could we:

  1. Stop the object from considerately bumping out of the way of PCs? I.e. pin it in place?

  2. Give it such a tiny pers space and big geometry that a PC could appear to be inside it (thinking of my floating ring of symbols? Hmm, perhaps having the walk-mesh/material part of creature off-center of the effect?


Those were some of the things I was hoping to avoid dealing with as well. Solutions like Failed.Bard's are going to come in handy to work around any issues like that.  Basically whatever the least number of steps to get a creature completely immobile but still with the ability to play animations would be what I think I'm looking for.
               
               

               


                     Modifié par OldTimeRadio, 27 août 2011 - 06:17 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Question on placeable states
« Reply #18 on: August 28, 2011, 07:24:24 pm »


               I played around a bit with rotation through SetFacing(), and it's definately not ever going to be as smooth as an animation or VFX.  It it is still possible to get an interesting effect out of it, however, adding a glow to the stone circle placeables I used.  The glow also helps to blur the choppy nature of the rotation, which is only done every .1 seconds.

Video of the test here:



and the script I used for it.  It applies 120 rotations,  0.1 seconds apart, to each of the six rings.  The rotational change is d20() + 5 degrees, the random just so that each ring would move somewhat out of sync with the others.  With this particular placeable 12 degrees per cycle seemed to be the best for set rotation.

void main()
{
 object oTarget;
 ActionPlayAnimation (ANIMATION_PLACEABLE_ACTIVATE);
 float fDelay, fFacing;
 int i, n;
 for (n = 0; n<= 5; n++)
        {
         oTarget = GetObjectByTag ("TEST_P_ROTATE", n);
         ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectVisualEffect(408 + (n * (d2() + 1)) ), oTarget, 15.0);
        }

 for (i; i <= 120; i ++)
    {
     for (n = 0; n<= 5; n++)
        {
         oTarget = GetObjectByTag ("TEST_P_ROTATE", n);
         DelayCommand (fDelay, AssignCommand (oTarget, SetFacing (GetFacing (oTarget) + 5.0 + IntToFloat (d20() ))) );
        }
     fDelay += 0.10;
    }
 }

With SetPosition from NWNX (linux only I believe), it would be possible to make the six rings rise upwards from the floor on activation, but since I run win NWNX I couldn't try that aspect of it.

Maybe not useful overly, but an interesting effect overall I thought.
               
               

               


                     Modifié par Failed.Bard, 28 août 2011 - 06:25 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Question on placeable states
« Reply #19 on: August 29, 2011, 06:43:06 pm »


               <Shuffling the deck...>

For horizontal rotation, that actually works pretty good...

And if you throw in three anim states, you could actually get three-part coordinates/keys/symbol-sets from manipulating a single item :-)

Example arcane: Player activates a tome (in inventory). A symbol ring (Activated anim) is placed 1cm away from his foot (making him appear to be surrounded by 8 animated magical symbols - ). Using the ring rotates it 45 degrees (and stores the number of clicks) until he activates the ring's self-only power, which stores first symbol and changes to second set of symbols (Open anim). Etc for third symbol set, final activation pulls up target pointer and casts the spell (effect,modifier,power-source) on the target... (obviously only for very powerful custom spells...;-)

It's a start :-) Thanks F.B

<...and dealing from the bottom>
               
               

               


                     Modifié par Rolo Kipp, 29 août 2011 - 05:43 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Question on placeable states
« Reply #20 on: August 29, 2011, 08:04:08 pm »


               Very cool demo!  I'm not sure I'll have anything more useful to contribute until I attempt a full model-as-placeable conversion so I probably won't be posting much on this until then.  After looking at what appears to be available, I guess it really depends on what exactly you want to create placeable-wise.

What I'll be shooting for are two placeables, the first which will be a vertical version of this style of bike lock (think a big stone pillar cut into rotating segments with letters, numbers around their circumfrence) and/or this style of lock dial as as something floor-mounted which revolves around the Z axis.

I think those guys are probably going to require different approaches but that's what I'm shooting for, anyway.