Market ability

This bundle is marked as pending. It has not been reviewed by a staff member yet.
  • Like
Reactions: deepstrasz
LordHatchet95 presents:

Market System v1.0

This market system allows the 4 races to buy or sell lumber in exchange of a fluctuating amount of gold from their main Halls.

The more you purchase, the more expensive it becomes.
The more you sell, the less amount of gold you receive per sale.
This system has an upper and lower limit.
This system can be used in both Classic and Reforged modes, since there's no external models or textures involved.
This can also be used in either Melee, Altered Melee or Custom Maps, as long as it works with 2 resources.

Inspiration: Age of Empires 2

Screenshots:




INITIALIZATION:
  • StartupMarket
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • -------- VARIABLES --------
      • -------- INITIAL COSTS --------
      • -------- Costs will vary on purchase and sale --------
      • Set VariableSet lumber_cost_buy = 125
      • Set VariableSet lumber_cost_sell = 75
      • -------- CONSTANTS --------
      • Set VariableSet lumber_const = 100
      • -------- FLUCTUATIONS (INCREASE/DECREASE) --------
      • -------- NEVER make fluctuations bigger than minimum cost --------
      • Set VariableSet lumber_cost_fluctuation = 2
      • -------- LOWER AND UPPER COST LIMITS --------
      • Set VariableSet lumber_cost_min = 18
      • Set VariableSet lumber_cost_max = 350
      • -------- DESCRIPTIONS IN-GAME --------
      • Quest - Create a Required quest titled Market with the description The market works as..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Quest - Create a Required quest titled Credits with the description Made by LordHatchet..., using icon path ReplaceableTextures\CommandButtons\BTNSpy.blp
SELLING:
  • MarketSellLumber
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Sell Lumber
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • lumber_cost_sell Less than or equal to ((Owner of (Casting unit)) Current lumber)
        • Then - Actions
          • Player - Set (Owner of (Casting unit)).Current lumber to (((Owner of (Casting unit)) Current lumber) - lumber_const)
          • Player - Add lumber_cost_sell to (Owner of (Casting unit)).Current gold
          • Game - Display to (Player group((Owner of (Casting unit)))) for 4.00 seconds the text: (You sold + ((String(lumber_const)) + ( lumber by + ((String(lumber_cost_sell)) + gold.))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • lumber_cost_sell Greater than lumber_cost_min
            • Then - Actions
              • Set VariableSet lumber_cost_sell = (lumber_cost_sell - lumber_cost_fluctuation)
              • Set VariableSet lumber_cost_buy = (lumber_cost_buy - lumber_cost_fluctuation)
            • Else - Actions
        • Else - Actions
          • Game - Display to (Player group((Owner of (Casting unit)))) for 4.00 seconds the text: Not enough lumber t...
BUYING:
  • MarketBuyLumber
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Buy Lumber
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • lumber_cost_buy Less than or equal to ((Owner of (Casting unit)) Current gold)
        • Then - Actions
          • Player - Add 100 to (Owner of (Casting unit)).Current lumber
          • Player - Set (Owner of (Casting unit)).Current gold to (((Owner of (Casting unit)) Current gold) - lumber_cost_buy)
          • Game - Display to (Player group((Owner of (Casting unit)))) for 4.00 seconds the text: (You bought + ((String(lumber_const)) + ( lumber by + ((String(lumber_cost_buy)) + gold.))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • lumber_cost_buy Less than lumber_cost_max
            • Then - Actions
              • Set VariableSet lumber_cost_sell = (lumber_cost_sell + lumber_cost_fluctuation)
              • Set VariableSet lumber_cost_buy = (lumber_cost_buy + lumber_cost_fluctuation)
            • Else - Actions
        • Else - Actions
          • Game - Display to (Player group((Owner of (Casting unit)))) for 4.00 seconds the text: Not enough gold for...
PRICE CHECK:
The following repeats per player... if there's a better way to make it, feel free to tell me.
  • MarketPricesCheck1
    • Events
      • Player - Player 1 (Red) types a chat message containing -market as An exact match
    • Conditions
    • Actions
      • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: ((String(lumber_const)) + ( lumber cost on purchase: + (String(lumber_cost_buy))))
      • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: ((String(lumber_const)) + ( lumber cost on sale: + (String(lumber_cost_sell))))
  • Created the map.
  • Added Buy Lumber and Sell Lumber to each race's main halls.
  • Made prices fluctuate according to purchases and sales.
  • Added upper limits and lower limits to prevent negative values or excessive inflation of prices.
  • Added a command to check prices: -market
  • Made all the values into variable for easier modification.

  1. Have enabled "Automatically create unknown variables while pasting trigger data" in preferences. (Or just skip this)
  2. Copy and paste the abilites "Buy Lumber" and "Sell Lumber" in the object editor.
  3. Copy and paste the variables (if the above option is disabled) and the triggers from where it says "Copy everything below".
  4. ONLY modify the "StartupMarket" trigger if you want to. The other ones should NEVER be modified. (unless modifying them to be adapted to different resources)
  5. Add or modify the MarketPricesCheck#" (# = player number) according to the amount of players you'll need.
  6. Give credits to me, the creator.
Previews
Contents

Market ability (Map)

Level 6
Joined
Oct 2, 2017
Messages
69
Top