What's wrong with my Bank

Mesden

New Member
Reaction score
0
I'm trying to use a Variable called Saved Kills, which is initially "0" (Integer), and then there's an Action Command in my Save Kills Trigger which basically looks like this:
Trigger:
  • Save Kills
    • Events
      • Unit - Any Unit dies
    • Local Variables
    • Conditions
      • (Owner of (Triggering unit)) == 9
      • (Controller of player (Killing player)) == User
    • Actions
      • Bank - Open bank "xdefensemap" for player (Killing player)
      • Bank - Store integer ((Killing unit) kills (Current)) as "Kills" of section "Player" in bank (Last opened bank)
      • Bank - Save bank (Last opened bank)
      • Variable - Modify Saved Kills: + 1


If anyone knows how I can modify this Trigger to increase the player's total kill count when a unit dies, I should have this headache of a Bank Trigger out of my head.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
First of all, welcome to TheHelper.

I did something similar in one of my maps way back. Here's the code I used:

Trigger:
  • Banks: Init
    • Events
      • Game - Map initialization
    • Local Variables
      • Untitled Variable 001 = "" <String>
    • Conditions
    • Actions
      • Bank - Preload and synchronize bank "MyBankName" for player 1
      • Bank - Open bank "MyBankName" for player 1
      • Variable - Set PlayerBanks[1] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 2
      • Bank - Open bank "MyBankName" for player 2
      • Variable - Set PlayerBanks[2] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 3
      • Bank - Open bank "MyBankName" for player 3
      • Variable - Set PlayerBanks[3] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 4
      • Bank - Open bank "MyBankName" for player 4
      • Variable - Set PlayerBanks[4] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 5
      • Bank - Open bank "MyBankName" for player 5
      • Variable - Set PlayerBanks[5] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 6
      • Bank - Open bank "MyBankName" for player 6
      • Variable - Set PlayerBanks[6] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 7
      • Bank - Open bank "MyBankName" for player 7
      • Variable - Set PlayerBanks[7] = (Last opened bank)
      • Bank - Preload and synchronize bank "MyBankName" for player 8
      • Bank - Open bank "MyBankName" for player 8
      • Variable - Set PlayerBanks[8] = (Last opened bank)


Trigger:
  • Banks: Store kills
    • Events
      • Unit - Any Unit takes Fatal Any damage (from Any effects)
    • Local Variables
    • Conditions
    • Actions
      • Bank - Store integer ((Load "Kills" of section "Player" from bank PlayerBanks[(Owner of (Damaging unit))] as integer value) + 1) as "Kills" of section "Player" in bank PlayerBanks[(Owner of (Damaging unit))]
      • Bank - Save bank PlayerBanks[(Owner of (Triggering unit))]
      • Bank - Store integer ((Load "Deaths" of section "Player" from bank PlayerBanks[(Owner of (Triggering unit))] as integer value) + 1) as "Deaths" of section "Player" in bank PlayerBanks[(Owner of (Triggering unit))]
      • Bank - Save bank PlayerBanks[(Owner of (Damaging unit))]


As you can see, I open and preload a bank for each player and save it in a bank array variable called "PlayerBanks[]". You could do the entire init trigger with a simple loop, but I didn't think of it back then.

I don't really know why your trigger isn't working but some things I suggest you try is:
* Use the preload and synchronize trigger at map start
* Open the bank at map start

Also, in my map, a lot of things died often. This made the map very slow since it had to save the bank every time a unit dies. A better way to do it if you have a lot of units dying would be to save the kills in a variable and save the kills when the map ends. I'm not sure if you can save the kills to a player that leaves the game before the game is over however.
 

Dave312

Censored for your safe viewing
Reaction score
269
Trigger:
  • Bank - Store integer ((Killing unit) kills (Current)) as "Kills" of section "Player" in bank (Last opened bank)

This action here is actually storing the number of kills that unit has made, not the number of kills the player has made. Use your Saved Kills variable to store the number of kills (or use can use the Get Player Score function).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top