I need a full script that check if team 2(or Bot) is eliminated and end the game, when triggered by script trigger or area trigger
need that script to make wave surviving game
Also, I need script that end the game when all players dead(except bot)
This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk
Forum rules
Forum rules
Script Request: end the game when team 2(Bot) is eliminated
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- JakSparro98
- Superfighter

- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 27
Code: Select all
public void CheckStatus(TriggerArgs arg){
bool PlayerAlive=false;
bool BotsAlive=false;
foreach(IPlayer temp in Game.GetPlayers())
{
if(temp.IsBot && !temp.IsDead)
BotsAlive=true;
else if(!temp.IsDead)
PlayerAlive=true;
}
//when bots are eliminated
if(!BotsAlive)
{
Game.SetGameOver("bots dead");
}
//when there aren't players alive
if(!PlayerAlive)
{
Game.SetGameOver("players dead");
}
}
1 x
- The_JOKER
- Fighter

- Posts: 38
- Joined: Mon Jul 18, 2016 2:35 am
- Title: I'm Korean JOKER :)
- SFD Account: JOKER_Korea
- SFD Alias: JOKER
- Started SFD: April 2016
- Location: South Korea
- Gender:
- Age: 25
- Contact:
Thank you, This is what I wanted.JakSparro98 wrote: ↑Sun Jun 04, 2017 3:59 pmLet me know if it's what you wanted or if you need something else.Code: Select all
public void CheckStatus(TriggerArgs arg){ bool PlayerAlive=false; bool BotsAlive=false; foreach(IPlayer temp in Game.GetPlayers()) { if(temp.IsBot && !temp.IsDead) BotsAlive=true; else if(!temp.IsDead) PlayerAlive=true; } //when bots are eliminated if(!BotsAlive) { Game.SetGameOver("bots dead"); } //when there aren't players alive if(!PlayerAlive) { Game.SetGameOver("players dead"); } }
By the way I need one more script,
can you make script that activate trigger (Like Camera area trigger, Timer trigger) when Game ends?
0 x
- JakSparro98
- Superfighter

- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 27
Replace the code with this one:
Code: Select all
int ActivateOnce=0;
public void CheckStatus(TriggerArgs arg){
bool PlayerAlive=false;
bool BotsAlive=false;
foreach(IPlayer temp in Game.GetPlayers())
{
if(temp.IsBot && !temp.IsDead)
BotsAlive=true;
else if(!temp.IsDead)
PlayerAlive=true;
}
//when bots are eliminated
if(!BotsAlive)
{
Game.SetGameOver("bots dead");
}
//when there aren't players alive
if(!PlayerAlive)
{
Game.SetGameOver("players dead");
}
if((!BotsAlive || !PlayerAlive) && ActivateOnce==0)
{
ActivateOnce=1;
foreach(IObjectTrigger temp in Game.GetObjectsByCustomID("ToActivate"))
{
temp.Trigger();
}
}
}
Keep in mind that the triggers will be activated once, when all players are all died or when the bots are.
0 x
- The_JOKER
- Fighter

- Posts: 38
- Joined: Mon Jul 18, 2016 2:35 am
- Title: I'm Korean JOKER :)
- SFD Account: JOKER_Korea
- SFD Alias: JOKER
- Started SFD: April 2016
- Location: South Korea
- Gender:
- Age: 25
- Contact:
Thank you, you helped me a lot making my first surviving map!JakSparro98 wrote: ↑Mon Jun 05, 2017 2:46 pmReplace the code with this one:Then you need to add ToActivate as CustomID to all triggers you want to activate.Code: Select all
int ActivateOnce=0; public void CheckStatus(TriggerArgs arg){ bool PlayerAlive=false; bool BotsAlive=false; foreach(IPlayer temp in Game.GetPlayers()) { if(temp.IsBot && !temp.IsDead) BotsAlive=true; else if(!temp.IsDead) PlayerAlive=true; } //when bots are eliminated if(!BotsAlive) { Game.SetGameOver("bots dead"); } //when there aren't players alive if(!PlayerAlive) { Game.SetGameOver("players dead"); } if((!BotsAlive || !PlayerAlive) && ActivateOnce==0) { ActivateOnce=1; foreach(IObjectTrigger temp in Game.GetObjectsByCustomID("ToActivate")) { temp.Trigger(); } } }
Keep in mind that the triggers will be activated once, when all players are all died or when the bots are.
I will add you at the Credits on gameover
0 x