Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global MSGTIME = 5.0;
- global MONEY_TARGET = 500.0;
- global MONEY_TARGET_STR = "50 000";
- function GET_TOTAL_MONEY()
- {
- return string_format( "{1:f.2}", 950000 + money_total );
- }
- function onLevelStart()
- {
- global money_total = 0.0;
- global donations = [];
- global cur_donation = 0;
- global goal_reached = false;
- global mission_failed = false;
- global hackcount = 0;
- for( i = 0; i < 5; ++i )
- donations.push( ( i + 1 ) * 3.4 * 1000 );
- donations.shuffle();
- ObjectiveAdd( "Discover a computer", OS_Open );
- ObjectiveAdd( "Steal $" $ MONEY_TARGET_STR, OS_Open );
- ObjectiveAdd( "Get out", OS_Hidden );
- EntitySetProperties( "walker1", "patrol_path",
- [
- { type = "move", target = GetNamedPosition("center") },
- { type = "wait", time = 1.0 },
- { type = "move", target = GetNamedPosition("ew_elev") },
- { type = "move", target = GetNamedPosition("ew_desk1") },
- { type = "look", target = GetNamedPosition("ew_desk1in") },
- { type = "wait", time = 2.0 },
- { type = "move", target = GetNamedPosition("ew_cnr1") },
- { type = "move", target = GetNamedPosition("ew_elev") }, // TODO
- ]);
- EntitySetProperties( "walker_fw", "patrol_path",
- [
- { type = "move", target = GetNamedPosition("farwall") },
- { type = "wait", time = 1.0 },
- { type = "move", target = GetNamedPosition("ww_cnr1") },
- { type = "move", target = GetNamedPosition("ww_desk1") },
- { type = "look", target = GetNamedPosition("ww_desk1in") },
- { type = "wait", time = 2.0 },
- { type = "move", target = GetNamedPosition("ww_wall") },
- { type = "wait", time = 1.0 },
- { type = "move", target = GetNamedPosition("ww_desk1") },
- { type = "look", target = GetNamedPosition("ww_desk1in") },
- { type = "wait", time = 1.0 },
- { type = "move", target = GetNamedPosition("ww_cnr1") },
- ]);
- SetMusic( "/intro_music" );
- SetCutsceneFunc(function(t)
- {
- if( t < 5 ) SetCameraPosDir( vec3(5-t*2,-5,1), vec3(0,1,0) );
- else if( t < 15 )
- {
- a = t*0.5;
- s = sin(a);
- c = cos(a);
- SetCameraPosDir( vec3(c*5,s*5,2.5), -vec3(c,s,0.5) );
- }
- else if( t < 30 )
- {
- b = pow( t - 15, 0.5 ) * 2;
- SetCameraPosDir( vec3(-3.5-b*0.2,-5+b*0.5,0.5+b*0.2), vec3(-0.1-b*0.04,1,0.4-b*0.15) );
- }
- if( t < 1 ) SetCutsceneSubtitle( "" );
- else if( t < 3 ) SetCutsceneSubtitle( "His name is Jack" );
- else if( t < 5 ) SetCutsceneSubtitle( "and he wants to buy a yacht." );
- else if( t < 7 ) SetCutsceneSubtitle( "He needs $ 1 000 000 to do that" );
- else if( t < 9 ) SetCutsceneSubtitle( "so he steals money from charities." );
- else if( t < 11 ) SetCutsceneSubtitle( "He is a monster..." );
- else if( t < 13 ) SetCutsceneSubtitle( "...and, for the moment, you are him." );
- else if( t < 15 ) SetCutsceneSubtitle( "" );
- else if( t < 17 ) SetCutsceneSubtitle( "Hack computers to get the remaining $ 50 000" );
- else if( t < 19 ) SetCutsceneSubtitle( "but don't do it while somebody's watching!" );
- else SetCutsceneSubtitle( "" );
- if( t > 20 )
- {
- SetMusic( "/game_music" );
- return true;
- }
- }, 0);
- SetShowMoney( true, 950000 + money_total );
- SetShowSuspicion( true );
- }
- function HackState( add )
- {
- global hackcount;
- hackcount += add;
- SetMusicVar( "stealing", hackcount > 0 );
- }
- function OnMissionFailed( pos )
- {
- global mission_failed;
- if( mission_failed )
- return;
- mission_failed = true;
- EndGame( "Failed!", false );
- }
- function OnMoneyStolen()
- {
- global money_total, donations, cur_donation;
- stolen_money = donations[ cur_donation++ % donations.size ] + rand() % 500;
- money_total += stolen_money;
- println( "Stolen: ", stolen_money, ", total now: ", money_total );
- SendMessage( MT_Info, "Stolen: " $ stolen_money $ ", total now: " $ GET_TOTAL_MONEY() );
- SendMessage( MT_Warning, "Hacking done, hide your tracks!", MSGTIME );
- SetShowMoney( true, 950000 + money_total );
- }
- function OnHackingStarted( cold )
- {
- HackState( 1 );
- if( cold )
- {
- SendMessage( MT_Warning, "Hacking started! Watch out for employees!", MSGTIME );
- }
- }
- function OnHackingStopped( done )
- {
- if( done )
- {
- if( money_total >= MONEY_TARGET && goal_reached == false )
- {
- global goal_reached = true;
- SendMessage( MT_Info, "Successfully stolen $" $ MONEY_TARGET_STR $ ". Time to get out.", MSGTIME );
- ObjectiveSetState( 1, OS_Done );
- // ObjectiveSetState( 2, OS_Open );
- SetCutsceneFunc(function(t)
- {
- b = pow( t * 0.2, 0.5 ) * 5;
- if( b > 6 )
- b = 6;
- SetCameraPosDir( vec3(-2.5+b,-5,2.5), vec3(1,-0.4+b*0.15,-0.4) );
- });
- EndGame( "Success!", true );
- return;
- }
- else
- {
- SendMessage( MT_Info, "Well done! Now look for another PC to hack...", MSGTIME );
- SendMessage( MT_Continued, "...or wait for the next donation!", MSGTIME );
- }
- }
- HackState( -1 );
- }
- function OnDiscoveredComputer()
- {
- SendMessage( MT_Info, "Computer discovered", MSGTIME );
- ObjectiveSetState( 0, OS_Done );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement