Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include "b5-common";
- function LevelEnd()
- {
- GotoLevel( 8 );
- }
- global enemy1trigger = event();
- function p0btn_Activate()
- {
- level.FindEntity( "p0l0" ).enabled = false;
- level.FindEntity( "p0l1" ).enabled = false;
- level.FindEntity( "p0light" ).enabled = false;
- this.Stop();
- enemy1trigger.signaled = true;
- }
- function p1btn_Activate()
- {
- level.FindEntity( "p1l0" ).enabled = false;
- level.FindEntity( "p1l1" ).enabled = false;
- level.FindEntity( "p1light" ).enabled = false;
- this.Stop();
- }
- function p2enemies()
- {
- E1 = level.FindEntity( "enemy2a" ).ctrl;
- E2 = level.FindEntity( "enemy2b" ).ctrl;
- if( !( action = ActorAction.start( 1, E1, E2 ) ) )
- return;
- E1.set_speaker_info( "p2btn", "A" );
- E2.set_speaker_info( "p2btn", "B" );
- subtime = 14;
- action.wait( 1 );
- E1.play_anim( "standing_idle", true );
- E1.look_at( E2.entity.position );
- E1.speak( "Hey, what happened with the lasers?", subtime );
- action.wait( 2 );
- E2.play_anim( "standing_idle", true );
- E2.look_at( E1.entity.position );
- action.wait( 3 );
- E2.speak( "I've no idea!", subtime );
- action.wait( 2 );
- E1.speak( "Let's go check!", subtime );
- action.wait( 2 );
- E1.stop_anim();
- E2.stop_anim();
- SPEECHSYS.ClearSpeechFor( E1.entity );
- SPEECHSYS.ClearSpeechFor( E2.entity );
- E1.i_speed = 0.4;
- a = subthread E1.run_to_target( level.positions.e2a_pos2 );
- b = subthread E2.run_to_target( level.positions.e2b_pos2 );
- sync( a, b );
- a = subthread E1.look_at( level.positions.e2_look2 );
- b = subthread E2.look_at( level.positions.e2_look2 );
- sync( a, b );
- action.wait( 9999999999999 );
- action.end();
- }
- function p2btn_Activate()
- {
- level.FindEntity( "p2l0" ).enabled = false;
- level.FindEntity( "p2l1" ).enabled = false;
- level.FindEntity( "p2light" ).enabled = false;
- this.Stop();
- thread p2enemies();
- }
- function Enemy0_Behavior(E)
- {
- for(;;)
- {
- E.i_speed = 0.4;
- E.patrol
- ([
- { action = "moveauto", pos = level.positions.enemy0stand },
- { action = "lookat", pos = level.positions.enemy0look },
- { action = "wait", time = 3 },
- ]);
- E.fighter_behavior_1();
- }
- }
- function Enemy1_Behavior(E)
- {
- sync( enemy1trigger );
- for(;;)
- {
- E.i_speed = 0.4;
- E.patrol
- ([
- { action = "moveauto", pos = level.positions.e1pp1 },
- { action = "lookat", pos = level.positions.enemy0stand },
- { action = "wait", time = 3 },
- { action = "moveauto", pos = level.positions.e1pp0 },
- { action = "wait", time = 3 },
- ]);
- E.fighter_behavior_1();
- }
- }
- function Enemy2_Behavior(E)
- {
- for(;;)
- {
- E.i_speed = 0.4;
- E.patrol
- ([
- { action = "lookat", pos = level.positions.e2look },
- { action = "wait", time = 3 },
- ]);
- E.fighter_behavior_1();
- }
- }
- function Enemy3_Behavior(E)
- {
- for(;;)
- {
- E.i_speed = 0.4;
- E.patrol
- ([
- { action = "moveauto", pos = level.positions.e3pp0 },
- { action = "wait", time = 2 },
- { action = "lookat", pos = level.positions.e3pp0look },
- { action = "wait", time = 3 },
- { action = "moveauto", pos = level.positions.e3pp1 },
- { action = "wait", time = 3 },
- ]);
- E.fighter_behavior_1();
- }
- }
- function Enemy4_Behavior(E)
- {
- for(;;)
- {
- E.i_speed = 0.4;
- E.patrol
- ([
- { action = "moveauto", pos = level.positions.e4stand },
- { action = "lookat", pos = level.positions.e4look },
- { action = "wait", time = 3 },
- ]);
- E.fighter_behavior_1();
- }
- }
- function onLevelStart()
- {
- SetOverlayMusic( "/music2" );
- level.CreateEntity( "TPSPlayer" ).
- {
- position = level.positions.player_start,
- viewDir = vec3(1,0,0),
- };
- MarkExit( "trig_end", LevelEnd );
- level.FindEntity( "p0btn" ).OnActivate = p0btn_Activate;
- level.FindEntity( "p1btn" ).OnActivate = p1btn_Activate;
- level.FindEntity( "p2btn" ).OnActivate = p2btn_Activate;
- level.FindEntity( "enemy0" ).func = Enemy0_Behavior;
- level.FindEntity( "enemy1" ).func = Enemy1_Behavior;
- level.FindEntity( "enemy2a" ).func = Enemy2_Behavior;
- level.FindEntity( "enemy2b" ).func = Enemy2_Behavior;
- level.FindEntity( "enemy3" ).func = Enemy3_Behavior;
- level.FindEntity( "enemy4" ).func = Enemy4_Behavior;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement