Staredit Newtork
Community
StarCraft
Games
Site
Favourites
 
Resource Sharing
Resource Sharing

Demo map: http://www.staredit.net/maplantis/index.php?map=495
About demo map: Custom score was used for the demo map, but death counters work just as well.

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.

Code

Trigger("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 Resources("Current Player", Subtract, 16, gas);
   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.

Code

Trigger("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.***

Code

Trigger("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.

Code

Trigger("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();
}

//-----------------------------------------------------------------//


[07:34 pm]
[Dark_Marine]:] -- Interested in working on an RPG that isnt on a RTS? Now you can! :D The Lands of Lingia RPG
[06:31 pm]
MePHiStO_IS_GoD -- nicce wanna game on east?
[06:24 pm]
[DeVouReR]:] -- now
[06:15 pm]
MePHiStO_IS_GoD -- still there Dev?
[06:05 pm]
MePHiStO_IS_GoD -- er Afternoon
[06:04 pm]
MePHiStO_IS_GoD -- Good morning SEN
[05:56 pm]
madroc -- there are some things even i cannot fix, i am moving on now
You must log in to shout.

©2003-2008 Staredit Network.
Starcraft & Starcraft II are trademarks of Blizzard Entertainment.
Site Index   |   Terms of Service   |   Privacy Policy   |   Contributions