LarryG on 23/5/2015 at 04:47
Has anyone had any success using the Public Script version of the TG script ModelByCount?
Quote:
<dl><dt id="modelbycount">ModelByCount</dt><dd>gen.osm G
Sets <code>Shape\Model Name</code> to one of the <code>Model
n</code> fields of <code>Tweq\Models</code> based on the value of <code>Engine Features\Stack Count</code>. The model number is one less than the stack count. <code>Model 0</code> is used if the count is 1 or less, and <code>Model 5</code> is used if it is 6 or more. The model is updated when the object is <code>Contained</code>.
</dd></dl>
Quote:
[h=1]ModelByCount[/h] Changes the shape of the object based on the stack count. This makes a combining object look different when more pieces are picked up. But it does not change the shape when it is dropped or used. So it should only be used for objects that cannot be dropped or frobbed in inventory.
[TABLE="class: inline]
<tbody>[TR="class: row0]
[TH="class: col0]Inherits [/TH]
[TD="class: col1 leftalign] BaseScript [/TD]
[/TR]
[TR="class: row1]
[TH="class: col0]Messages [/TH]
[TD="class: col1 leftalign] <kbd>Contained</kbd>, <kbd>Create</kbd> [/TD]
[/TR]
[TR="class: row2]
[TH="class: col0]Properties [/TH]
[TD="class: col1 leftalign] <kbd>(
http://dromed.whoopdedo.org/dromed/property/stackcount) Engine Features\Stack Count</kbd>, <kbd>(
http://dromed.whoopdedo.org/dromed/property/cfgtweqmodels) Tweq\Models</kbd>[/TD]
[/TR]
</tbody>[/TABLE]
I thought it would be simple. Just set up the Tweq > Models to point to up to 6 different models. Set the stack count to 1, and the combine type so that the concretes would stack. And that would do it. It doesn't. Any suggestions?
john9818a on 23/5/2015 at 06:03
Does it matter if the ModelsState is On or Off?
LarryG on 23/5/2015 at 10:03
If Model state is On, then the tweq is active, and runs through the models before you ever pick the object up, which is not the intent. The idea is that it looks like one thing in the world, and looks like something else in inventory, and something different every time a new one is contained, up to 6 in inventory. So it can be a food item in the world, start as a nearly empty sack in inventory, and as food is picked up the sack becomes fuller looking. Or say, as a single banana in-world, but as you collect bananas, it shows as a hand of bananas with increasing number of bananas on the hand, up to six bananas.
Edit: I just tried changing the stack count on the concrete, and the object model changes in-world. It just doesn't change in-inventory as stack count changes, which was, I thought, the whole point. That's what I took "The model is updated when the object is Contained" to mean. Maybe the TG version works that way, but the Public Scripts version doesn't change when contained. It changes in-world and not when contained.
Nameless Voice on 23/5/2015 at 10:25
You might need to switch away from and back to the object in your inventory to see the change?
LarryG on 23/5/2015 at 10:30
Good thought ... I just tried that, and nope, that isn't it. I also looked at pubtest-t2.cow, which comes with the .osm, and the script ModelByCount isn't used there, so maybe it was never tested and just doesn't work properly. Damn.
Telliamed on 23/5/2015 at 19:23
It doesn't work because it never worked. Not even the original. The inventory model doesn't get updated in real-time so it's impossible to do what you think it does.
Except it does get updated because you can activate a joint tweq and the model will animate. Only changing the model name doesn't do anything. Hey NewDark guys, wanna do something about that?
edit So RSoul's post below illustrates a loophole that I had never considered. Changes in the metaproperty will update the inventory model. If you tried to change the ModelName on the object directly it wouldn't work. Damn, why didn't I think of that five years ago
Random thought: Has anyone ever linked to a concrete object as a metaproperty?
R Soul on 23/5/2015 at 19:43
We need to have a BBCode that generates the phrase "It can be done with NVScript".
With the first object (e.g. an empty sack using your food example), edit the archetype (or add a new metaprop) with the following:
Scripts: NVMetaTrap
Design Note: NVMetaTrapOn="Combine"; NVMetaTrapMeta="M-Model2"
Make another metaprop called M-Model2
Model Name = second model
Design Note: NVMetaTrapMeta="M-Model3"
Meta prop called M-Model3
Model Name = third model
Design Note: NVMetaTrapMeta="M-Model4"
and so on.
For the final metaprop you just need to specifiy the model name. NVScript ensures you don't get duplicate metaprops, but you could put in NVMetaTrapOn="null" if you want. You'll notice you don't need to repeat the On paramater because NVScript reads each parameter like a normal property (i.e. it reads all parent design notes).
LarryG on 23/5/2015 at 20:50
I'll try it. Thanks.
Edit: Worked like a charm! Thanks. I was thinking along similar lines, but I would have tangled myself all up in removing metaprops as well as adding them, and maybe with using a qvar to record the stack count. Your way is MUCH simpler. Thanks again.