Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
HammerStrike
Junior Member
 
Join Date: Feb 2013
Posts: 20

Old June 17th, 2013, 05:18 PM
I'd like to write an eval script in a class that can detect the user's selection of a custom ability I created, based on the Ranger's "Favored Enemy" or "Favored Terrain". How can I get the value of the user's selection and then do an if/else or switch operation depending on the user's selection?

Thanks!
HammerStrike is offline   #1 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old June 17th, 2013, 10:28 PM
Favored Enemy and Terrain are just Abilities actually. So in example Favored Enemy (Aberrations) is Thingid.feAberr. So to test for it you could do the following:

Code:
~ Test for the presence of FE aberration 
If (#hasability[feAberr] <> 0) Then
  ~ Do stuff here
Endif
Though without knowing the rest of what you want to accomplish the above may not work as you will have to test for the HasAbility.? tag very late in timing. For earlier you would want to look for the Ability.? tag instead:
Code:
If (hero.tagis[Ability.feAberr] <> ) Then
  ~ Do stuff
endif
As the ability is a unique Thing one way to test without checking tags is to see if the childlives. This method you could test for very early if you need to but have to be careful in other cases using this as it does no testing to see if something else disabled the ability.
Code:
If (hero.childlives[feAberr] <> 0) Then
  ~ Do stuff
Endif

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #2 Reply With Quote
HammerStrike
Junior Member
 
Join Date: Feb 2013
Posts: 20

Old June 18th, 2013, 08:29 AM
Thanks ShadowChemosh, but I'm still confused about how to get the users selection from the drop down control. I need to run an if/else based on what the user chose.
HammerStrike is offline   #3 Reply With Quote
HammerStrike
Junior Member
 
Join Date: Feb 2013
Posts: 20

Old June 18th, 2013, 08:43 AM
For example, I'd like to do something like...

Code:
If (hero.tagis[Ability.feAberr] <> ) Then
  ~ Do stuff like...
  var usersFavoredEnemy = #howDoIGetThisValue[Ability.feAberr]
  If (usersFavoredEnemy == firstThingFromTheListOfPossibleChoices) Then
    ~ setup some extra abilities and add help text to character sheet printouts
  ElseIf (usersFavoredEnemy == secondThingFromTheListOfPossibleChoices) Then
    ~ setup some extra abilities and add help text to character sheet printouts
  ElseIf (usersFavoredEnemy == thirdThingFromTheListOfPossibleChoices) Then
    ~ setup some extra abilities and add help text to character sheet printouts
  ElseIf (usersFavoredEnemy == fourthThingFromTheListOfPossibleChoices) Then
    ~ setup some extra abilities and add help text to character sheet printouts
  EndIf 
endif
I'm very curious about how to setup the values for the variables usersFavoredEnemy, firstThingFromTheListOfPossibleChoices, secondThingFromTheListOfPossibleChoices, thirdThingFromTheListOfPossibleChoices, and fourthThingFromTheListOfPossibleChoices.

My 10 year old son is trying to build a new class called "Elementalist" and at level 1 you are required to chose one of the four elements. Based on your element selection, you have different abilities and feats available. Any help provided here gives me and my son more fun in Hero Lab, and I'm very grateful for all the support people like you provide on these forums and elsewhere for Hero Lab scripting.
HammerStrike is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,217

Old June 18th, 2013, 08:45 AM
Could you explain the game rules of what you're trying to accomplish, please? From the quick bit you just said, I don't think favored enemies are the right mechanism to use for this.
Mathias is offline   #5 Reply With Quote
HammerStrike
Junior Member
 
Join Date: Feb 2013
Posts: 20

Old June 18th, 2013, 09:12 AM
We want a class that on its first level forces the user to select a favored element, air, fire, earth or water. Once the favored element is selected, we want to enable different abilities. The air elementalist will have a different set of abilities from the other three.

We were thinking that we might need to use archetypes to do this and that would be how the elementalist chose their favored element... in other words, have an elementalist class and 4 archetypes for it... Air Elementalist, Fire Elementalist, Earth Elementalist and Water Elementalist. To us it seemed that containing things all in a single class might be a better user experience though.

What's your recommendation for implementing this? Did I give enough information about our idea?
HammerStrike is offline   #6 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,217

Old June 18th, 2013, 09:25 AM
Are there any abilities that are completely unique to specific elements?

How much does each element differ from the others? Are they using the same powers, and just changing the description or damage type based on the element, or are they using completely different powers?

Favored Enemies are completely unrelated to what you're trying to accomplish. I'd recommend looking at the Elemental bloodline for Sorcerers - that's probably the closest thing to what you're trying to accomplish.

Most likely, it'll be easiest to implement this as four completely separate classes - switching the way an ability works and turning on or off abilities depending on a selection are advanced topics, and I would not recommend trying to accomplish that if this is the first thing you've ever created in the Hero Lab editor.
Mathias is offline   #7 Reply With Quote
Umarian
Senior Member
 
Join Date: Apr 2010
Location: Lemont, IL
Posts: 320

Old June 18th, 2013, 10:04 AM
Quote:
Originally Posted by HammerStrike View Post
We want a class that on its first level forces the user to select a favored element, air, fire, earth or water. Once the favored element is selected, we want to enable different abilities. The air elementalist will have a different set of abilities from the other three.
This sounds like it is exactly what I just finished doing here. The Archetype I created has to choose an element, once two of those elements were selected, it unlocked additional abilities.

Basically what I did was create separate Class Specials for each of them. So there are 4 four class specials where they select the base element (Earth, Fire, Water, Air). Depending on which element they choose, a tag is added to the hero. Then the others (Air + Water, Air + Fire etc) are attached to the class with a condition to look for the tags. (You will need to create new tags and not use the ones that I have listed because it could cause problems if you get the file I used them in.)

Hope that helps.
Umarian is offline   #8 Reply With Quote
HammerStrike
Junior Member
 
Join Date: Feb 2013
Posts: 20

Old June 18th, 2013, 10:55 AM
Umarian, I owe you a beer, perfect match to what i was trying to do!

Here's the code I was able to use in the First phase as an eval script of my new class:

Code:
doneif (hero.tagis[Ability.FE] <> 0)
If (hero.child[FE].field[usrChosen1].chosen.tagis[thingid.selElAir] <> 0) Then
   debug "Favored Element: Air!"
elseIf (hero.child[FE].field[usrChosen1].chosen.tagis[thingid.selElEarth] <> 0) Then
   debug "Favored Element: Earth!"
elseIf (hero.child[FE].field[usrChosen1].chosen.tagis[thingid.selElFire] <> 0) Then
   debug "Favored Element: Fire!"
elseIf (hero.child[FE].field[usrChosen1].chosen.tagis[thingid.selElWater] <> 0) Then
   debug "Favored Element: Water!"
else 
   debug "Favored Element: no selection made yet!"
Endif
I love it! On to more puzzles!
HammerStrike is offline   #9 Reply With Quote
Reply


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:12 AM.


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