Good night, all right? I am adding a new power up on my map, but I'm having some problems and is very difficult to test the power up playing till you drop in luck... Is there any way to spawn the power up whenever you start the game to facilitate? I tried using a script_struct, but it did not work...
// never drop unless in the playable area playable_area = getentarray("playable_area","targetname"); //chris_p - fixed bug where you could not have more than 1 playable area trigger for the whole map valid_drop = false; for (i = 0; i < playable_area.size; i++) { if (powerup istouching(playable_area[i])) { valid_drop = true; break; } }
special_drop_setup(powerup) { //powerup = undefined; // Soy-yo's edit is_powerup = true; if( !isDefined( powerup ) ) { powerup = get_next_powerup(); // Always give something at lower rounds or if a player is in last stand mode. if ( level.round_number <= 10 || maps\_laststand::player_num_in_laststand() ) { powerup = get_next_powerup(); } // Gets harder now else { powerup = level.zombie_special_drop_array[ RandomInt(level.zombie_special_drop_array.size) ]; if ( level.round_number > 15 && ( RandomInt(100) < (level.round_number - 15)*5 ) ) { powerup = "nothing"; } }
//MM test Change this if you want the same thing to keep spawning // powerup = "dog"; switch ( powerup ) { // Don't need to do anything special case "nuke": case "insta_kill": case "double_points": case "carpenter": break;
// Limit max ammo drops because it's too powerful case "full_ammo": if ( level.round_number > 10 && ( RandomInt(100) < (level.round_number - 10)*5 ) ) { // Randomly pick another one powerup = level.zombie_powerup_array[ RandomInt(level.zombie_powerup_array.size) ]; } break;
you could also do it by commenting out all the add_zombie_powerup except the one for your powerup which would mean only your powerup will be dropped. and then by editing
Code Snippet
Plaintext
set_zombie_var( "zombie_powerup_drop_increment", 2000 ); // lower this to make drop happen more often set_zombie_var( "zombie_powerup_drop_max_per_round", 4 ); // increase this to make more drops per round
to something like this
Code Snippet
Plaintext
set_zombie_var( "zombie_powerup_drop_increment", 500 ); // lower this to make drop happen more often set_zombie_var( "zombie_powerup_drop_max_per_round", 500 ); // increase this to make more drops per round
then your drop will be the only drop and will spawn many times in one round and then when you are done testing just replace the variables, and uncomment the add_zombie_powerup lines
you could also do it by commenting out all the add_zombie_powerup except the one for your powerup which would mean only your powerup will be dropped. and then by editing
Code Snippet
Plaintext
set_zombie_var( "zombie_powerup_drop_increment", 2000 ); // lower this to make drop happen more often set_zombie_var( "zombie_powerup_drop_max_per_round", 4 ); // increase this to make more drops per round
to something like this
Code Snippet
Plaintext
set_zombie_var( "zombie_powerup_drop_increment", 500 ); // lower this to make drop happen more often set_zombie_var( "zombie_powerup_drop_max_per_round", 500 ); // increase this to make more drops per round
then your drop will be the only drop and will spawn many times in one round and then when you are done testing just replace the variables, and uncomment the add_zombie_powerup lines
// never drop unless in the playable area playable_area = getentarray("playable_area","targetname"); //chris_p - fixed bug where you could not have more than 1 playable area trigger for the whole map valid_drop = false; for (i = 0; i < playable_area.size; i++) { if (powerup istouching(playable_area[i])) { valid_drop = true; break; } }
special_drop_setup(powerup) { //powerup = undefined; // Soy-yo's edit is_powerup = true; if( !isDefined( powerup ) ) { powerup = get_next_powerup(); // Always give something at lower rounds or if a player is in last stand mode. if ( level.round_number <= 10 || maps\_laststand::player_num_in_laststand() ) { powerup = get_next_powerup(); } // Gets harder now else { powerup = level.zombie_special_drop_array[ RandomInt(level.zombie_special_drop_array.size) ]; if ( level.round_number > 15 && ( RandomInt(100) < (level.round_number - 15)*5 ) ) { powerup = "nothing"; } }
//MM test Change this if you want the same thing to keep spawning // powerup = "dog"; switch ( powerup ) { // Don't need to do anything special case "nuke": case "insta_kill": case "double_points": case "carpenter": break;
// Limit max ammo drops because it's too powerful case "full_ammo": if ( level.round_number > 10 && ( RandomInt(100) < (level.round_number - 10)*5 ) ) { // Randomly pick another one powerup = level.zombie_powerup_array[ RandomInt(level.zombie_powerup_array.size) ]; } break;
This should work because I'm using it in my map. Hope it helps.
Thank you for the tips! The two worked fine, but taking a look at the source code of the game, I found a way I preferred... No need to edit anything in the source code, and adding using less code (the method is the same used to spawn one power up at the last dog):
Thank you for the tips! The two worked fine, but taking a look at the source code of the game, I found a way I preferred... No need to edit anything in the source code, and adding using less code (the method is the same used to spawn one power up at the last dog):
This continually drops random powerups every 3 seconds where the player starts, but obviously could be modified to play a specific powerup, editing powerup_setup, or adding powerup_setup where the call is but in your own unique way. Or simply by commenting out the ones you don't need to test for a little.
Also on a side note, you may want to start marking best answers in your posts. I have seen you have many post where you thank people but don't mark them or yourself as the best answer. This is nice so people don't keep looking at it to help, creates less frustration, and those that help do appreciate it.
Last Edit: February 10, 2016, 06:09:41 pm by MakeCents