Can someone please help me? I am making a map that should be played in 2+ players, but I want the game to end after ALL the players are dead, not after only one player is alive.
What I mean was, is there any script to PREVENT Gameover if there is only one player remaining?
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
Script that ends the game after ALL of the players are dead.
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
-
- Superfighter
- Posts: 67
- Joined: Sun Nov 06, 2016 11:34 pm
- Title: Da God
- SFD Account: Jamisco
- SFD Alias: Jamisco
- Started SFD: either late 2015 or early 2016
- Location: Somewhere in the east of the United states
- Gender:
- Age: 103
You are probably going to have to override the method that triggers game over, in which I don't think gurt has released that to the public yet
0 x
Is it better to be feared or respected... please, is it too much to ask for both?
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
You can prevent gameover only if you change the map type to "custom", then the script will handle the gameover and the showed text.Scraper wrote: ↑Fri Jun 02, 2017 11:10 amCan someone please help me? I am making a map that should be played in 2+ players, but I want the game to end after ALL the players are dead, not after only one player is alive.
What I mean was, is there any script to PREVENT Gameover if there is only one player remaining?
This could be the script you wanted, I've not considered bots as players in this though:
Code: Select all
Events.UpdateCallback m_updateEvent = null;
public void OnStartup() {
m_updateEvent = Events.UpdateCallback.Start(OnUpdate, 0);
}
public void OnUpdate(float elapsed) {
foreach(IPlayer temp in Game.GetPlayers())
if(!temp.IsBot && !temp.IsDead)
return;
Game.SetGameOver("some text");
}
0 x