View Single Post
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old March 26th, 2006, 02:02 PM
First of all, I wasn't trying to belittle you in my previous response on this topic. I don't have the luxury of knowing "why" you asked a particular question on this end. If you take a look at all the posts we get on AB, there are many questions that are a simple overlooking of something by the user, usually due to the complexity of working with AB. From reading your post, I must have misunderstood things, because I interpreted it differently from your actual intent.

The reason that you aren't being able to figure out how to access stats on items is because they don't exist on items. Based on your example, the example in the docs that you reference, and the previous details of this discussion, I thought you were manipulating items as the children of units. Is that not the case?

In the example within the docs, I realize there are two separate unit stats being managed. But your last post eliminates the reference to the second unit stat, so that's what made me think you were ignoring the other unit stat and trying to solve it with one. I still don't understand why you eliminated the other unit stat, so maybe we need to start there and try moving forward again.

I'm going to assume you ARE managing items as the children of units. If so, the stats you need to be focused on apply to the containing unit. That's where everything gets tallied and is accessible. If an item needs to manipulate a stat, it should be manipulating the stat of the containing unit. This is exactly what's being done within the example in the docs.

At this point, I could easily be completely misunderstanding things, but I'm going to take a guess. I think that what's tripping you up is how to actually tally up the total number of points spent on items by each unit. This can be accomplished quite easily via the use of a special option that you might call "ItemTally". In the Cost script for this option, you would specify the one line below (change the name of the stat to match yours):
*** unit.stat[PtsUsed] = unit.stat[PtsUsed] + unit.cost[item]

You then need to assign this option to every unit. You can do this individually, or you can do this the easy way. If you create a linkset can designate it as "global", then add this one option to that linkset, you'll automatically add this option to every entity in the roster. By then modifying the option to specify a Live tagexpr of "entity.unit", you'll limit the option to only apply to every unit. The net result is that every unit automatically tallies the cost of items into the appropriate stat.

I took a look through this entire thread and I don't think you need to access the cost from a tag expression. Was there another thread I need to review? The topic of accessing a stat via tag expression came from your use of such an access in your earlier example. I think that was just a mistake in the usage that ended up sending us down a wrong path.

Anyways, please let me know if this solves the problem for you....

-Rob

At 04:34 AM 3/26/2006, you wrote:

Quote:
OK, I put this aside for a few weeks as it was making less and less sense why I ripped apart a functioning method to try to implement this. That aside now, I took a fresh look at it again after reading the documentation from cover to cover all over yet again.

Take a look at the example more closely. You'll see that there are TWO stats being used.

Thats why I asked why I was subtracting the same thing from itself. I knew that weeks ago, what I've been trying to figure out is how to assign a stat to an item. Since I changed all of this over to item based lists, there is no way I can find, and again after multiple re-reads of the docs, to assign a stat to an item.

So I have one stat that specifies the number of points the unit is allowed to spend assigned to the unit.

Now how do I get a second stat that will be useable in, as you say, a TAG EXPRESSION. The item can have exclusion groups. When I have tried to track that, I got slapped down for trying to use the wrong thing, so I know that can't be it. Well, if we're tracking it with a stat, you can't get an item to have a stat. How are you supposed to generate that second value to subtract??

One spcifies the maximum number of points that the unit is allowed to spend, and the second specifies the current total number of points that have been spent. You need to do the same thing with the item limit. You need one stat for the limit and another to track the usage. Then you can compare the two to perform the proper verification. You're currently trying to use the same stat for both the limit and the current usage. The only way that can work is if you subtract the usage from the limit for each item and then verify the total is >= 0.

So you can't subract something non-existant from something. Suprisingly, I did take first grade math and I knew that. What I need to know, is where in the documentation it talks about how to generate that second stat; becuase I've spent a great deal of tiem trying to find it and can't.
rob is offline   #11 Reply With Quote