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

buyable ending

broken avatar :(
Created 11 years ago
by Stuffed_Oatmeal
0 Members and 1 Guest are viewing this topic.
3,352 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 May 2013
Last active: 8 years ago
Posts
126
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
Stuffed_Oatmeal's Contact & Social LinksStuffedOatmeal
does anyone know the scripts for a buyable ending or have them saved somewhere i just want a normal buyable ending, no less,no more

thanks
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
place this in mapname.gsc at the bottom under everything:
Spoiler: click to open...
Code Snippet
Plaintext
end_game()
{
    user = undefined;
    cost = 35000;                                        //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 withoutpower

    flag_wait( "electricity_on" );                                //remove line if you want it to work without power

    self setHintString("Press &&1 To Win 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 );
        }
    }
}
Then in the same file above the line:
Code Snippet
Plaintext
maps\_zombiemode::main();
Add:
Code Snippet
Plaintext
level.tom_victory = false;
end_trig = getentarray( "end_game","targetname" );
array_thread( end_trig,::end_game );
Then if you haven't already move _zombiemode.gsc from raw/maps to mods/*YOURMOD*/maps.
Open it and find the function "end_game"(if you don't know what that would look like view the code below that you will be pasting). Replace the entire function with this:
Spoiler: click to open...
Code Snippet
Plaintext
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( "You Won 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 );
}

Open radiant and make a new trigger_use. Place it where you want the ending to be bought from. With the trigger selected open the entity window by pressing "N". Type the kvp of:
Code Snippet
Plaintext
Key: "targetname" Value: "end_game"

Save, build mod and compile and you should have a working buyable ending!
broken avatar :(
×
broken avatar :(
Location: usMissouri
Date Registered: 6 August 2013
Last active: 5 months ago
Posts
513
Respect
Forum Rank
Zombie Enslaver
Primary Group
Member
My Contact & Social Links
More
Signature
Projects:
Unnamed Project: 5%
Mutliple Downloadable Items for Mappers: (Released after map releases)
×
GerardS0406's Groups
GerardS0406's Contact & Social LinksGerardS0406Gerard0406GerardS0406MrGerard0406
Thanks for the tutorial Saje!

 
Loading ...