Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Shadowrun (http://forums.wolflair.com/forumdisplay.php?f=75)
-   -   Attach a script to the Unlock Advancements? (http://forums.wolflair.com/showthread.php?t=53713)

schenn August 29th, 2015 02:14 PM

Attach a script to the Unlock Advancements?
 
Is there a way to add a script that fires on a hero only when they unlock advancement (completing the building of the character)

AndrewD2 August 29th, 2015 03:23 PM

You mean when they lock advancement?

schenn 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?

AndrewD2 August 31st, 2015 05:54 AM

I think there's a spot in the definition file for items that trigger upon locking the character.

Mathias 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.

schenn 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

Mathias 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 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.

schenn 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


Mathias 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.


All times are GMT -8. The time now is 04:19 PM.

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