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

How to randomize characters for coop?

broken avatar :(
Created 11 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
5,196 views
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
I followed this tutorial. http://www.zombiemodding.com/index.php?topic=16270. But it only works for solo, I want it so the coop player gets randomized each time as well, similar to black ops and black ops 2. Do I need to change something specific in this tutorial? Or use a completely different code?



PS sorry its zombiemodding, UGX doesn't have this tutorial anywhere.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I'm not sure about the tut but I randomize mine with this:

Code Snippet
Plaintext

//after the following in _loadout
else if( isDefined( level.use_zombie_heroes ) && level.use_zombie_heroes )
{

I put:

Code Snippet
Plaintext

self.body_select = randomint(4);
if(isdefined(self.entity_num)){
self.body_select = level.bodys[self.entity_num];
}


switch( self.body_select)
{
case 0:
character\char_zomb_player_0::main();
self SetUp_Weapons("zombie_colt");
break;
case 1:
character\char_zomb_player_1::main();
self SetUp_Weapons("walther");
break;
case 2:
character\char_zomb_player_2::main();
self SetUp_Weapons("desert_eagle");
break;
case 3:
character\char_zomb_player_3::main();
self SetUp_Weapons("colt");
break;
}


Which also randomizes starting pistols, and lastand pistols, with some other modifications elsewhere.



Edit:
Oops, I forgot to add this part:

Up in init_loadout() I add this:
Code Snippet
Plaintext
	level.bodys = [];
level.bodys[level.bodys.size] = 0;
level.bodys[level.bodys.size] = 1;
level.bodys[level.bodys.size] = 2;
level.bodys[level.bodys.size] = 3;
level.bodys = array_randomize(level.bodys);

after level.gaveweapons = [];


Prob could be done prettier, but when something works, lol, I don't go back to fix it.

Edit 2:
Forgot this:

Code Snippet
Plaintext
SetUp_Weapons(weapon){
self GiveWeapon(weapon);
self.player_switchweapon = weapon;
self.last_stand_weapon = weapon;
}

This is my Setup function. I use the self.last_stand_weapon later to give the player that weapon instead of the colt or default one. Let me know if I forgot anything else. Been a while since I did this.
Last Edit: June 01, 2015, 06:05:23 pm by MakeCents
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
One more question. How do you usually randomize your viewhands? I followed yaphils tut http://www.zombiemodding.com/index.php?topic=14036.msg135627#msg135627, and it worked fine with the random characters tut, but now that I replaced that code with yours it doesn't randomize the viewhands anymore.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Well, I don't in this map. But it appears you could do it the same way. Just by adding:

Code Snippet
Plaintext

self SetViewModel("the arms");



to each one that you want to change arms on, under setup_weapons... and then commenting out this part prob:

Code Snippet
Plaintext
	if( IsDefined( level.player_viewmodel ) )
{
self SetViewModel( level.player_viewmodel );
}

Last Edit: June 01, 2015, 06:14:59 pm by MakeCents
broken avatar :(
  • steviewonder87
  • Deleted Member
×
broken avatar :(
steviewonder87
This user is deleted :(
Could you make this a proper tut MC? With the random hands included? Bam's one causes freezing, and YaPhil's one isn't compatible with it without extra scripting (which I have but not everyone does). I think it would be useful for people :)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Could you make this a proper tut MC? With the random hands included? Bam's one causes freezing, and YaPhil's one isn't compatible with it without extra scripting (which I have but not everyone does). I think it would be useful for people :)

I guess I could if it works for zombiekilla, and after anyone else wants to comment on how they would do it or changes they would make for the better.

Edit:
Here is a start to the tut. It will take me longer to post it cause I need to look at an original loadout later and test it.
Spoiler: click to open...
This tut will help you make your players randomize in solo and coop, and give you options for different starting weapons, viewarms, and laststand pistols.
NOTE
This tut assumes you already know how to get weapons or viewarms into your map, via raw folders or csvs.


1. Copy _loadout.gsc from your root/raw/maps folder to your root/mods/mapname/maps folder, if you haven't already
2. Open _loadout.gsc in your mods folder in a text editor, i.e. Sublime Text 2, Notepad, and Notepad++
3. Under level.gaveweapons = []; in the inti_loadout() function put this:
Code Snippet
Plaintext
	level.bodys = [];
level.bodys[level.bodys.size] = 0;
level.bodys[level.bodys.size] = 1;
level.bodys[level.bodys.size] = 2;
level.bodys[level.bodys.size] = 3;
level.bodys = array_randomize(level.bodys);
4. Search for "zombiemode" and find add_weapon("colt");
5. Add the four weapons you would like to start with, if you want multiple weapons otherwise skip this step, i.e.:
Code Snippet
Plaintext
		add_weapon( "change weapon");
add_weapon( "change weapon");
add_weapon( "change weapon");
add_weapon( "colt");
6. Add PrecacheModel("vewarms") for each viewarms you will be using under the add_weapon lines, if you want to use multiple viewarms, otherwise skip this step, i.e.:
Code Snippet
Plaintext
		PrecacheModel( "change arms" );
PrecacheModel( "change arms" );
PrecacheModel( "change arms" );
PrecacheModel( "change arms" );
6. Scroll down to give_model( class) function.
7. Find the following:
Code Snippet
Plaintext
		else if( isDefined( level.use_zombie_heroes ) && level.use_zombie_heroes ) 
{
8. Paste this under it:
Code Snippet
Plaintext
			self.body_select = randomint(4);
if(isdefined(self.entity_num)){
self.body_select = level.bodys[self.entity_num];
}
switch( self.body_select)
{
case 0:
character\char_zomb_player_0::main();
// self SetUp_Weapons("change weapon");
// self SetViewModel("change arms");
break;
case 1:
character\char_zomb_player_1::main();
// self SetUp_Weapons("change weapon");
// self SetViewModel("change arms");
break;
case 2:
character\char_zomb_player_2::main();
// self SetUp_Weapons("change weapon");
// self SetViewModel("change arms");
break;
case 3:
character\char_zomb_player_3::main();
// self SetUp_Weapons("change weapon");
// self SetViewModel("change arms");
break;
}
9. If you want different starting weapons or viewarms, uncomment the appropriate lines above and modify the string (the text between the quotes) and add this function above give_model( class):
Code Snippet
Plaintext
SetUp_Weapons(weapon){
self GiveWeapon(weapon);
self.player_switchweapon = weapon;
self.last_stand_weapon = weapon;
}
10. If using different viewarms for each, find and comment out this:
Code Snippet
Plaintext
	if( IsDefined( level.player_viewmodel ) )
{
self SetViewModel( level.player_viewmodel );
}
11. Then where ever you give and switch to level.laststandpistol, give and switch to self.last_stand_pistol instead.


Last Edit: June 01, 2015, 07:08:45 pm by MakeCents
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
Nope it still gives me the same viewhand no matter what character i am playing as.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Nope it still gives me the same viewhand no matter what character i am playing as.

Well if you commented out the lines:

Code Snippet
Plaintext
	if( IsDefined( level.player_viewmodel ) )
{
self SetViewModel( level.player_viewmodel );
}


Then I will have to test when I am at home to see why it is doing that, since the script I have only uses one set of viewarms for starting players. I'll get back to you later.
Last Edit: June 01, 2015, 07:12:06 pm by MakeCents
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
Would I need to change this

Code Snippet
Plaintext
give_player_specific_viewmodel()
{
num = self.entity_num;
if(IsDefined(self.entity_num_randomized))
         num = self.entity_num_randomized;
if(IsDefined(level.player_specific_viewmodels) && IsDefined(level.player_specific_viewmodels[num]))
{
         self SetViewModel(level.player_specific_viewmodels[num]);
}
else if(IsDefined(level.player_viewmodel))
{
         self SetViewModel(level.player_viewmodel);
}
}

since self.entity_num_randomized was from the old script and in this new one it doesn't have that therefore it isnt defined.

nvm forgot to get rid of the else if, when i searched for it nothing came up but now i see it
Last Edit: June 01, 2015, 07:15:53 pm by thezombiekilla6
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I would believe so. if this is from that tut, you would take all that tut stuff out. Or just comment it out to test.
Last Edit: June 01, 2015, 07:16:29 pm by MakeCents
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
I would believe so. if this is from that tut, you would take all that tut stuff out. Or just comment it out to test.

I took all the stuff out from the old tut and now it works perfectly, have yet to test it on coop, but when I do and I run into problems I will message you about it
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I took all the stuff out from the old tut and now it works perfectly, have yet to test it on coop, but when I do and I run into problems I will message you about it

Alright. I added the tut:
http://ugx-mods.com/forum/index.php?topic=6924.new#new

This should take care of any issues you may have, let me know if I missed something or something isn't clear.

 
Loading ...