Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   How do I make stacks of objects default to "Add New Stack" (http://forums.wolflair.com/showthread.php?t=60149)

Duggan February 9th, 2018 08:51 PM

How do I make stacks of objects default to "Add New Stack"
 
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).

Duggan February 14th, 2018 10:53 AM

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!

Duggan February 14th, 2018 06:05 PM

Ah. And modifying XactSell and XactBuy, and removing the "insufficient cash" check makes things work like I want. Woohoo!

Duggan February 14th, 2018 07:25 PM

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.

Mathias February 14th, 2018 09:49 PM

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)

Mathias February 14th, 2018 09:51 PM

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.

Duggan February 15th, 2018 05:23 AM

Quote:

Originally Posted by Mathias (Post 263039)
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)

I was mulling over that, and I think that either I won't have any purchases, or I will be dealing with them when adding the Company as a character. The game abstracts out money such that the only person who really has money is the mercenary company itself, and then the individual players "purchase" using the company's money, requiring the players to discuss how they're spending the company money to create a more effective team. Since I don't want to try mixing two character types yet, I am instead just setting it up to accrue these costs so that, when my players field a character, they can just glance up in the corner and say, "OK, until we can sell off the dead guy's stuff, this one is going to cost us 11 Supplies to add in. Count them off of our company's Supply count".

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:

Originally Posted by Mathias (Post 263040)
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.

Hmm... that could be the issue. After writing a long post with code quotes about why I didn't think that was the case, I realized that indeed, the Equipment / Ammunition tables were quoting their Components directly rather than using "Gear" and then restricting choices via the "<list>" element. Thanks!

Mathias February 15th, 2018 07:28 AM

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[


Mathias February 15th, 2018 07:31 AM

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.


All times are GMT -8. The time now is 01:01 AM.

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