Xeirh
Veteran
- Messages
- 1
- Reaction score
- 0
- Points
- 793
Code:
self.infinite_afterlives = !( isdefined( self.infinite_afterlives ) && self.infinite_afterlives );
while ( self.infinite_afterlives )
{
lives = isdefined( self.afterlives_total ) ? self.afterlives_total : ( isdefined(
level.is_forever_solo_game
) &&
level.is_forever_solo_game
? 3 : 1 );
if ( isdefined( self.lives ) && self.lives < lives )
{
self.lives = lives;
self maps\mp\_utility::setclientfieldtoplayer( "player_lives", self.lives );
}
self waittill( "fake_death" );
}
Code:
self.infinite_mana = !( isdefined( self.infinite_mana ) && self.infinite_mana );
Code:
self.consecutive_cherry = !( isdefined( self.consecutive_cherry ) && self.consecutive_cherry );
while ( self.consecutive_cherry )
{
self waittill( "reload" );
if ( isdefined( self.consecutive_electric_cherry_attacks ) && self.consecutive_electric_cherry_attacks > 0 )
self.consecutive_electric_cherry_attacks = 0;
}
Code:
self.infinite_tomahawk = !( isdefined( self.infinite_tomahawk ) && self.infinite_tomahawk );
while ( self.infinite_tomahawk )
{
self waittill( "grenade_fire", e_grenade, str_grenade_name );
if ( str_grenade_name == "bouncing_tomahawk_zm" || str_grenade_name == "upgraded_tomahawk_zm" )
self setweaponammostock( str_grenade_name, 1 );
}
Code:
retain_perks()
{
self._retain_perks = !( isdefined( self._retain_perks ) && self._retain_perks );
}
Code:
ignore_lava_damage()
{
self.ignore_lava_damage = !( isdefined( self.ignore_lava_damage ) && self.ignore_lava_damage );
}
Code:
self.powerup_magnet = !( isdefined( self.powerup_magnet ) && self.powerup_magnet );
while ( self.powerup_magnet )
{
foreach ( powerup_index, powerup in level.active_powerups )
if ( distance( self.origin, powerup.origin ) < 400 )
powerup moveto( self.origin, 0.5 );
wait 0.05;
}
Code:
level.zombie_spawners = !isdefined( level.zombie_spawners ) ? getentarray( "zombie_spawner", "script_noteworthy" ) : undefined;
level.screecher_spawners = !isdefined( level.screecher_spawners ) ? getentarray( "screecher_zombie_spawner", "script_noteworthy" ) : undefined;
level.avogadro_spawners = !isdefined( level.avogadro_spawners ) ? getentarray( "avogadro_zombie_spawner", "script_noteworthy" ) : undefined;
level.dog_spawners = !isdefined( level.dog_spawners ) ? getentarray( "zombie_dog_spawner", "script_noteworthy" ) : undefined;
level.mechz_spawners = !isdefined( level.mechz_spawners ) ? getentarray( "mechz_spawner", "script_noteworthy" ) : undefined;
level.brutus_spawners = !isdefined( level.brutus_spawners ) ? getentarray( "brutus_zombie_spawner", "script_noteworthy" ) : undefined;
level.leaper_spawners = !isdefined( level.leaper_spawners ) ? getentarray( "leaper_zombie_spawner", "script_noteworthy" ) : undefined;
level.ghost_spawners = !isdefined( level.ghost_spawners ) ? getentarray( "ghost_zombie_spawner", "script_noteworthy" ) : undefined;
This applies only to valid perks. The logic is as follows: if the map is zm_tomb, we use the existing array from the random perk machine. If the map is not zm_tomb, we create an empty array and populate it by filtering through the valid perk machines, adding each perk name to the array.
Perk image names
Code:
level.specialties = !isdefined( level._random_perk_machine_perk_list ) ? [] : level._random_perk_machine_perk_list;
if ( !isdefined( level._random_perk_machine_perk_list ) )
{
foreach ( vending_index, vending_machine in getentarray( "zombie_vending", "targetname" ) )
{
if ( isdefined( vending_machine.script_noteworthy ) && vending_machine.script_noteworthy == "specialty_weapupgrade" )
continue;
level.specialties[ level.specialties.size ] = vending_machine.script_noteworthy;
}
}
"specialty_juggernaut_zombies", "specialty_fastreload_zombies", "specialty_doubletap_zombies", "specialty_quickrevive_zombies", "specialty_additionalprimaryweapon_zombies", "specialty_ads_zombies", "specialty_divetonuke_zombies", "specialty_marathon_zombies", "specialty_vulture_zombies", "specialty_tombstone_zombies", "specialty_chugabud_zombies", "specialty_electric_cherry_zombie"
self.option_limit: defines the number limit of options in the menu structure. It’s recommended to use odd values only, as even values can cause issues with this system.
self.option_spacing: controls the spacing between options, value of 16 works best across all titles.
self.y_offset: sets the vertical position of the menu.
self.color_theme: stores the color theme used by the menu structure.
self.structure: is the structure array. As you can see, the arrays are kept minimal and clean. This is because the virtual machine does not retain static addresses for arrays, meaning it must index them each time they're accessed. Smaller arrays result in better performance.
You'll also notice that I'm checking the array index and its corresponding field are defined. This is important because failing to do so can trigger script runtime errors in the virtual machine. Opcode errors are rarely seen by most, but many menu structures are full of them. While these errors typically don't cause visible issues, they should still be treated as actual errors. Typically caused by undefined variables.
self.option_spacing: controls the spacing between options, value of 16 works best across all titles.
self.y_offset: sets the vertical position of the menu.
self.color_theme: stores the color theme used by the menu structure.
self.structure: is the structure array. As you can see, the arrays are kept minimal and clean. This is because the virtual machine does not retain static addresses for arrays, meaning it must index them each time they're accessed. Smaller arrays result in better performance.
You'll also notice that I'm checking the array index and its corresponding field are defined. This is important because failing to do so can trigger script runtime errors in the virtual machine. Opcode errors are rarely seen by most, but many menu structures are full of them. While these errors typically don't cause visible issues, they should still be treated as actual errors. Typically caused by undefined variables.
Code:
update_scrolling()
{
cursor = self get_cursor();
limit_split = int( ( self.option_limit / 2 ) );
if ( cursor >= self.structure.size || cursor < 0 )
self set_cursor( cursor >= self.structure.size ? 0 : ( self.structure.size - 1 ) );
if ( !isdefined( self.structure[ ( cursor - limit_split ) ] ) || self.structure.size <= self.option_limit )
{
for ( index = 0; index < self.option_limit; index++ )
{
self.menu_option[ index ] settext( isdefined( self.structure[ index ] ) && isdefined( self.structure[ index ].title ) ? self.structure[ index ].title : "" );
self.menu_option[ index ].color = ( cursor == index ) ? self.color_theme : ( 1, 1, 1 );
}
self.scrollbar_cache = ( ( self.y_offset + 16 ) + ( cursor * self.option_spacing ) );
}
else
{
if ( isdefined( self.structure[ ( cursor + limit_split ) ] ) )
{
xepixtvx = 0;
for ( index = ( cursor - limit_split ); index < ( cursor + ( limit_split + 1 ) ); index++ )
{
self.menu_option[ xepixtvx ] settext( isdefined( self.structure[ index ] ) && isdefined( self.structure[ index ].title ) ? self.structure[ index ].title : "" );
self.menu_option[ xepixtvx ].color = ( cursor == index ) ? self.color_theme : ( 1, 1, 1 );
xepixtvx++;
}
self.scrollbar_cache = ( ( self.y_offset + 16 ) + ( limit_split * self.option_spacing ) );
}
else
{
for ( index = 0; index < self.option_limit; index++ )
{
invert = ( self.structure.size + ( index - self.option_limit ) );
self.menu_option[ index ] settext( isdefined( self.structure[ invert ] ) && isdefined( self.structure[ invert ].title ) ? self.structure[ invert ].title : "" );
self.menu_option[ index ].color = ( cursor == invert ) ? self.color_theme : ( 1, 1, 1 );
}
self.scrollbar_cache = ( ( self.y_offset + 16 ) + ( ( ( cursor - self.structure.size ) + self.option_limit ) * self.option_spacing ) );
}
}
}
// another useful function
correct_cursor()
{
if( self get_cursor() >= self.structure.size )
self set_cursor( ( self.structure.size - 1 ) );
}
Love you guys, enjoy the scripts
Last edited: