Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System

Notices

Reply
 
Thread Tools Display Modes
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old October 2nd, 2010, 08:29 PM
I thought when using childfound instead of child that HL was not suppose to throw an error if the thing was not found? From the wiki "Transitions to the pick context corresponding to the first pick within the container that derives from the thing with the id specified. This transition is identical to "child[id]", except that the existence of the child pick is optional. If the child is found, the transition occurs normally. If the child does not exist, no run-time error is reported, although the transition still fails to resolve."

I have the following code on a new class I am creating:
Code:
~First 498
hero.childfound[cAnimClass].field[CompClLev].value -= 3
hero.childfound[cAnimComp].field[CompLevBas].value -= 3
hero.childfound[cAnimComp].field[CompLevel].value -= 3
If the animal companion is not attached, which happens before level 8, then the script throws errors. Attached is a image of the errors. I even found THIS post about animal companion and it causes the same error to happen.

I am mis-reading what childfound does or is their another way to test that a Thing is really their before trying to affect it?
Attached Images
File Type: jpg PickError.jpg (52.0 KB, 3 views)

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   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old October 5th, 2010, 10:28 AM
I'm afraid I don't understand the child/childfound part (I've noted this thread for Rob or Colen to explain that).

I do know how to keep the error from happening:

Code:
hero.childfound[cAnimClass].field[CompClLev].value -= 3
 
if (hero.childlives[cAnimComp] <> 0) then
  hero.childfound[cAnimComp].field[CompLevBas].value -= 3
  hero.childfound[cAnimComp].field[CompLevel].value -= 3
  endif
Mathias is offline   #2 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old October 5th, 2010, 10:36 AM
Quote:
Originally Posted by Mathias View Post
I'm afraid I don't understand the child/childfound part (I've noted this thread for Rob or Colen to explain that).
Thanks. Just trying to make sure I use stuff the right away or at least understand the way it is intended.

Thanks for the script I had tried using childlives but had issues. I see now that it was because I added .value after childlives[cAnimComp]. Guess it was just habit.

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   #3 Reply With Quote
Colen
Senior Member
Lone Wolf Staff
 
Join Date: Dec 2008
Posts: 4,690

Old October 5th, 2010, 12:21 PM
As Mathias notes, childlives is the correct way to make sure the pick is live before accessing it.

"childfound" returns an error for non-live picks because it's a sign you may be doing something wrong; if a pick could be non-live, you should often be testing for that beforehand and perhaps doing something different.

Hope this helps!
Colen is offline   #4 Reply With Quote
Reply

Thread Tools
Display Modes

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 03:24 AM.


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