Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
schenn
Member
 
Join Date: Aug 2015
Posts: 32

Old August 29th, 2015, 02:14 PM
Is there a way to add a script that fires on a hero only when they unlock advancement (completing the building of the character)
schenn is offline   #1 Reply With Quote
AndrewD2
Senior Member
 
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975

Old August 29th, 2015, 03:23 PM
You mean when they lock advancement?
AndrewD2 is offline   #2 Reply With Quote
schenn
Member
 
Join Date: Aug 2015
Posts: 32

Old August 30th, 2015, 11:24 PM
Sure. When they're done with creating their character and have locked their profile to require utilizing the advancement system to improve their character. Is there a way to attach a script to run on that event?
schenn is offline   #3 Reply With Quote
AndrewD2
Senior Member
 
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975

Old August 31st, 2015, 05:54 AM
I think there's a spot in the definition file for items that trigger upon locking the character.
AndrewD2 is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 31st, 2015, 08:02 AM
What do you need to accomplish? Normally, rather than a script that fires once when they change, I'd set it up as a hero script that's always applied when stateiscreate = 0. That way, if the user changes their mind about a character creation decision and switches back to creation mode, whatever change you've made isn't applied until they return to advancement mode.
Mathias is offline   #5 Reply With Quote
schenn
Member
 
Join Date: Aug 2015
Posts: 32

Old August 31st, 2015, 09:36 AM
I'm setting a tracker starting value based off the values of a characters attributes at the time of creation. This tracker only needs to determine this starting value once (when the user is ready to lock their profile), as the minimum and maximum values are changed by experiences in game play.

Essentially, I'm making a tracker for Sanity for Shadowrun. The starting value is derived from a formula involving Willpower and Essence. Afterwords, the tracker can decrement in two fashions. One, by the user lowering the sanity value after a sanity loss event. Two, by the user increasing their Cthulhu Mythos tracker. The CM tracker always starts at 0.

the stateiscreate = 0 will probably work for what I need, however, how do I keep it from resetting its value if the user goes back into character creation after having changed their sanity during gameplay. E.g. Jim loses some sanity and while exploring the program, he returns to creation mode, which causes the sanity value to reset to its starting value. He doesn't know how much sanity he lost, and is now stuck trying to figure it out.

I guess I could create an additional tracker for 'sanity lost' Then I could just add the different values together. I was trying to avoid an 'extra' tracker if possible, but it seems as though that would be the easiest way to go about this. Can a tracker's minimum value be negative? (A player can heal their sanity over their starting sanity through therapy and medications. This would effectively push their sanity lost tracker to the negative)

if(stateiscreate = 0)
startingSanity = (willpower + essence) * 5 + 15 ~ store startingSanity in a field value
minimum = startingSanity ~ push the tracker to the current sanity value
else
sanity = startingSanity - sanityLostTracker - CM
minimum = sanity ~ push the tracker to the current sanity value
schenn is offline   #6 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 31st, 2015, 10:28 AM
The authoring kit is used to create new game systems from scratch. If you're adding something to an existing game system, you don't have complete access, and the answers to your questions will differ - should I move this thread over to Shadowrun?
Mathias is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 31st, 2015, 10:29 AM
For this, I'd just use the trtNatural fields from those attributes. The information you're asking for doesn't exist in a lot of cases.
Mathias is offline   #8 Reply With Quote
schenn
Member
 
Join Date: Aug 2015
Posts: 32

Old August 31st, 2015, 11:42 AM
If it would work better in the shadowrun forum, then yea. I wasn't sure where to put the thread.

Thanks for your help!

I'm able to get the the attribute values just fine, it's more of an issue of the tracker becoming dynamic and determining when to do math one way and when to do it the other..

This is what I currently have:
Quote:
trustme
var sanity as number
var current as number
var mythos as number

current = field[trkUser].value
if (current <> 0) then
~ How to do equality comparison? The wiki only shows greater than less than and == throws an error
else
sanity = 15 + ((#trait[attrWil] + #trait[attrEssenc]) * 5)
field[trkUser].value = sanity
else
~ The character already had a recorded sanity value.. Let's see if I can figure out what I 'should' do here...
~ We may still be in character creation, in which case we should re-determine the maximum.
~ We may be playing, in which case we should just apply the current value.. This doesn't work as it prevent's the sanity value from changing at all
~ We may be playing in which case, maybe we should re-calculate the current value from a stored starting sanity and a lost sanity tracker?
endif

~ This can be run anytime as the mythos should only be 0 at char creation.
mythos = hero.childfound[trkCthulhu].field[trkUser].value
if (mythos <> 0) then
field[trkMax].value -= mythos
endif

Last edited by schenn; August 31st, 2015 at 11:49 AM.
schenn is offline   #9 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 31st, 2015, 12:09 PM
trkUser is a user-controlled field - you cannot change it in a script unless you want to take control away from the user, which forces it to always be a calculated value that the user cannot change.

equals tests are "="

like I said, I recommend trtNatural, not trtFinal - #traitnatural[] not #trait[] - that way, if you take a drug that alters your Willpower, your sanity won't change.
Mathias is offline   #10 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 02:15 AM.


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