Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
ratboy
Member
Volunteer Data File Author
 
Join Date: May 2005
Location: Cedar Grove, NJ USA
Posts: 85
Send a message via ICQ to ratboy Send a message via AIM to ratboy

Old April 30th, 2006, 10:36 AM
Situation:

A trooper has an assault rifle. The assault rifle has an option to add a grenade launcher.

The Sgt of the trooper squad has the same assault rifle. If the grenade launcher is selected for the trooper(s), I would like it to be automatically added to the Sgt's assault rifle.

I can't use the mirror tag because that only works with the parent-child relationship.

I assume I would have to use a script, but for the life of me I can't figure it out.

+ Squad
|-- Trooper
|---Assault Rifle
|----Grenade Launcher
|---Sergeant
|----Assault Rifle
|-----Grenade Launcher
ratboy is offline   #1 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old May 20th, 2006, 02:12 PM
Based on your diagram, I'm going to assume that the Sergeant is a child of the Trooper unit. I'm also going to assume that the rifle option has an earlier evaluation priority than the sergeant, given the order that you've listed things in. If so, then the trick is to do as follows:

1. Define a tag that will be used to indicate that a grenade launcher is selected (e.g. "misc.grenade").

2. Within the Grenade Launcher option's Evaluate script, have it assign to tag to the grandparent entity. Alternately, you could have it assigned to the "unit", which will bypass the rifle (since its an "item"), or you could assign the tag directly to the "root" (i.e. the top-level entity/unit). How you choose to do this depends on what situations you're trying to cover.

3. Within the PreLinks script of the Assault Rifle, you need to essentially mirror the state of the "misc.grenade" tag. Since the PreLinks script for an entity is evaluated before any options, the rifle beneath the Trooper will not be affected - only the one beneath the Sergeant. This is accomplished by simply having an "if" statement that checks for the tag on the "root" and assigns it to the current entity, if present.

4. Within the link to the Grenade Launcher on the Assault Rifle, designate a link nature of "auto". Now add a "live" test that checks for the presence of the "misc.grenade" tag.

This will cause the grenade launcher to be auto-selected when it's chosen for the rifle equipped by the Trooper. Note that this solution assumes the evaluation sequence is conducive to it working.

Hope this helps,
Rob


At 11:36 AM 4/30/2006, you wrote:

Quote:
Situation:

A trooper has an assault rifle. The assault rifle has an option to add a grenade launcher.

The Sgt of the trooper squad has the same assault rifle. If the grenade launcher is selected for the trooper(s), I would like it to be automatically added to the Sgt's assault rifle.

I can't use the mirror tag because that only works with the parent-child relationship.

I assume I would have to use a script, but for the life of me I can't figure it out.

+ Squad
|-- Trooper
|---Assault Rifle
|----Grenade Launcher
|---Sergeant
|----Assault Rifle
|-----Grenade Launcher
rob is offline   #2 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 06:35 AM.


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