Hi guys, I’m fairly new to workshops but I am having a blast with it as of now, I want to create a game where you cannot play the same character after you die, kinda locking them for you until the next match or whatnot. is it possible and if so how would I achieve such a thing ? thanks in advance
Here’s some working code for you (if your on PC just copy paste it directly into the workshop)
variables
{
player:
0: AvailableHeroes
1: TempHero
}
rule("Setup Player")
{
event
{
Player Joined Match;
All;
All;
}
actions
{
Event Player.AvailableHeroes = All Heroes;
Set Player Allowed Heroes(Event Player, Event Player.AvailableHeroes);
}
}
rule("Player Died")
{
event
{
Player Died;
All;
All;
}
actions
{
"stores the hero so that it wont remove the wrong hero if they swap before respawning"
Event Player.TempHero = Hero Of(Event Player);
Wait Until(Is Alive(Event Player), 99999);
Wait Until(Is In Spawn Room(Event Player), 0.100);
"can remove this (& wait untill is in spawn room) if you dont want to filter out mercy rez's"
Abort If(!Is In Spawn Room(Event Player));
Modify Player Variable(Event Player, AvailableHeroes, Remove From Array By Value, Event Player.TempHero);
Set Player Allowed Heroes(Event Player, Event Player.AvailableHeroes);
"stuff to trigger when no hero available, in this example it moves the player to Team All which unless its FFA.. should make they start spectating"
If(Event Player.AvailableHeroes == Empty Array);
Move Player to Team(Event Player, All Teams, -1);
End;
}
}
Also the reason why it waits until they respawn, is so the player doesn’t skip the respawn timer (since it boots them out of their hero). but you can remove it if your mode doesn’t need respawn timers.
Pro Tip: removing the hero in the game settings will remove their hero icon in hero select. but when the workshop allows the player to play as that hero it’ll Temporary enable its icon in hero select. until the hero is removed using the workshop again.
thanks a lot worked like a charm!