• 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

Weapon Group (Exotic Double Weapons)

AWizardInDallas

Well-known member
What's wrong with this picture? :(

var result as number
var weapongrp1 as number
var weapongrp2 as number
weapongrp1 = #hasfeat[fWGrpSpLa]
weapongrp2 = #hasfeat[fWGrpDbl]

if (weapongrp2 = 1) then
if (weapongrp2 = 1) then
result = hero.assign[WepProf.wUrgroshDw]
result = hero.assign[WepProf.wAxeOrcDbl]
endif
endif

result = hero.assign[WepProf.wHandaxe]
result = hero.assign[WepProf.wBattleaxe]
result = hero.assign[WepProf.wGreataxe]
result = hero.assign[WepProf.wWaraxeDw]

I'm trying to grant two additional weapon proficiencies if the hero has two addtional feats (i.e. Weapon Group (Exotic Double Weapons). I'm doing this in an eval script rather than validation so I'm not sure #hasfeat works in an eval script. I'm also assuming it returns a 1 if it finds the feat. Little help please?

I'm really looking forward to the Authoring Kit, let me tell ya! :)
 
The #hasfeat[] macro should work in any script - validation or eval. What timing are you using?

To find the documentation for #hasfeat, open help from the editor, then select "Reference Information", and scroll down slightly.

