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

Randomize Player Characters

broken avatar :(
Created 9 years ago
by alaurenc9
0 Members and 1 Guest are viewing this topic.
7,674 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Hey guys
Today I made another tutorial.
For the randomizing of player models.
So that different the same player
can be a different character in each game.
Your player voices change, player models,
and even the color of your points will change
depending on which character the game made you.
Here the script:

Code Snippet
Plaintext
//===========================================================================
// Script Name : Randomize Zombie Characters
// Author : xSanchez78( alaurenc9 )
// Notes : Read The Directions Below
//===========================================================================

//////////////Script Instructions Here//////////////

/*********************************************************************************************************************************************************

In your "mapname.gsc", call
maps\_character_randomize::init();

Underneath this:
--------------------
FUNCTION CALLS - PRE _Load
----------------------

In "_loadout.gsc", find this function: "give_model( class )"
Scroll down to where it says this:
switch(self.entity_num)
{
case 0:
character\char_zomb_player_0::main();
break;
case 1:
character\char_zomb_player_1::main();
break;
case 2:
character\char_zomb_player_2::main();
break;
case 3:
character\char_zomb_player_3::main();
break;
}

Replace that with this:
switch( maps\_zombiemode_weapons::get_player_index( self ) )
{
case 0:
character\char_zomb_player_0::main();
break;
case 1:
character\char_zomb_player_1::main();
break;
case 2:
character\char_zomb_player_2::main();
break;
case 3:
character\char_zomb_player_3::main();
break;
}

In "_zombiemode_weapons.gsc", find this function: "get_player_index(player)"
In that function, replace
return player.entity_num;

with
return level.random_character_index[player.entity_num];

In "_zombiemode.gsc", find this function: "onPlayerConnect_clientDvars()"
Underneath the "SetClientDvars" function, add this:
for( i = 0; i < 4; i++ )
        {
self SetClientDvar( "cg_ScoresColor_Gamertag_" + i, level.random_character_color[ level.random_character_index[ i ] ] );
        }

Make Sure you have edited each file correctly,
and that they are in your "Root/mods/mapname/maps" folder.
Call this script this:
_character_randomize.gsc

Make sure it is placed in "Root/mods/mapname/maps" aswell.
When building mod, make sure to check the following:
maps/_zombiemode.gsc
maps/_zombiemode_weapons.gsc
maps/_loadout.gsc
maps/mapname.gsc
maps/_character_randomize.gsc

Compile Map/Build Mod and enjoy!


*********************************************************************************************************************************************************/

#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;

init()
{
randomize_character_index();
get_player_score_colors();
}

randomize_character_index()
{
level.random_character_index = [];
for( i = 0; i < 4; i++ )
{
level.random_character_index[ i ] = i;
}
level.random_character_index = array_randomize( level.random_character_index );
}

get_player_score_colors()
{
level.random_character_color = [];
for( i = 0; i < 4; i++ )
{
level.random_character_color[ i ] = GetDvar( "cg_ScoresColor_Gamertag_" + i );
}
}

The instructions are at the top of the script.
They should be easy to read.
If you need any help, comment on this or PM me.
If you use this, please remember to credit me.
If something goes wrong, let me know.
Thanks everybody, and peace.
Last Edit: February 25, 2015, 03:53:48 am by alaurenc9
broken avatar :(
×
broken avatar :(
Remington R5
Location: gbBarnsley
Date Registered: 18 January 2015
Last active: 3 years ago
Posts
742
Respect
Forum Rank
Zombie Enslaver
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
paypal.me/RT275
Signature
paypal.me/RT275
×
Rorke's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Rorke's Contact & Social Linkshickle.meddowsandrewshaworiginal_rorkewormnation
This is already on ugx just need to look hard enough
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 8 June 2014
Last active: 2 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
simpelsat's Groups
simpelsat's Contact & Social Linkssimpelsatsimpelsat
nice!!! :D
but will it work with YaPh1l Character specific viewhands script?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
nice!!! :D
but will it work with YaPh1l Character specific viewhands script?

I dont know.
I mean it depends on how he defines the viewhands to the players
If he uses the "maps\_zombiemode_weapons::get_player_index() function
then yes it will work and set to the different players.
If not, id ont know.
if you could show me the tutorial, i could figure it out for you.
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 8 June 2014
Last active: 2 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
simpelsat's Groups
simpelsat's Contact & Social Linkssimpelsatsimpelsat

 
Loading ...