Primary Transaction

From HLKitWiki
Jump to: navigation, search

The "isprimary" special symbol is present in the TransactSetup Script, TransactBuy Script and TransactSell Script.

It's intended to be used to identify the "primary" transaction in games like Shadowrun. For example, let's say you want to buy a gun with a laser sight, smartlink, and 500 rounds of ammunition all at once. Ideally, we'd combine all of those into one single purchase, rather than making multiple smaller purchases. This is neater, and makes it easier to back out of, since if the user cancels at the last minute we don't need to worry about undoing multiple small transactions.

In the above example, the setup and buy scripts for the gun have @isprimary set to non-zero. The laser sight, ammunition, etc, transaction scripts would have @isprimary set to 0.

Once the gun has been bought, the user could then go back onto it and add a shock pad (for example). The shock pad is now the primary transaction, so @isprimary would be set to non-zero to indicate that.

This allows the data file author to only deduct cash from the player if @isprimary is set to non-zero, and otherwise accumulate the total cost into a variable on the parent for deduction when the primary transaction completes.