Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
I'm having difficulty figuring out where in the code this is defined, but if you set up an item, such as a piece of gear, with a quantity in a stack, it defaults to choosing to add individual items. I would prefer for the behavior to be merging to the existing stack so that, if a player buys 4 orders of Boomex (which come in 5 each), they wind up with "Boomex (x20)" instead of 20 entries of Boomex. I can see the other parts of this in the BuyCash entry, but not that menu.
Semi-related, if I wanted to switch from characters buying their gear from a personal supply of money, and instead change it so that they accumulate a "cost" for their current gear (so instead of someone starting off with $100 and paying $15 for a rifle and $3 for 5 doses of Boomex, and having $92 left, I instead want to simply note that the "cost" is $18). The reasoning for it is that, in the Planet Mercenary system, the money is owned by the company, not by the mercenaries, so it doesn't make as much sense for them to have "cash" on individual characters (eventually, I plan to create a new "Company" type that can "own" individual mercenaries and deduct their "cost" from its money, but for now, it's just handy knowing how many resources a given mercenary is costing their company). |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
OK. And I see now how to set the stack type in the editor, which teaches me that you set stacking="merge" on the Thing. ^_^ Learning!
|
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
Ah. And modifying XactSell and XactBuy, and removing the "insufficient cash" check makes things work like I want. Woohoo!
|
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
Hmmm... weird thing I'm running into now. The Weapons and Armor work just fine for buying and selling things, but items on the Gear tab don't change the values whether I'm working in the "characters have the cash" or the "tabulate the expense of fielding this unit" model. In both cases, setting Debug scripts shows that XActSetup, XActBuy, and XActSell are not being invoked when buying or selling these things.
These scripts are defined on all Gear components, which all of these items include. This is kind of baffling. |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Is there ever a time that cash is spent? Would you pay for something during the game, but during character creation, it's subtracting from a resource? Or will it always just subtract from the resource?
Subtracting from a resource is handled in eval scripts, not transaction scripts. Shadowrun only has purchases in advancement mode, so the xactbuy and xactsell scripts have an early doneif (state.iscreate = 0) |
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Also, check the component="" on the table - if two tables have different components, and those components have different transaction elements defined, then the two tables will end up with different behaviors - each using the behavior from the component it's tied to.
|
#6 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
Quote:
So, short answer, for now, yes, everything is working as accruing expenses for items "bought", before and after advancement. I could probably also handle it without buying or selling, just totaling up the current equipment, but the current method allows for a bit more freedom for doing things like having the mercs haggle to buy equipment more cheaply, or sell it for more than a small fraction of its value, or being able to delete an entry after all of its uses are up, and not get those Supplies back. Quote:
|
||
#7 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
If you would rather have more specific components on each table, but have the same buy/sell behaviors, you can use procedures for those scripts, which makes for very little copying in order to have the same transaction elements on every component that is the primary component for a table:
Code:
<!-- Call the appropriate procedures to perform transaction setup, buy, and sell behaviors --> <xactsetup><![CDATA[ call XactSetup ]]></xactsetup> <xactbuy><![CDATA[ call XactBuy ]]></xactbuy> <xactsell><![CDATA[ call XactSell ]]></xactsell> Code:
<!-- Procedure XactSetup Perform setup of the transaction fields when the user is purchasing an item. --> <procedure id="XactSetup" scripttype="xactsetup"><![CDATA[ Last edited by Mathias; February 15th, 2018 at 07:32 AM. |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Okay, if the team will never end up buying more ammo and weapons in a shop during their mission, and can never pay a different price for something, then I'd completely remove the purchase mechanisms from your game. Remove the buytemplate="" and selltemplate="" from all tables, remove the xact scripts from all components, and just total the value of each item in a script, then subtract that from the total cash gained.
Edit: just read more - you do still want to be able to support different costs, so skip this. Also, you'll eventually have things set up so that the buy and sell actions alter the cash on the company character, not the currently active character, and at that point, it will use normal purchase mechanisms, but with different locations to store the values. Last edited by Mathias; February 15th, 2018 at 07:34 AM. |
#9 |
|
|