Aller au contenu

Photo

Question on placeable states


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

#1
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
 <dancing around the subject...>

Reading Knight_shield's activation thread on scripting and researching the things that have been done...

Makes me wanna do sumpin :-)

Here's the idea FWIW (knowing it's pretty far down on *my* list :-P

Put in a nice vertical portal frame (like the CEP Stargate)
Create 3 placeable vertical, concentric rings of glowing Address symbols (Edit: 9 states - off & 8 symbols at top)
Create 1 horizontal ring of glowing symbols that the PC stands in the middle of (Edit: 9 states - off & 8 symbols to "north")
Big red "Don't press" button for entering symbols

To dial in location, PC clicks on horizontal ring until symbol he wants rotates to index mark. Clicks the "enter" button.
Dials next symbol.  Meanwhile, from outside in, the address rings on the stargate light up (as activated) and rotate to the selected position.  When all 3 are activated, portal opens.

This would, I think require an absurd range of appearances.
But do the placeable "states" use up appearance rows? That is, if you create a placeable (horizontal ring) and give it 9 states (off, symbol one at north, symbol two, etc.) where are those textures/animations stored?

And of course - if they are guessing symbol order - on the third error, the horizontal ring irises closed and slices them in half =)

<...and getting blood on the carpet>

Modifié par Rolo Kipp, 26 août 2011 - 04:21 .


#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
It would be far easier to have the horizontal ring shift, or have the effects, since you could do everything described though clever uses of SetFacing then.
The address rings would have to be set to orient from the center of the horizontal stargate, so that they could appear to slide in a circle around the outer ring.

A bit of work for the initial placeable models needed, but the scripting itself to control it would be straightforward done that way.

#3
henesua

henesua
  • Members
  • 3 882 messages
As far as I am aware, all the states of a placeable are stored in the mdl file of the placeable. Which means that each placeable only uses one row of placeables.2da regardless of how complicated it is. Aren't states of a placeable just animations?

#4
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<puts his hands together...>

henesua wrote...

As far as I am aware, all the states of a placeable are stored in the mdl file of the placeable. Which means that each placeable only uses one row of placeables.2da regardless of how complicated it is. Aren't states of a placeable just animations?


That's what I'm hoping :-)

I'll look into it later, though I hope to hear some CC sermons before then :-)

<...and tries to look pious>

#5
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Well, this is hypothetical at this point but I believe you could possibly make a creature appearance as a placeable (i.e. make a creature look like a placeable) and get 20+ states in the form of Custom Looping Animations which are available to creatures (right?) and exposed in NWScript.  I first saw the effect in the colorable CEP crates which I believe are creatures that look like placeables so I think it's possible.

I've been working on getting those extra states without having to resort to the above shenanigans but haven't been successful so far.  If I can't get it to work I'll probably go that route though.  If you wanted to explore that method, Failed.Bard's suggestion of setting the facing could (again, theoretically) be applied to a creature instead of a placeable which would result in slightly smoother turning, I believe.

@Henusa - Yep.  So if one wants more states one either has to "overstuff" the model base with more animations and hope you can play them with NWScript or change the nature of the model (i.e. from placeable to creature) in order to allow you to do so.  Or some other as yet unknown (to me) trickery.

Any CCers have other methods for creating placeables with more animations (3+ looping) who would share how it's done?

Modifié par OldTimeRadio, 26 août 2011 - 05:27 .


#6
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<getting excited...>

Failed.Bard wrote...

It would be far easier to have the horizontal ring shift, or have the effects, since you could do everything described though clever uses of SetFacing then.
The address rings would have to be set to orient from the center of the horizontal stargate, so that they could appear to slide in a circle around the outer ring.

A bit of work for the initial placeable models needed, but the scripting itself to control it would be straightforward done that way.


I thought of that (SetFacing), but I'd want a smooth animation of the ring rotating to a new position (The ring I'm picturing, btw, is immaterial (walkthrough-able) but a usable placeable.

So, if the states are anim on the mdl, then I can tie the state of the address rings to the status of address registers set by the control ring (still working on terminology). Then I don't need to script anything (animation wise) except a change in state to the four objects (five counting the gate itself). And the exact placement or orientation of the placeables (except that the address rings would be 1cm in front of the gate and previous ring) would not matter.

This has implications for my enchanting system as well. I could use glowing rings of symbols that are selectable several places... Magic in Amethyst is based around the concept of "The Wheel Of Eight" which is actually three eight-element rings perpendicular to each other - Chaos/Order, Light/Shadow & Death/Life - only two of which apply to any given magic (Arcane, divine & natural).

To have the mage manipulate the spell components in a visual way (when composing a spell... not in combat) would be fantastic!

Hmmm...
 
<...and trying not to show it>

Modifié par Rolo Kipp, 26 août 2011 - 05:19 .


#7
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
I'll have to try it out a bit later to see for sure, but I think with a small loop you could do a smooth rotation.
I'll paste the code in for it later if I get something working decently well to show as an example, likely tonight or tomorrow though. I'm a bit curious now what sort of an effect I could get out of some of the placeables that way.

#8
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<shading his eyes...>

OldTimeRadio wrote...

Well, this is hypothetical at this point but I believe you could possibly make a creature appearance as a placeable (i.e. make a creature look like a placeable) and get 20+ states in the form of Custom Looping Animations which are available to players and exposed in NWScript.  I first saw the effect in the colorable CEP crates, which I believe are creatures that look like placeables, so I think it's not impossible.