MayI suggest the following lines (after you set the values for weapongrp1 and 2 to help you figure out what's going on:

debug weapongrp1
debug weapongrp2

after putting those in your code, add whatever holds this script to your hero, then go to the debug window - floating info windows - show debug output

and don't forget that:
perform hero.assign[WepProf.wUrgroshDw]

replaces the need to create result and then use it.

Oh yeah, and since both feats need to be present, how about this to save a few lines of code:

hasfeats = #hasfeat[fWGrpSpLa] + #hasfeat[fWGrpDbl]

if (hasfeats >=2) then
 
I like it! Okay revised code:

var hasfeats as number
hasfeats = #hasfeat[fWGrpSpLa] + #hasfeat[fWGrpDbl]

perform hero.assign[WepProf.wHandaxe]
perform hero.assign[WepProf.wBattleaxe]
perform hero.assign[WepProf.wGreataxe]
perform hero.assign[WepProf.wWaraxeDw]

debug hasfeats

if (hasfeats >= 2) then
perform hero.assign[WepProf.wUrgroshDw]
perform hero.assign[WepProf.wAxeOrcDbl]
endif

Phase: First, 100, 1

The only thing it doesn't do is the if condition. Debug doesn't seem to display anything that I can see?
 
So what that tells you is that at that timing, the #hasfeat[] macro doesn't detect that those feats have been added.
 
So, try the same script in the final phase - if that doesn't work, there's something else wrong. Once you've established with the debug output that you can detect the presence of the feats, keep trying other phases to establish when you can both detect the previous feats, and set the new weapon proficiencies.
 
mgehl said:
So, try the same script in the final phase - if that doesn't work, there's something else wrong. Once you've established with the debug output that you can detect the presence of the feats, keep trying other phases to establish when you can both detect the previous feats, and set the new weapon proficiencies.

Debug returns '2' now but the two proficiencies (orc axe and urgosh) are not being added. I've even split the code into two phases. I'm also not sure why my axes weapon group is grayed out (my test subject is a 19th level wizard, definately not an axe user). Here's the code:

Weapon Group (Axes)
Eval #1: First (Users), 100, 1 (Works)
Code:
perform hero.assign[WepProf.wHandaxe] 
perform hero.assign[WepProf.wBattleaxe] 
perform hero.assign[WepProf.wGreataxe]
perform hero.assign[WepProf.wWaraxeDw]
Eval #2: Post-Levels (Users), 100, 2
Code:
var hasfeats as number 
hasfeats = #hasfeat[fWGrpSpLa] + #hasfeat[fWGrpDbl]

debug hasfeats

if (hasfeats = 2) then 
  perform hero.assign[WepProf.wUrgroshDw]
  perform hero.assign[WepProf.wAxeOrcDbl] 
endif
Weapon Group (Lances)
Eval #1: First (Users), 100, 1 (Works)
Code:
perform hero.assign[WepProf.wJavelin]
perform hero.assign[WepProf.wLance]
perform hero.assign[WepProf.wLongspear]
perform hero.assign[WepProf.wShortspr]
perform hero.assign[WepProf.wTrident]

Eval #2: Post-Levels (Users), 100, 2
Code:
var hasfeats as number 
hasfeats = #hasfeat[fWGrpAxes] + #hasfeat[fWGrpDbl]

debug hasfeats

if (hasfeats = 2) then 
  perform hero.assign[WepProf.wUrgroshDw] 
endif

Weapon Group (Exotic Double Weapons)
Just a pre-req...
Code:
if (child[Attack].field[tAtkBase].value >= 1) then
  @valid = 1
endif
 
Something else... the two weapons are not grayed out in the weapon selection list, so that leads me to believe they are being granted. But the message "You are not proficienct with this weapon." still appears next to each.
 
There's a lot of time between First and PostLevel, keep trying earlier times to find something that accomplishes both tasks.

For your second message, I'll bet different parts of the code govern whether a weapon is greyed out in the selection screen and whether you are a proficient with a weapon in your weapon list. You've probably got your timing inbetween those two scripts, so the weapon selection code happens later, and sees that you are proficient, the weapon chooser code happens before what you're trying, so when its script runs, you aren't proficient with the weapons.
 
I'm trying to enter the weapon groups from the Unearthed Arcana. The double weapon and exotic weapon groups make things real interesting. I've managed to figure out that First (Users) works well for the first part, just assigning the individual weapons. Anything earlier than Post-Levels (Users) produces a '0' rather than a '1' or '2' for the second part. Both the weapon list and feat list show what they should now, so they're working perfectly. So it really looks like the double weapons ARE being assigned by the hasfeat if...then. The only thing not working is that each double weapon shows the error message "You are not proficienct with this weapon." and the little gray cancel symbol. The things that all the weapons have in common? They all require the exotic weapon proficiency under normal circumstances.
 
In that case, the thing to test is to add proficiency in one of the exotic weapons without using any if...then statement -what you want to do is figure out if that will work on its own, and if not, what's missing.

You may also want to add an exotic weapon, then look at the weapon's tags and fields (right click on the weapon once selected). Keep those info windows open, add (the normal version of) exotic weapon profociency for that weapon, and watch for what changes in the weapon's tags and fields - once you know that, look into what your script needs to do to make those changes.
 
Interesting stuff... thanks for the debug lesson! The proficiency can be granted without the IF...THEN in the First or Pre-Levels phase. Any later than that and weapon assignments fail. The #hasfeats macro won't operate in either of these phases (i.e. returns '0'). It seems to like the Post-Levels phase and weapons can't be assigned and work in the Post-Levels phase. So, basically it looks like there's a "same phase" conflict: can't use both #hasfeats and assign weapons in the same Post-Levels phase. Also, the difference is a pick tag called Helper.Proficient. All of this leads me to believe that I can't use #hasfeats for the conditional in the Post-Levels phase. So I need some other way to build the conditional that will work in this phase. So what's the non-macro way for looking for a feat?
 
hero.pickexists[fWGrpAxes] or hero.tagis[HasFeat.fWGrpAxes] - as usual, 0 means it doesn't exist, 1 means it does. In the debug menu, "floating info windows", select "hero tags" to see what you can find with tagis[], and choose "Show Selection List" to see what you can find with pickexists[].
 
Problem solved. Here's the final working code for the two feats (all done without splitting phases and all done in the First (Users) phase:

Weapon Group (Axes)
Code:
perform hero.assign[WepProf.wHandaxe] 
perform hero.assign[WepProf.wBattleaxe] 
perform hero.assign[WepProf.wGreataxe]
perform hero.assign[WepProf.wWaraxeDw]

var hasfeats as number 
hasfeats = hero.pickexists[fWGrpSpLa] + hero.pickexists[fWGrpDbl]

if (hasfeats = 2) then 
  if (hero.pickexists[wUrgroshDw] = 0) then
    perform hero.assign[WepProf.wUrgroshDw] 
  endif
  perform hero.assign[WepProf.wAxeOrcDbl] 
endif

Weapon Group (Lances and Spears)
Code:
perform hero.assign[WepProf.wJavelin]
perform hero.assign[WepProf.wLance]
perform hero.assign[WepProf.wLongspear]
perform hero.assign[WepProf.wShortspr]
perform hero.assign[WepProf.wTrident]

var hasfeats as number 
hasfeats = hero.pickexists[fWGrpAxes] + hero.pickexists[fWGrpDbl]

if (hasfeats = 2) then 
  if (hero.pickexists[wUrgroshDw] = 0) then
    perform hero.assign[WepProf.wUrgroshDw] 
  endif
endif

I'm even being nice and making sure the Urgrosh doesn't get assigned twice. :)
 
Back
Top