UGX-Mods

Call of Duty 5: World at War => Downloadable Items for Mappers => Custom Maps, Mods & Tools => Scripts => Topic started by: alaurenc9 on February 22, 2015, 04:47:45 pm

Title: Randomize Player Characters
Post by: alaurenc9 on February 22, 2015, 04:47:45 pm
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.
Title: Re: Randomize Player Characters
Post by: Rorke on February 22, 2015, 06:34:26 pm
This is already on ugx just need to look hard enough
Title: Re: Randomize Player Characters
Post by: simpelsat on February 23, 2015, 09:18:49 am
nice!!! :D
but will it work with YaPh1l Character specific viewhands script?
Title: Re: Randomize Player Characters
Post by: alaurenc9 on February 25, 2015, 03:51:45 am
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.
Title: Re: Randomize Player Characters
Post by: simpelsat on February 25, 2015, 08:51:24 am
ok then here's the tutorial
http://triple-mgames.com/index.php?/topic/3296-character-specific-viewhands/ (http://triple-mgames.com/index.php?/topic/3296-character-specific-viewhands/)