Senior Member
Join Date: Oct 2016
Posts: 621
|
I need to know if I am on the right track here
I am coding a custom ability that causes 1 handed weapons in your offhand to be treated as light weapons My logic looks like this Final/1000 Code:
~ If we're disabled, do nothing doneif (tagis[Helper.SpcDisable] <> 0) ~If there is nothing in the offhand, get out now doneif (hero.tagis[Hero.EquipOff] <> 1) foreach pick in hero from BaseWep where "wClass.OneHanded | Hero.EquipOff" perform delete[wClass.OneHanded] perform assign[wClass.Light] nexteach |
#1 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
I would modify this as follows:
Code:
~ If we're disabled, do nothing doneif (tagis[Helper.SpcDisable] <> 0) ~If there is nothing in the offhand, get out now doneif (hero.tagis[Hero.EquipOff] = 0) foreach pick in hero from BaseWep where "wClass.OneHanded & Hero.EquipOff" perform eachpick.tagreplace[wClass.OneHanded,wClass.Light] nexteach tagis returns 0 or 1 In the loop, you want things that are one-handed weapons and equipped in the off hand. Thus changing the | to &. You were missing the eachpick in your foreach loop. Otherwise you perform statements would run on whatever pick this script is on. tagreplace is basically the same as the calling delete then assign, but it is easier to understand what you are doing in my opinion. Note: I am not sure if this will do what you want so you will have to test it. If it doesn't work play with the timings. If you have debugging enabled, right-click on whatever weapon you are testing this with and look at the task list to see if there are scripts that do things with the wClass tags. You will want to have this script run before that. |
#2 |
Senior Member
Join Date: May 2015
Posts: 830
|
Yeah, final 1000 might be too late for some things.
|
#3 |
|
|