Player leaving and multiboard issues

  • Thread starter Thread starter Senkin
  • Start date Start date
S

Senkin

Guest
I have a multiboard in Destiny RPG made by Im_On_56k and when a player leaves we want thier units (Hero and all) to be removed and thier name to be tooken off the leaderboard or at least named to leaver.

Here is the ENTIRE Multiboard code, and the variables to go with it.

Create Multiboard
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
Set Player_Count = (Number of players in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))))
-------- Set Up Title bar and row 1 --------
Multiboard - Create a multiboard with 4 columns and (1 + Player_Count) rows, titled |cffFF0000Destiny R...
Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to |cffffcc00Player Na...
Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to |cffff0000Health|r
Multiboard - Set the text for (Last created multiboard) item in column 4, row 1 to |cffff0000Kills|r:
-------- Now set the Sizes for the first row, AND our player rows. --------
For each (Integer A) from 1 to (1 + Player_Count), do (Actions)
Loop - Actions
Multiboard - Set the display style for (Last created multiboard) item in column 1, row (Integer A) to Show text and Show icons
Multiboard - Set the display style for (Last created multiboard) item in column 2, row (Integer A) to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 3, row (Integer A) to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 4, row (Integer A) to Show text and Hide icons
Multiboard - Set the width for (Last created multiboard) item in column 1, row (Integer A) to 1.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 2, row (Integer A) to 10.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 3, row (Integer A) to 5.50% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 4, row (Integer A) to 2.00% of the total screen width
-------- Quickly change the top row to hide that icon.... --------
Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Hide icons
-------- DEFINE PLAYERS ON THE BOARD --------
-------- List defines the spots on the board, the rows. Starts at second row. --------
Set List = 2
Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User))) and do (Actions)
Loop - Actions
-------- Mutiboard_Spots keeps track of which row a player has been put on. It is an integer array. --------
Set Multiboard_Spots[(Player number of (Picked player))] = List
-------- Setup the Icons --------
Multiboard - Set the icon for (Last created multiboard) item in column 1, row List to ReplaceableTextures\CommandButtons\BTNArthas.blp
-------- Setup the Text for eatch coloum/row --------
Multiboard - Set the text for (Last created multiboard) item in column 2, row List to (Player_Colors[(Player number of (Picked player))] + ((Name of (Picked player)) + |r))
-------- Set Life of players in start --------
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
((Owner of (Picked unit)) Equal to Player 1 (Red)) and (((Picked unit) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 2 (Blue)) and (((Picked unit) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 3 (Teal)) and (((Picked unit) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 4 (Purple)) and (((Picked unit) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 5 (Yellow)) and (((Picked unit) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 6 (Orange)) and (((Picked unit) is A Hero) Equal to True)
Then - Actions
Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Owner of (Picked unit)))] to ((String((Integer((Percentage life of (Picked unit)))))) + %)
Else - Actions
Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to |cffff0000Health|r
Multiboard - Set the text for (Last created multiboard) item in column 4, row List to 0
Set List = (List + 1)
Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to |cffff0000Health|r
Multiboard - Show (Last created multiboard)


Tally Score
Events
Unit - A unit Dies
Conditions
((Owner of (Killing unit)) controller) Equal to User
Actions
Set Kill_Count[(Player number of (Owner of (Killing unit)))] = (Kill_Count[(Player number of (Owner of (Killing unit)))] + 1)
Multiboard - Set the text for (Last created multiboard) item in column 4, row Multiboard_Spots[(Player number of (Owner of (Killing unit)))] to (String(Kill_Count[(Player number of (Owner of (Killing unit)))]))


Player Attacked
Events
Unit - A unit Is attacked
Conditions
((Owner of (Attacked unit)) controller) Equal to User
Actions
Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Owner of (Attacked unit)))] to ((String((Integer((Percentage life of (Attacked unit)))))) + %)


Define Colors
Events
Map initialization
Conditions
Actions
Set Player_Colors[1] = |c00ff0000
Set Player_Colors[2] = |c000000ff
Set Player_Colors[3] = |c0000ffff
Set Player_Colors[4] = |c00800080
Set Player_Colors[5] = |c00ffff00
Set Player_Colors[6] = |c00ff8000


