Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder

Notices

Reply
 
Thread Tools Display Modes
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
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,005

Old May 25th, 2006, 02:16 PM
Hmmm. Based on the syntax you're using, I think there's a more fundamental point of confusion going on here. Either I'm not understanding your objective properly or you've misunderstood some of the scripts. You're using the "@cost" special symbol in your example. That symbol only applies to the ChildCost script, which is completely different from the Cost script (for which "@each" and "@single" are the symbols).

If I understand you correctly, your goal is to have the "Cost" script of the option for the drop capsule on the "squad" unit calculate the cost of all drop capsules for the "squad" and all "trooper" children. Assuming this is correct, then the script you have below is nearly correct. The only change should be a last line of "@single=work*price". You also have to define it as the option's "Cost" script instead of "ChildCost".

This brings up the question of what is motivating this particular approach? Is there a reason that you can't assign the cost to the drop capsulte child unit? Or to the option that attaches that child? This will yield more accurate information to the user, since each trooper unit will properly reflect the cost impact of the drop capsules associated with it.

Please give me more details on how the game mechanics work for constructing a platoon with squads and troopers. If I can understand how things need to work for the user, perhaps I can recommend an optimal way of setting up the data files to reflect that.

Thanks, Rob


At 11:30 AM 5/23/2006, you wrote:

Quote:
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
[img]./modules/mdforum/images/smiles/icon_biggrin.gif[/img] *

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 [img]./modules/mdforum/images/smiles/icon_eek.gif[/img]

Thanks for any direction!
rob is offline   #2 Reply With Quote
Bluefool
Member
 
Join Date: Jan 2006
Location: Iowa City, IA
Posts: 78

Old May 26th, 2006, 08:01 AM
Wrong symbol....AH! OK, still learning on much of the scripting, but OK, that makes sense now.

Now, the reason I'm using this method to try to compute the cost is....uh....

ops:

That I was working too long without a break and was trying to make something simple complicated ops:

Looking at it again after reading your post, I thought of course I must have done it diffrently for some reason...and after the 5 min it took to implement it correctly just now, realized that no, I had just tried to do something silly .

Well, I learned more about scripting at least.....

Thanks for the mental nudge
Bluefool is offline   #3 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:02 AM.


Powered by vBulletin® - Copyright ©2000 - 2019, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.