I saw someone somewhere did this with "Islands creatures" to simulate movement at sea. But then you get into the immersion-degrading conversation thing to get anywhere. Hoping I can go with multi-state placeables :-)

I've been working on getting those extra states without having to resort to the above shenanigans but haven't been successful so far.  If I can't get it to work I'll probably go that route though.  If you wanted to explore that method, Failed.Bard's suggestion of setting the facing could (again, theoretically) be applied to a creature instead of a placeable which would result in slightly smoother turning, I believe.

@Henusa - Yep.  So if one wants more states one either has to "overstuff" the model base with more animations and hope you can play them with NWScript or change the nature of the model (i.e. from placeable to creature) in order to allow you to do so.  Or some other as yet unknown (to me) trickery.

Any CCers have other methods for creating placeables with more animations (3+ looping) who would share how it's done?

There are several placeables with 3 states... usually off/on/destroyed.  

Hmmm... there are 4 placeable animations (activate/deactivate/open/close) defined, but a *bunch* of "custom" animation types that look like you can use them... the question being if the 

ActionPlayAnimation (ANIMATION_ *constant*); (Edit: should be PlayAnimation() :-P)

will work on placeables with *any* animation constant, assuming the animation is present...

You'd have to know what constant was assigned to which anim, of course...

<...and looking into the distance>

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


#9
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Good point- I wasn't even thinking about the destroyed state.  I'm 99% sure the open/close animation states are hardcoded for 60 frames (and I believe speed up or slow down as necessary), which is why I went with on/off for my animating placeables as those animations don't have any kind of limit.

Hmmm... there are 4 placeable animations (activate/deactivate/open/close) defined, but a *bunch* of "custom" animation types that look like you can use them... the question being if the 

ActionPlayAnimation (ANIMATION_ *constant*);

will work on placeables with *any* constant, assuming the animation is present...


That's what I had problems with.  In the tests I ran I couldn't make, say, a placeable to play an ANIMATION_CUSTOM_LOOPING1 animation.  I've still not given up on it (I usually ignore test results, even my own, if I don't like the result :D) because I'd really like to have 60+ states for a placeable.  I'm not even sure what kind of crazy things could be achieved with that many states!

But I wouldn't mind finding out...:devil:

Modifié par OldTimeRadio, 26 août 2011 - 06:01 .


#10
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<leans back, looking suave...>

*This* is why I post here :-)
Thanks, OTR. Saved me a bunch of OCD this evening. Save me even more if I knew the approaches you took ;-)

But then, though I'm pretty excited about the whole thing (*enormous* implications for my marvelous modular magic system), I am not ready to work on this yet, except as an intill, intellek, er, thinking excercise :-)

<...in his comfy, worn leather chair with a snifter of Grand Mariner and his old full-bent briar>

#11
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages

Rolo Kipp wrote...
Save me even more if I knew the approaches you took ;-)

Really straight-forward testing.  I made a placeable using off/off2on/on/on2off which (as I mentioned) is my favorite method for doing airships because I can have an unlimited number of frames in each of those animations.  Then, after testing that worked (i.e. hadn't borked something on the model), I added custom1start, custom1lp, & custom1end animations to the model base, having geometry which moved during all three portions of the animation in the specified frame rangers so it should identify itself, visually, if it was working.  All tests were carried out using a lever-activated script which grabbed the placeable by its tag and applied the appropriate animation constant to attempt to switch states.

I may have tried some other animations relating to other animation constants but can't remember what they specifically were.  None of the tests seemed to work, though, so I put the idea on the shelf and went back to other projects.  I still think it's possible to "overstuff" placeables, maybe I botched my tests somehow.  Again, if none of that pans out, I'll turn attention to doing the creature-as-placeable and see if I can get farther.  There's just potential ickyness there that I want to avoid if possible and keep things as simple as I may.

Modifié par OldTimeRadio, 26 août 2011 - 06:51 .


#12
Rolo Kipp

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

Have you tried naming the anims after the appropriate creature anim for the constant (instead of the custom ones) and coopting a creature anim?

Like "ccastout", "ccastoutlp and "..." (can't find the name) using the constant ANIMATION_LOOPING_CONJURE1?

<...imponderables for fun>

#13
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
I believe I did try using animation names other than the custom looping if that's what you mean, but I can't recall which ones. If I find the demo module I'll pass it along with the test object otherwise I'll make another one sometime. Right now I'm (foolishly) trying to outwit the "*out of ammo*" message for custom ranged weapons and when I'm sick of that (I keep coming back to it and not being able to make any progress) I'll probably take another look at overstuffing placeables or at least see if the creature-as-placeable method works like I hope.

#14
henesua

henesua
  • Members
  • 3 882 messages
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.

The script would announce which integer it is doing, then play animation for that integer. wait 6 seconds or so, then iterate to the next. This would be a full test I think to figure this out.

Another option is to have a wand that tells an object to play the next animation. But this could develop carpal tunnel with all the clicking. I prefer the automated scripted loop. I can sit back with a scratch pad, piece of paper, and a nice drink while watching for good stuf to happen.

I want to add that I have used this same method for creatures. I had some models off the vault, and wanted to know which animations would work for them. It was a success.

Modifié par henesua, 27 août 2011 - 02:05 .


#15
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Excellent idea- that's really how to do this right. Lemme see what I can come up with.

#16
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<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 .


#17
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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.

#18
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
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 .


#19
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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 .


#20
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<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 .


#21
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
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.