Player hp update
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
((Owner of (Picked unit)) Equal to Player 1 (Red)) and (((Unit-type of (Picked unit)) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 2 (Blue)) and (((Unit-type of (Picked unit)) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 3 (Teal)) and (((Unit-type of (Picked unit)) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 4 (Purple)) and (((Unit-type of (Picked unit)) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 5 (Yellow)) and (((Unit-type of (Picked unit)) is A Hero) Equal to True)
((Owner of (Picked unit)) Equal to Player 6 (Orange)) and (((Unit-type of (Picked unit)) is A Hero) Equal to True)
Then - Actions
Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Owner of (Picked unit)))] to ((String((Integer((Percentage life of (Picked unit)))))) + %)
Else - Actions

VARIABLES

List - Integer - 0 (Default)
Multiboard_Spots - Integer - Array (1) - 0 (default)
Player_Count - Integer - 0 (default)
Player_Colors - string - array (1) - None





Here is the trigger I have tried to use for the player leaves.

Player leaves
Events
Player - Player 1 (Red) leaves the game
Player - Player 2 (Blue) leaves the game
Player - Player 3 (Teal) leaves the game
Player - Player 4 (Purple) leaves the game
Player - Player 5 (Yellow) leaves the game
Player - Player 6 (Orange) leaves the game
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked player) slot status) Equal to Has left the game
Then - Actions
Unit - Remove (Picked unit) from the game
Multiboard - Set the text for (Last created multiboard) item in column 2, row Multiboard_Spots[(Player number of (Owner of (Picked unit)))] to Leaver.
Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Owner of (Picked unit)))] to Leaver
Multiboard - Set the text for (Last created multiboard) item in column 4, row Multiboard_Spots[(Player number of (Owner of (Picked unit)))] to Leaver
Else - Actions
Multiboard - Show (Last created multiboard)



If anyone can find out what i did wrong to the trigger so when ppl leave thier units and name on leaderboard is removed / renamed, I will be very very happy.

Im getting a migraine from trying to get it to work :banghead: :banghead:
 
The last trigger does just that :)
At first sight the code seems okay.
"I have trouble getting it to work" is a vague description. What exactly does work and what does not work?
What happens when somebody leaves?
 
None of it seems to work, when they leave thier hero and units they own stay there and thier name on the leaderbpard stays on.
 
Woa... this is all mixed up.

First, your picking all units, then using them for the board. Units don't matter, its the player.

Second, You don't have to 'show' last created multiboard every time you update it. Silly! Here.
Code:
Events
  Player - Player 1 (Red) leaves the game
  Player - Player 2 (Blue) leaves the game
  Player - Player 3 (Teal) leaves the game
  Player - Player 4 (Purple) leaves the game
  Player - Player 5 (Yellow) leaves the game
  Player - Player 6 (Orange) leaves the game
Conditions
Actions
  Unit Group - Pick every unit in (Units owned by (triggering player)) and do (Actions)
     Loop - Actions
     Unit - Remove (Picked unit) from the game
  Multiboard - Set the text for (Last created multiboard) item in column 2, row Multiboard_Spots[(Player number of (triggering player))] to Leaver.
  Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (triggering player))] to Leaver
  Multiboard - Set the text for (Last created multiboard) item in column 4, row Multiboard_Spots[(Player number of (triggering player))] to Leaver
 
Thanks ryoko, As a matter of a fact the night before I got disconnected cause comcast went down (Thier DNS messed up). I did just that and it worked. I found myself very silly after all the tries I did.

Now another question is, is it able to remove them from the board entirely?
I doubt it but it is a idea to ask.
 
Sort of, but it would be tedious. You could move everything up to the row that you want to delete, then just delete the bottom row.

1
2
3
4 (to be deleted)
5
6

goes to...

1
2
3
5
6
(empty row, which you can remove by setting the numbers of rows to one less)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Real users can't really disable Javascript anymore these days.
  • Ghan Ghan:
    The internet is broken without it.
  • Ghan Ghan:
    Bot readable, not human usable.
  • The Helper The Helper:
    got it
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    Check out the new Featured Content feature we apparently got with the forum software upgrade! https://www.thehelper.net/featured/
  • The Helper The Helper:
    Also on the bottom right side bar we now have a Trending Content Box!
    +1
  • The Helper The Helper:
    Not on the Headline News page just on the Forums page can we get that Featured and Trending on the home page?
  • Ghan Ghan:
    Since the home page is technically a forum, it now shows on all forum views. Still in the sidebar.
    +1
  • The Helper The Helper:
    Happy Friday! Hope everyone has a fantastic day and an even better weekend!
  • The Helper The Helper:
    Happy Sunday!
  • The Helper The Helper:
    I lovc that I can post webp and X links now! :)
  • The Helper The Helper:
    Happy Thursday!
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1

The Helper Discord

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top