• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Eval script not working on custom weapon vs standard weapon

madcatprimary

Active member
I've got an eval script here I cribbed from an item in the community dataset that seems to work great to add an ammo tracker to an weapon that uses the Capacity field.

perform container.parent.assign[User.Tracker]

container.parent.field[trkMax].value = container.parent.field[wCapacity].value

I found it on the laser sight, and trimmed it down so that instead of using the container.parent it just adds directly to the weapon.

perform assign[User.Tracker]

field[trkMax].value = field[wCapacity].value

This works if the weapon is not a custom weapon. When adding weapons to the Custom Weapons section, the value for trkMax comes up empty, like it didn't run the script, although it did add the tracker (just with a value of 0). In the tasks, the difference between a custom and standard version seems to be that Eval script 1 (thing) isn't present on the Custom weapon at Post levels/10000 as it is on the standard weapon. I tried changing the order, but it just doesn't show up at all for the custom item.

As far as I can see, the eval script is not running on the custom item.
 
You need to check in the script whether the pick running it is on the hero or in a container. If it is in the container, set the field and apply the tag to the container rather than the weapon itself.
 
Thanks for the reply. I can't find the Dwarven Boulder Helm. I have the ARG, but that doesn't appear to be in there. Is Hero Lab using a different source for that item?

That being said, when I try to apply the tracker to the container, that only works if the item is a custom/magic weapon, and the ordinary version gets nothing. Maybe I could do an if statement where it checks to see if it's a custom item, and applies one of the statements if it is, and the other if it's not?

There's a laser pistol in the system already that applies the tracker to both versions (magic and non-magic) by defining the trkMax value ahead of time, rather than getting the value from the wCapacity field. I think I'll just do that, since it's less overhead than having the script carry out the extra logic.
 
Dwarven Boulder Helmet is from ARG, if you're looking for it in the editor and not seeing it, the only thing I can think of is you might be looking on the wrong tab. It's a nonmagic weapon, not an armor.
 
Back
Top