Difference between revisions of "Resource Sharing"

From Staredit Network Wiki
Jump to: navigation, search
(Created page with 'Two Variables are required, whether they be deaths, score, or resource. It does not matter who owns the data (Player 1 custom score vs Player 8 custom score), just so long as it …')
 
m (1 revision imported: Restoring SC1 backup)
 
(No difference)

Latest revision as of 23:35, 20 March 2015

Two Variables are required, whether they be deaths, score, or resource. It does not matter who owns the data (Player 1 custom score vs Player 8 custom score), just so long as it is always referred to in each trigger. In other words, don't use "Current Player" when referencing the variables. Do use "Current Player" when referencing resources, however.

Variable 1: Resource amount. This variable stores the number of resources everyone should have at any given time.

Variable 2: Buffer. This variable stores the resource amount between steps.

Triggers

There are 4 triggers required, but each are in sets, since binary countoffs require multiple copies of the same trigger. If a player gains more than the maximum amount handled by the binary countoffs, the triggers will fail to work properly. The example triggers provided all have a value of 16, so copies must be made of the triggers with values of 8, 4, 2, and 1 for the triggers to work properly, and can handle resources up to 31 and under.

Trigger Set 1

This trigger set is the first step. It takes away either all the player's resources, or all the "resource amount" variable. Since it takes both away simultaneously, if the player has any resources left over after the "resource amount" variable is reduced to zero, then the player gained resources. If the player has no resources left, then the player lost resources. All these are stored into the "buffer" variable so the player can get them back after the triggers are complete.

StarCraft Trigger [template]
Description:
This is a test.
Players:
  • Player 1
  • Player 2
  • Player 3
Conditions:
  • Score("Player 1", Custom, At least, 16);
  • Accumulate("Current Player", At least, 16, gas);
Actions:
  • Set Score("Player 1", Subtract, 16, Custom);
  • Set Score("Player 2", Add, 16, Custom);
  • Set Score("Player 2", Add, 16, Custom);
  • Preserve Trigger();

Trigger Set 2

If the player has minerals leftover, then the player gained resources, which need to be added to the rest of the team's resources, which is now in the "buffer" variable, and in the team's actual resource value. Since the trigger adds to Force 1, and "current player" is part of force 1, it is important to subtract the number twice, or else the binary countoff would never end.

StarCraft Trigger [template]
Description:
This is a test.
Players:
  • Player 1
  • Player 2
  • Player 3
Conditions:
  • Accumulate("Current Player", At least, 16, gas);
Actions:
  • Set Score("Player 2", Add, 16, Custom);
  • Set Resources("Force 1", Add, 16, gas);
  • Set Resources("Current Player", Subtract, 16, gas);
  • Set Resources("Current Player", Subtract, 16, gas);
  • Preserve Trigger();

Trigger Set 3

If the player has no minerals leftover, and the "resource amount" variable still has a value, then the player lost resources, which need to be subtracted from the team's resources.

Note: Since the player has no gas, it may not be necessary to add gas in this trigger set. In any case, it doesn't hurt to add the gas in the first place.

StarCraft Trigger [template]
Description:
This is a test.
Players:
  • Player 1
  • Player 2
  • Player 3
Conditions:
  • Score("Player 1", Custom, At least, 16);
Actions:
  • Set Score("Player 1", Subtract, 16, Custom);
  • Set Resources("Current Player", Add, 16, gas);
  • Set Resources("Force 1", Subtract, 16, gas);
  • Preserve Trigger();

Trigger Set 4

This trigger simply adds all the resources and "resource amount" variable back to the correct amount, which is stored in the "buffer" variable.

StarCraft Trigger [template]
Description:
This is a test.
Players:
  • Player 1
  • Player 2
  • Player 3
Conditions:
  • Score("Player 2", Custom, At least, 16);
Actions:
  • Set Resources("Current Player", Add, 16, gas);
  • Set Score("Player 1", Add, 16, Custom);
  • Set Score("Player 2", Subtract, 16, Custom);
  • Preserve Trigger();