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

Blood Money: Give to 1 player?

broken avatar :(
Created 10 years ago
by Scobalula
0 Members and 1 Guest are viewing this topic.
1,820 views
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 7 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
Signature
Aye mate you don't know me so y don't you shut tf up ok buddy :)

×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Scobalula's Contact & Social Links
Essentially I have a bonus points script made up using DD's roundoff, but I asked on chat and Hitman told me it would give it to all players, what I feared. He advised me to use a distance check, so there's it:

How would I go about doing this? I tried using get_closest_living but didn't work.

Here's the script:

Code Snippet
Plaintext
zombie_cash( drop_item )
{
players = get_players();
int = randomIntRange(10, 4000);
int = roundOff(int, 10, 5);
for(i=0;i<players.size;i++)
{
if(level.zombie_vars["zombie_point_scalar"] == 1)
{
players[i] maps\_zombiemode_score::add_to_player_score(int);
}
else
{
players[i] maps\_zombiemode_score::add_to_player_score(int*2);
}

}
}

Also anyone else reading is free to use this script if they want, I don't mind.
Marked as best answer by Scobalula 10 years ago
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
You can do the same as carpenter do (pass the origin instead of the item):
Code Snippet
Plaintext
case "zombie_cash":
level thread zombie_cash( self.origin );
And then check the distance to the players:
Code Snippet
Plaintext
zombie_cash( origin )
{
players = get_players();
int = randomIntRange(10, 4000);
int = roundOff(int, 10, 5);
for(i=0;i<players.size;i++)
{
        if( distance(players[i].origin,origin) < 64 )
        {
/*if(level.zombie_vars["zombie_point_scalar"] == 1)
{
players[i] maps\_zombiemode_score::add_to_player_score(int);
}
else
{
players[i] maps\_zombiemode_score::add_to_player_score(int*2);
}*/

            // simplified; also allows you to have triple points if you want
            players[i] maps\_zombiemode_score::add_to_player_score(int*["zombie_point_scalar"]);
        }
}
}
Or even easier. Pass also the player who grabs it:
Code Snippet
Plaintext
case "zombie_cash":
level thread zombie_cash( self,players[i] );

// ·························································

zombie_cash( drop_item,player )
{
//players = get_players();
int = randomIntRange(10, 4000);
int = roundOff(int, 10, 5);
/*for(i=0;i<players.size;i++)
{
if(level.zombie_vars["zombie_point_scalar"] == 1)
{
players[i] maps\_zombiemode_score::add_to_player_score(int);
}
else
{
players[i] maps\_zombiemode_score::add_to_player_score(int*2);
}*/

    // simplified; also allows you to have triple points if you want
    player maps\_zombiemode_score::add_to_player_score(int*["zombie_point_scalar"]);
//}
}
Last Edit: November 08, 2015, 01:33:39 pm by Soy-Yo
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 7 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Scobalula's Contact & Social Links
~snip~

Thanks, unfortunately I can't test it (Can't test Co-Op), but no reason for it not to work, thanks. :P
Last Edit: November 08, 2015, 02:22:58 pm by Scobalula

 
Loading ...