HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Gold Sharing?

12-14-2003, 03:09 PM#1
emil.holmstrom
Okay now, my question is this: How do you make so that like every 5 seconds or so all non-playing players' gold will be distributed among his teammates?
12-14-2003, 03:32 PM#2
Acid Phix
I dont think how you said that it wont work, I think that will only give all the gold to one player.
12-15-2003, 02:19 AM#3
Acid Phix
I seem to not be able to get that to work I use the same thing you said I must be doing something wrong let me try it agian.
12-15-2003, 02:47 AM#4
AllPainful
Your trigger. :D

The first part is determining the number of players still in the game, the second part is sharing the gold for players not in the game. You will notice I did not use "Pick All Players" when looking for players who are not playing, that is because "Pick all players" does not recognise, and can not be used, for players who are not actually in the game.

Replace # with the maximum number of players in your map.

Variables:
NumPlayers = Integer
SpreadGold = Integer

Code:
Event
  Every 5 seconds of game
Conditions
Actions
  Set Variable "NumPlayers" equal to 0
  Do loop for integer A from 1 to [color=blue]#[/color]
    If
      Player number (integer a) slot status is equal to Is Playing
      Player number (integer a) controller is equal to Human
    Then
      Set variable "NumPlayers" = "NumPlayers" +1
    Else
      Do nothing
  Do loop for integer B from 1  to [color=blue]#[/color]
    If
      Player number (integer b) slot status is not equal to Is Playing
    Then
      Set variable "SpreadGold" = Current gold of player number (integer b) / NumPlayers
      Set gold of Player number (integer b) equal to 0
      Pick all players
        Loop
          If
            Player (picked player) slot status is equal to Is Playing
            Player (picked player) controller is equal to Human
          Then
            Add "SpreadGold" gold to picked players current gold
          Else
            Do Nothing
    Else
      Do Nothing
If I can be of any further assistance, just let me know.
12-15-2003, 07:23 PM#5
emil.holmstrom
Hmmm... Could you attach a map where you show me how it's done.
I can't seem to get it to work.
12-16-2003, 12:26 AM#6
Acid Phix
Ok never mind I found what was wrong I used a wrong varible. Thanks.