Username:


Password:


Remember me


  • Find Us On Facebook



sm_Tags.sm6_unlok Question

Have a question about how to do something in the datafiles? Ask it here, we'll help if we can. NOTE: We cannot teach you how to use ABCREATE or how our files work, we don't have the time.

sm_Tags.sm6_unlok Question

#1  Postby Mettius » Wed Jan 14, 2015 12:37 am

For the life of me I can't figure out how something is working.

In the ba7E_Dat.dat file the Pre-link Script for Tactical Squad has the below code. This should allow the 2nd special or heavy weapon for the squad. I'm confused as to how? A search of several of the source files doesn't show the variable unlockWpn used anywhere else. (Similar searching for sm6_unlok doesn't seem to drum up anything).
Can anyone shed some light on how this code actually enables the options in AB?

Code: Select all
~Unlocking special and heavy weapons once model count is increased to 9
var unlockWpn as number

if (count[model] >= 9) then
   unlockWpn = entity.assign[sm_Tags.sm6_unlok]
endif
User avatar
Mettius
Conscript
Conscript
 
Posts: 15
Joined: Wed Dec 26, 2007 12:00 am
Location: Austin, Texas USA

Re: sm_Tags.sm6_unlok Question

#2  Postby Homer_S » Wed Jan 14, 2015 3:25 pm

You will find it in the live tag expression for a couple of links, when the files are ready for prime time. You are peeking behind the curtain... ignore the man in there. It does, however, show how to do conditional availability of options based on size. Another way is to use one of the gnStat statistics to calculate some ratio based on squad size. Such as "1 Reaver for every 3 models in the unit may..." in the Dark Eldar files.

Homer
The only "hobby" GW is interested in is lining their pockets with your money.
User avatar
Homer_S
Site Admin
Site Admin
 
Posts: 1492
Joined: Thu Nov 16, 2006 12:00 am
Location: Libertyville, IL, USA

Re: sm_Tags.sm6_unlok Question

#3  Postby Mettius » Thu Jan 15, 2015 5:04 am

Thanks. Didn't realize that file wasn't "live" yet.

For the reaver code example. I'm admittedly having a spot of trouble with following it. I'm happy to post on the Lone Wolf forum if that is better for what is really an ABC learning question, but in case anyone wants to help grant sight to this blind man...

For this code:
Code: Select all
var retval as number
retval = children.assign[deTags.deChReaver]

retval = count[effective]/3
retval = round(retval,0,-1)

unit.stat[gnStatA] = unit.stat[gnStatA] + retval
unit.stat[gnStatB] = unit.stat[gnStatA]

retval = count[basic]/3
retval = round(retval,0,-1)

unit.stat[gnStatC] = unit.stat[gnStatC] + retval

if (retval > 0) then
  retval = children.assign[deTags.deGnStatC]
endif


I'm missing something which must be glaringly (but I'm blind to it) basic and obvious...retval being a number variable is presumably assigned an integer from "children.assign[deTags.deChReaver]. From the AB docs children.assign assigns the specified tag to all children of the current entity. If I was just looking at code like:
Code: Select all
children.assign[deTags.deChReaver]

I would expect we are assigning the deChReaver tag to each child entity of this entity. Or is this a compound statement which assigns the tag to each child and then the number of said tags existing are assigned to the variable retval?

What are the children? (is deDrugs1 a child entity?) That doesn't seem to be helpful.
User avatar
Mettius
Conscript
Conscript
 
Posts: 15
Joined: Wed Dec 26, 2007 12:00 am
Location: Austin, Texas USA

Re: sm_Tags.sm6_unlok Question

#4  Postby Homer_S » Thu Jan 15, 2015 11:56 am

Using retval to do my counting was just lazy, I didn't want to have to declare a new variable... children in this case are entities: units and possibly squads or items? I don't think options can have tags.

retval = children.assign[TAGNAME]

Assigns TAGNAME to all children of the unit. I just ignore what retval is technically doing, it is required to be a defined number variable by whatever language we are using.  Look at the Herald of Slaanesh unit with a Chariot. A tag is assigned to the children to remove the chariot's normal rider when it is taken as a mount. The name is just one we have all adopted.

The construction makes more sense if you are are reading a value back, such as this.

count = children.tagcount[TAGNAME]

This should count all the occurences of TAGNAME assigned to children of the unit and store the value in the number variable count.

I'm a firm believer in reduce/reuse/recycle. If you look at most races I have done recently, there are only one or two "sergeant" units. The active options, costs and stats are all controlled by being chReaver or chWracks tags and linksets. There is a limit point, I have noticed several times a compile warning on the number of assigned links a unit can have. At that point, I have to logically split the sergeant, say by charElite and charUpgrd or something.

Homer
The only "hobby" GW is interested in is lining their pockets with your money.
User avatar
Homer_S
Site Admin
Site Admin
 
Posts: 1492
Joined: Thu Nov 16, 2006 12:00 am
Location: Libertyville, IL, USA

Re: sm_Tags.sm6_unlok Question

#5  Postby Mettius » Fri Jan 16, 2015 8:02 am

So with the way AB's scripting language works, one cannot simply assign the tag to the entity's children?
as in: children.assign[TAGNAME]

I think I see...
(Read-Only) Assigns the specified non-global tag to all children of the current entity. The tag must be
specified using the standard "group.id" syntax. The tag is verified to exist during compilation of the script.
Always returns a value of zero. Example: "children.assign[category.elite]".


So in this case retval is set to "0" initially as that is what is always returned by children.assign. Then you are simply overwriting that "0" value subsequently. Correct?
User avatar
Mettius
Conscript
Conscript
 
Posts: 15
Joined: Wed Dec 26, 2007 12:00 am
Location: Austin, Texas USA

Re: sm_Tags.sm6_unlok Question

#6  Postby Homer_S » Fri Jan 16, 2015 11:38 am

Mettius wrote:So with the way AB's scripting language works, one cannot simply assign the tag to the entity's children?
as in: children.assign[TAGNAME]

I think I see...
(Read-Only) Assigns the specified non-global tag to all children of the current entity. The tag must be
specified using the standard "group.id" syntax. The tag is verified to exist during compilation of the script.
Always returns a value of zero. Example: "children.assign[category.elite]".



So in this case retval is set to "0" initially as that is what is always returned by children.assign. Then you are simply overwriting that "0" value subsequently. Correct?

Sure.

Homer
The only "hobby" GW is interested in is lining their pockets with your money.
User avatar
Homer_S
Site Admin
Site Admin
 
Posts: 1492
Joined: Thu Nov 16, 2006 12:00 am
Location: Libertyville, IL, USA


Return to Datafile Programming Support

Who is online

Registered users: No registered users

cron