Member
Join Date: Apr 2007
Posts: 60
|
Rather than just divide the druid level amongst the animal companions, which we all know from experience is a terrible thing to do... I'm wanting to implement an equally simple system that won't destroy the archetype...
I'm wanting to set all the companion levels to be equal to: Code:
var totalComps as number var compLevel as number var myLevel as number totalComps = hero.childcount[Hero.MultComp] myLevel = field[xTotalLev].value compLevel = myLevel if (totalComps > 1) then compLevel = myLevel - totalComps endif if (compLevel < 1) then compLevel = 1 endif So, is this hard-coded stuff that can't be changed? It's not a huge problem since all it does is make some text red if you ignore the current rules (so char-gen is still possible), but was hoping to get my player out of the red if possible. :P |
#1 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
As opposed trying to put what you want into code to explain, can you just explain what you want without the code?
It seems like you're trying to make your companion level equal to your druid level minus the number of companions. If you have Rite Publishing's The Secret of Adventuring the Ranger's Pack Hunter archetype deals with having multiple companions and different levels than normally calculated for multiples. |
#2 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
I think your main issue here is you're trying to get the number of animal companions on the hero by counting the Hero.MultiComp tags. There will only ever be one of those.
Instead, you'll likely have to foreach through all cAnimMult picks on the hero, count them, and then use that to calculate how many total levels should be spread among all the companions as well as what you want each companion level to be. Override the cAnimClass pick's CompClLev field with your total levels value, and add a second eval rule which foreaches through all cAnimMults on the hero and complains if their UserLevel field is set to an incorrect value. Hope that helps! |
#3 |
Member
Join Date: Apr 2007
Posts: 60
|
Thanks to both of you for your responses. Unfortunately, I do not have that package from Rite's Publishing, which is why I tried to get my answers from the Pack Lord archetype.
Aaron, the scripting suggestions have been written in, but I seem to be doing it in the wrong place. I put it in a new Archetype (Pack Lady), but it generates the following error: attempt to access field 'xTotalLev' that does not exist for thing 'arPackLady' I changed the Pack Lady to use a new PackBond2 and placed the eval script there instead, which stopped the error, but had no visible effect. :/ Code:
var myLevel as number var compLevel as number var totalComps as number totalComps = 0 compLevel = myLevel myLevel = field[xTotalLev].value foreach pick in hero from MultCompan totalComps += 1 nexteach if (totalComps > 1) then compLevel = myLevel - totalComps endif if (compLevel < 1) then compLevel = 1 endif hero.childfound[cAnimClass].field[CompClLev].value = compLevel Again, thanks for your help so far, though if you could assist further, it would be greatly appreciated. |
#4 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
xTotalLev doesn't exist on an archetype. What you'll want to use is
Code:
linkage[varies].field[cTotalLev].value |
#5 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
As AndrewD2 says, you'd need to transition from the archetype, to the class to detect the level. Here is how I would do it.
Eval Script at First 490 (might need to shift this later) Code:
doneif (islinkage[varies] = 0) var numcomp as number foreach pick in hero from MultCompan numcomp += 1 nexteach ~ This variable stores the number of levels each companion should have. var eachcomplv as number ~ The calculation is Class Level - (#companions - 1) ~ For example, a 10th level druid with 1 animal companion has each companion at 10th level. 2 animal companions lowers each by 1 level (so they are 9th level), 3 = 8th level and so on. eachcomplv = linkage[varies].field[cTotalLev].value - maximum(numcomp - 1, 0) ~ Our total number of levels to be divided (evenly) among the animal companions is each companion's level times the number of companions. hero.childfound[cAnimClass].field[CompClLev].value = (eachcomplv * numcomp) Code:
doneif (islinkage[varies] = 0) var numcomp as number foreach pick in hero from MultCompan numcomp += 1 nexteach ~ This variable stores the number of levels each companion should have. var eachcomplv as number ~ The calculation is Class Level - (#companions - 1) ~ For example, a 10th level druid with 1 animal companion has each companion at 10th level. 2 animal companions lowers each by 1 level (so they are 9th level), 3 = 8th level and so on. eachcomplv = linkage[varies].field[cTotalLev].value - maximum(numcomp - 1, 0) ~ This variable tracks whether we have one or more companion not at the appropriate level. var mismatch as number foreach pick in hero from MultCompan if (eachpick.field[UserLevel].value <> eachcomplv) then mismatch = 1 endif nexteach validif (mismatch = 0) |
#6 |
Member
Join Date: Apr 2007
Posts: 60
|
Again, thank you to both of you, and so terribly sorry that you guys are practically writing this for me.
The only current problem is the validif, which gives the following syntax error upon compiling: -> Script does not support the '@valid' special symbol so use of 'validif' is illegal I commented it out, and the rest of the script compiled without error, so I guess I just need the validate. :/ |
#7 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Pay close attention to what Aaron says just before each script - does he say to make that one an Eval Script or an Eval Rule?
|
#8 |
Member
Join Date: Apr 2007
Posts: 60
|
Thanks Mathias, that got rid of the error, but no effect on the red.
I'm starting to think that the validation almost has to happen in the Animal Companion, not in the Archetype (after all, the Archetype is valid...). I'll try that next and see how that goes. |
#9 |
Member
Join Date: Apr 2007
Posts: 60
|
Animal Companion is not added to the Druid Class.
The "Custom Ability" for "Nature Bond" is added Nature Bond is not a Class Special nor a Custom Ability (so can't find it to copy it to add my version of Animal Companion). Animal Companion is under Companion Type, but no way to tell the Archetype (or the Nature Bond) to pick a different/copied Animal Companion. Not that I'm giving up, but I understand if too much time is being spent on this silly quest. I don't have a perceived notion that this is something needing to be fixed. I'll keep trying to work on it, but don't feel any obligation to make this work. (though if I'm right, and it is impossible with the app as-is, letting me know so I spend less time on it would be cool :P) |
#10 |
|
|