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 players = get_players(); in the init_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.startguns = ; //The following sets up 4 possible guns, be sure to add_weapon below, where appropriate level.startguns[level.startguns.size] = "zombie_colt";//change weapon, not needed for player randomizing level.startguns[level.startguns.size] = "zombie_colt";//change weapon, not needed for player randomizing level.startguns[level.startguns.size] = "zombie_colt";//change weapon, not needed for player randomizing level.startguns[level.startguns.size] = "zombie_colt";//change weapon, not needed for player randomizing //The following will randomize the each players weapons at start. Comment out to not do that level.startguns = array_randomize(level.startguns);//randomizes starting gun each game per player, not needed for player randomizing level.bodys = array_randomize(level.bodys);
4. Search for "zombiemode" and find add_weapon("zombie_colt"); 5. Add the four weapons you would like to start with, if you want multiple weapons otherwise skip this step, i.e.:
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.:
8.1 Copy dlc3_code.gsc to your mods/mapnme/maps folder and open it, then modify the level_start_vox() function like this to fix the first time playing demsy quote
Code Snippet
Plaintext
level_start_vox() { wait( 6 );//moved here index = maps\_zombiemode_weapons::get_player_index( self ); plr = "plr_" + index + "_"; // wait( 6 );//commented out self thread create_and_play_dialog( plr, "vox_level_start", 0.25 ); }
8.2 In dlc3_code.gsc, find player_zombie_awareness function and add a wait(6); before the index line:
Code Snippet
Plaintext
player_zombie_awareness() { self endon("disconnect"); self endon("death"); players = getplayers(); wait(6);//add this line so it doesn't get the index before the players are established (or move index line to before its needed lower in the function) index = maps\_zombiemode_weapons::get_player_index(self);
NOTE
Random players are done. For any of the following you do not want, simply skip the step.
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):
if( IsDefined( level.player_switchweapon ) ) { // the wait was added to fix a revive issue with the host // for some reson the SwitchToWeapon message gets lost // this can be removed if that is ever resolved if ( isdefined(wait_for_switch_weapon) && wait_for_switch_weapon == true ) { wait(0.5); } self SwitchToWeapon( level.player_switchweapon ); }
to (level changes to self):
Code Snippet
Plaintext
if( IsDefined( self.player_switchweapon ) ) { // the wait was added to fix a revive issue with the host // for some reson the SwitchToWeapon message gets lost // this can be removed if that is ever resolved if ( isdefined(wait_for_switch_weapon) && wait_for_switch_weapon == true ) { wait(0.5); } self SwitchToWeapon( self.player_switchweapon ); }
11. If using different viewarms for each, find and comment out this:
12. To update laststand pisols open your _laststand.gsc in raw/maps folder and find laststand_take_player_weapons() function and add this under self.laststandpistol = undefined;:
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 init_loadout() function put this:
Oh, I'm sorry, that may have been apart of that other tut the op in the forum post was using when I was setting this up. You can just put it under players = get_players();
I'll update the tut, thanks!
Last Edit: June 08, 2015, 03:11:07 pm by MakeCents
my character keeps getting 4 guns on solo I added 4 weapon variants to my map and I want each player to have a different type of starting weapon. I tested the weapons themselves and they work as they should but when I start the game my character has the default weapon and the 4 I added (the default weapon is 1 of the 4 variants) I triple checked my code and everything is how the tutorial says it should be but I cant get my character to only have 1 weapon. or even the defaut and 1 random gun. can someone plz help me Ive been stuck on this for days. P.S. Im only doing the weapons part not the viewarms
my character keeps getting 4 guns on solo I added 4 weapon variants to my map and I want each player to have a different type of starting weapon. I tested the weapons themselves and they work as they should but when I start the game my character has the default weapon and the 4 I added (the default weapon is 1 of the 4 variants) I triple checked my code and everything is how the tutorial says it should be but I cant get my character to only have 1 weapon. or even the defaut and 1 random gun. can someone plz help me Ive been stuck on this for days. P.S. Im only doing the weapons part not the viewarms
I'm sorry, I never get notifications from new members on this site. I don't know if that is a setting or on purpose or what. I'm not sure about the prob you are having. If you have definitely isolated it to this tut, then I can take a look. If you put this script back and it still does it, then of course it is something else.
The only place I giveweapon is in the setup. If you are one player it should only run once for that player because of the switch. I use this exact setup, without the viewarms, just like you, with a slight modification with a randomized array to give each player a randomized starting and laststand weapon each time, which doesn't change anything, so it should work, unless I missed something else.
I updated the tut with my weapon randomizer option.
Last Edit: August 18, 2015, 01:20:10 pm by MakeCents
I'm sorry, I never get notifications from new members on this site. I don't know if that is a setting or on purpose or what. I'm not sure about the prob you are having. If you have definitely isolated it to this tut, then I can take a look. If you put this script back and it still does it, then of course it is something else.
The only place I giveweapon is in the setup. If you are one player it should only run once for that player because of the switch. I use this exact setup, without the viewarms, just like you, with a slight modification with a randomized array to give each player a randomized starting and laststand weapon each time, which doesn't change anything, so it should work, unless I missed something else.
I updated the tut with my weapon randomizer option.
thanks for responding quickly ppl usually take a bit longer to do so. I did find out tge exact problem and it is definitely not with your tut. I decided to make my own simple script to randomize just the starting gun and I was getting the same error. anyways the problem is when putting more than 1 add_weapon(weapon); for example if I do add_weapon 4 times because I want diff guns, my character will get as many weapons as I did add_weapon I did a quick fix by modifying your SetUp_weapons funtion to remove the default starting gun then run add_weapon and then do all the stuff your function already had. so this works and my character gets only 1 gun and its random every game but I have no way of testing this in Co-Op and im afraid that I will run into the same problem if more than 1 player is in the game.
thanks for responding quickly ppl usually take a bit longer to do so. I did find out tge exact problem and it is definitely not with your tut. I decided to make my own simple script to randomize just the starting gun and I was getting the same error. anyways the problem is when putting more than 1 add_weapon(weapon); for example if I do add_weapon 4 times because I want diff guns, my character will get as many weapons as I did add_weapon I did a quick fix by modifying your SetUp_weapons funtion to remove the default starting gun then run add_weapon and then do all the stuff your function already had. so this works and my character gets only 1 gun and its random every game but I have no way of testing this in Co-Op and im afraid that I will run into the same problem if more than 1 player is in the game.
Np.
Well, I am not sure why, but I would look at your add_weapon function in loadout.gsc. It should not be giving the weapon there or threading any function that is giving a weapon. Mine looks like this:
Or if yours looks like this, maybe it has something to do with level.player_loadout.size?
Do you have something like this in your give_loadout function?
Code Snippet
Plaintext
for( i = 0; i < level.player_loadout.size; i++ ) { self GiveWeapon( level.player_loadout[i] ); }
If so, try commenting that out then. I'm sorry if that is a step I forgot. I guess I thought mine was always commented out already? I might be slightly guilty of editing my raw file on this one. If there is a switch after that, you don't need that anymore either. You can comment everything up to:
for( i = 0; i < level.player_loadout.size; i++ ) { self GiveWeapon( level.player_loadout[i] ); }
like you said and re added the add_weapon(wepon); call to the init function at the top and it worked perfectly. I have not tested this in Co-Op like I said before but I am confidant that when I release it for testing This wont have any errors.
I think my for loop was uncommented due to my script placer because Im pretty sure someone else would of ran into this error if that was the case, so its not your fault just different script placers.
anyways Thank You so much for your help, I only ended up using your SetUp_weapons(); function out of the whole tut but Ill still give you credit since I honestly dont think I would of found that giveweapon without you.
Getting an issue that makes the player model of a character change every time they respawn, this can cause more than one of the same character to be on the map at a time. There are also a load of random Dempsey quotes even if the player is not Dempsey and then these are followed by the wuotes of the actual players character.
If you want scripts / features made for you, then contact me by PM or email / skype etc it will cost you tho so if you have no intention of reciprocating don't even waste my time
Getting an issue that makes the player model of a character change every time they respawn, this can cause more than one of the same character to be on the map at a time. There are also a load of random Dempsey quotes even if the player is not Dempsey and then these are followed by the wuotes of the actual players character.
itll be the intro quote that is sometimes wrong, not sure why, think it must get set up before the characters - tends to be correct after a esc - restart
its called in dlc3_code.gsc ( the one i found in zombiemode.gsc is irrelevent )
Last Edit: April 07, 2016, 11:51:26 am by Harry Bo21
itll be the intro quote that is sometimes wrong, not sure why, think it must get set up before the characters - tends to be correct after a esc - restart
its called in dlc3_code.gsc ( the one i found in zombiemode.gsc is irrelevent )
Yeah I was aware of the start quote being an unfixable one but it seems like there are random quotes during the game. THink it may be linked to the changing of character when respawning. Character saying old character quotes.
Getting an issue that makes the player model of a character change every time they respawn, this can cause more than one of the same character to be on the map at a time. There are also a load of random Dempsey quotes even if the player is not Dempsey and then these are followed by the wuotes of the actual players character.
I've heard the random dempsy quotes but I also hear each players quotes too. Think I saw somewhere it happens with takeo, but I don't really remember. I may have seen the same player spawn on my old version of this tut, but don't remember. I don't currently have that issue, so I will look at my scripts later and update this then if there is a difference. Just looking at the script I would comment this line out and see what it does.
Code Snippet
Plaintext
//self.body_select = randomint(4);
Edit: After further review, that shouldn't matter if self.entity_num is defined. So that not being defined could be causing multiple people to spawn at the same time. Edit 2: And I now see that you are saying after they die and respawn they are changing, which is bizarre, but I'll have to look at mine then later, and test that. I plan on coop testing tonight anyway, so I will make sure it isn't doing that in mine and maybe just post my load.
Last Edit: April 07, 2016, 12:49:32 pm by MakeCents
I've heard the random dempsy quotes but I also hear each players quotes too. Think I saw somewhere it happens with takeo, but I don't really remember. I may have seen the same player spawn on my old version of this tut, but don't remember. I don't currently have that issue, so I will look at my scripts later and update this then if there is a difference. Just looking at the script I would comment this line out and see what it does.
Code Snippet
Plaintext
//self.body_select = randomint(4);
Edit: After further review, that shouldn't matter if self.entity_num is defined. So that not being defined could be causing multiple people to spawn at the same time. Edit 2: And I now see that you are saying after they die and respawn they are changing, which is bizarre, but I'll have to look at mine then later, and test that.
could actually be a nice feature so long as you keep track of what characters are left in the ""not currently used" pool