8. Buyable ending (kaufbares Ende)
Das ist für Modtools 1.4
Radiant Part
1. Mach einen Trigger Use in Deine Map mit den KVP's:
Scripts
2. Öffne Deine nazi_zombie_mapname.gsc ( in raw/maps ) und füge in die main() function vor "maps\_zombiemode::main();"
folgendes ein:
3. Füge ans Ende der selben Datei:
4. Öffne Deine _zombiemode.gsc ( in mods/MAPNAME/maps ) und suche die Function end_game(), und ersetze Sie mit:
ZM Tut - add buyable ending
Das ist alles!
Das ist für Modtools 1.4
Radiant Part
1. Mach einen Trigger Use in Deine Map mit den KVP's:
Code:
"targetname" "end_game"
Scripts
2. Öffne Deine nazi_zombie_mapname.gsc ( in raw/maps ) und füge in die main() function vor "maps\_zombiemode::main();"
folgendes ein:
Code:
level.tom_victory = false;
end_trig = getentarray( "end_game","targetname" );
array_thread( end_trig,::end_game );
3. Füge ans Ende der selben Datei:
Code:
end_game()
{
user = undefined;
cost = 20000; //change to cost that you want
self setCursorHint("HINT_NOICON");
self UseTriggerRequireLookAt();
self setHintString("The power must be activated first"); //remove line if you want it to work without power
flag_wait( "electricity_on" ); //remove line if you want it to work without power
self setHintString("press &&1 to End the Game [Cost: "+cost+"]"); //text hint trigger
while(1)
{
self waittill("trigger", user);
if( is_player_valid(user) && user.score >= cost )
{
play_sound_at_pos( "cha_ching", self.origin );
user thread maps\_zombiemode_score::minus_to_player_score( cost );
self delete();
level notify( "end_game" );
level notify("tom_planes");
level.tom_victory = true;
}
else
{
play_sound_at_pos( "no_cha_ching", self.origin );
}
}
}
4. Öffne Deine _zombiemode.gsc ( in mods/MAPNAME/maps ) und suche die Function end_game(), und ersetze Sie mit:
Code:
end_game()
{
level waittill ( "end_game" );
level.intermission = true;
update_leaderboards();
game_over = NewHudElem( self );
game_over.alignX = "center";
game_over.alignY = "middle";
game_over.horzAlign = "center";
game_over.vertAlign = "middle";
game_over.y -= 10;
game_over.foreground = true;
game_over.fontScale = 3;
game_over.alpha = 0;
game_over.color = ( 1.0, 1.0, 1.0 );
game_over SetText( &"ZOMBIE_GAME_OVER" );
game_over FadeOverTime( 1 );
game_over.alpha = 1;
survived = NewHudElem( self );
survived.alignX = "center";
survived.alignY = "middle";
survived.horzAlign = "center";
survived.vertAlign = "middle";
survived.y += 20;
survived.foreground = true;
survived.fontScale = 2;
survived.alpha = 0;
survived.color = ( 1.0, 1.0, 1.0 );
if( level.round_number < 2 && level.tom_victory == false )
{
survived SetText( &"ZOMBIE_SURVIVED_ROUND" );
}
else if( level.tom_victory == false )
{
survived SetText( &"ZOMBIE_SURVIVED_ROUNDS", level.round_number );
}
if( level.tom_victory == true )
{
survived.color = ( 0.423, 0.004, 0 );
survived SetText( "Well done, You beat the game in ", level.round_number, " rounds!" );
}
//TUEY had to change this since we are adding other musical elements
setmusicstate("end_of_game");
setbusstate("default");
survived FadeOverTime( 1 );
survived.alpha = 1;
wait( 1 );
//play_sound_at_pos( "end_of_game", ( 0, 0, 0 ) );
wait( 2 );
intermission();
wait( level.zombie_vars["zombie_intermission_time"] );
level notify( "stop_intermission" );
array_thread( get_players(), ::player_exit_level );
bbPrint( "zombie_epilogs: rounds %d", level.round_number );
wait( 1.5 );
if( is_coop() )
{
ExitLevel( false );
}
else
{
MissionFailed();
}
// Let's not exit the function
wait( 666 );
}
ZM Tut - add buyable ending
Das ist alles!