UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Have Something Happen When A Player Downs (Using Level Variables)

broken avatar :(
Created 11 years ago
by jbird
0 Members and 1 Guest are viewing this topic.
4,126 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 2 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
×
jbird's Groups
Want to have something happen when a player downs? Welp here ya go
Code Snippet
Plaintext
player_downed_function()
{
while( 1 )
{
players = get_players();
players_alive = 0;
for( i = 0; i < players.size; i++ )
{
if( is_player_valid(players[i]) )
{
players_alive++;
}
}
if( !IsDefined( level.players_alive_change ) )
{
level.players_alive_change = players.size;
}
if (players_alive < level.players_alive_change)
{
// put whatever you want to happen here
level.players_alive_change = players_alive;
}
else if(players_alive != level.players_alive_change) //so that the variable updates when spectators respawn
{
level.players_alive_change = players_alive;
}
wait(0.05);
}
}

If you the function to happen when a player bleeds out instead of downs, change

Code Snippet
Plaintext
if( is_player_valid(players[i]) )

to

Code Snippet
Plaintext
if( players[i].sessionstate != "spectator" )

Here is an example of what I used it for. I made it so that a message pops up showing how many players are left alive like in Grief mode.

Code Snippet
Plaintext
grief_msg()
{
while( 1 )
{
players = get_players();
players_alive = 0;
for( i = 0; i < players.size; i++ )
{
if( is_player_valid(players[i]) )
{
players_alive++;
}
}
if( !IsDefined( level.players_alive_change ) )
{
level.players_alive_change = players.size;
}
if (players_alive < level.players_alive_change && players_alive > 1)
{
iprintlnbold("Enemy Down! ["+players_alive+" Remaining]");
level.players_alive_change = players_alive;
}
else if(players_alive < level.players_alive_change && players_alive == 1)
{
iprintlnbold("All Enemies Down!");
wait(2.5);
iprintlnbold("Survive to Win!");
level.players_alive_change = players_alive;
}
else if(players_alive != level.players_alive_change) //so that the variable updates when spectators respawn
{
level.players_alive_change = players_alive;
}
wait(0.05);
}
}
Last Edit: June 18, 2015, 07:53:27 pm by jbird
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Not even remotely correct.

To notify when a player goes down there's a built in notify already in _laststand.gsc as I told you to check.

The notify is: player_downed

Use as: self waittill("player_downed"); level thread notify_player_went_down();
And that function would print and do whatever logic is necessary.
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 2 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
jbird's Groups
I tested it this way and it works also. This way you can also have something happen when a player bleeds out
Last Edit: June 13, 2015, 07:19:16 pm by jbird
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I tried using that waittill and I couldn't get it to work, I tested this and it works

The notify is sent to player not level or anything else.
broken avatar :(
×
broken avatar :(
Location: gbNewport
Date Registered: 2 November 2014
Last active: 4 years ago
Posts
1,265
Respect
Forum Rank
Zombie Colossus
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Embrace the Darkness
×
Tim Smith's Groups
Tim Smith's Contact & Social LinksTimSmithtimsmith90THEREALBaDBoY17My clan Website
What even this script do :\ and by seeing DidUknowiPwn saying this

Not even remotely correct.

i don't care for it then fix it then dude
broken avatar :(
  • steviewonder87
  • Deleted Member
×
broken avatar :(
steviewonder87
This user is deleted :(
What even this script do :\ and by seeing DidUknowiPwn saying this

i don't care for it then fix it then dude
:facepalm2: You sir, are a moron.
broken avatar :(
×
broken avatar :(
Location: gbNewport
Date Registered: 2 November 2014
Last active: 4 years ago
Posts
1,265
Respect
Forum Rank
Zombie Colossus
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Embrace the Darkness
×
Tim Smith's Groups
Tim Smith's Contact & Social LinksTimSmithtimsmith90THEREALBaDBoY17My clan Website
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha

 
Loading ...