View Single Post
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old May 23rd, 2006, 10:30 AM
OK, request for direction on this one...

I have a unit that has a stat that it gets from its children. (drop)

The purpose of the stat is to caculate the cost of an option on the unit's children.

The long version:

The root unit is a Platoon.
The first child is a squad.
The second child is a trooper.
The third child is a drop capsule.

the drop capsule has this in its eval:

parent.unit.stat[drop] = parent.unit.stat[drop] + 1

The trooper has this in its postlink:

var woot as number
woot = unit.stat[drop]

if (woot = 1) then
parent.unit.stat[drop] = parent.unit.stat[drop] + 1
endif

What I wind up with is how many troopers have drop capsules as a unit stat at the squad level. So far so good, the stat adds up right and all is happy.

Now, in the unit squad, there is a option for the drop capsule that gets mirrored to the troopers.

I'm trying to write a cost script that will calculate the cost of the option at the squad level.

I'm trying similar to this in the cost script on the option:

var work as number
var price as number
work = this.unit.stat[drop]
price = @cost ~the cost for the option is only set on the unit getting it; the trooper but not the squad
@cost= (work * price)

This.....does not work


Easier way of computing that cost? I need to calculate how many troopers (I think I have that part down fine, I use it elsewhere and I'm very pleased with it) by the cost of the capsules....and I am brain locked. I can't use the built in mechanism since each trooper is a new unit.

Answer quickly, or I'll post my "Rename the unit based on its rank and armor" script, garunteed to hurt the brain of any actual programer :shock:

Thanks for any direction!
Bluefool is offline   #1 Reply With Quote