OSP Code QoL Mouse-controlled, after-death, free-roaming camera

Users who are viewing this thread

Mad Vader

Duhpressed
Duke
Here's the code for a WASD+mouse-controlled free-roaming camera. (I know you want it!)
I couldn't find any camera code I liked, so I wrote one for POP3 for Warband. The cameras I found either had clumsy extra keys for control, a limited camera, or didn't work for Warband.

It was based on kt0's simple after-death camera, but is much expanded:
http://forums.taleworlds.com/index.php/topic,63178.msg1641483.html#msg1641483

At the top of mission templates, add these declarations:
Code:
## MadVader deathcam begin
common_init_deathcam = (
   0, 0, ti_once,
   [],
   [
      (assign, "$pop_camera_on", 0),
      # mouse center coordinates (non-windowed)
      (assign, "$pop_camera_mouse_center_x", 500),
      (assign, "$pop_camera_mouse_center_y", 375),
      # last recorded mouse coordinates
      (assign, "$pop_camera_mouse_x", "$pop_camera_mouse_center_x"),
      (assign, "$pop_camera_mouse_y", "$pop_camera_mouse_center_y"),
      # counts how many cycles the mouse stays in the same position, to determine new center in windowed mode
      (assign, "$pop_camera_mouse_counter", 0),
   ]
)

common_start_deathcam = (
   0, 4, ti_once, # 4 seconds delay before the camera activates
   [
     (main_hero_fallen),
     (eq, "$pop_camera_on", 0),
   ],
   [
      (get_player_agent_no, ":player_agent"),
      (agent_get_position, pos1, ":player_agent"),
      (position_get_x, ":pos_x", pos1),
      (position_get_y, ":pos_y", pos1),
      (init_position, pos47),
      (position_set_x, pos47, ":pos_x"),
      (position_set_y, pos47, ":pos_y"),
      (position_set_z_to_ground_level, pos47),
      (position_move_z, pos47, 250),
      (mission_cam_set_mode, 1, 0, 0),
      (mission_cam_set_position, pos47),
      (assign, "$pop_camera_rotx", 0),
      (assign, "$pop_camera_on", 1),
   ]
)

common_move_deathcam = (
   0, 0, 0,
   [
      (eq, "$pop_camera_on", 1),
      (this_or_next|game_key_clicked, gk_move_forward),
      (this_or_next|game_key_is_down, gk_move_forward),
      (this_or_next|game_key_clicked, gk_move_backward),
      (this_or_next|game_key_is_down, gk_move_backward),
      (this_or_next|game_key_clicked, gk_move_left),
      (this_or_next|game_key_is_down, gk_move_left),
      (this_or_next|game_key_clicked, gk_move_right),
      (game_key_is_down, gk_move_right),
   ],
   [
      (mission_cam_get_position, pos47),
      (assign, ":move_x", 0),
      (assign, ":move_y", 0),
      (try_begin), #forward
        (this_or_next|game_key_clicked, gk_move_forward),
        (game_key_is_down, gk_move_forward),
        (assign, ":move_y", 10),
      (try_end),
      (try_begin), #backward
        (this_or_next|game_key_clicked, gk_move_backward),
        (game_key_is_down, gk_move_backward),
        (assign, ":move_y", -10),
      (try_end),
      (try_begin), #left
        (this_or_next|game_key_clicked, gk_move_left),
        (game_key_is_down, gk_move_left),
        (assign, ":move_x", -10),
      (try_end),
      (try_begin), #right
        (this_or_next|game_key_clicked, gk_move_right),
        (game_key_is_down, gk_move_right),
        (assign, ":move_x", 10),
      (try_end),
      (position_move_x, pos47, ":move_x"),
      (position_move_y, pos47, ":move_y"),
      (mission_cam_set_position, pos47),      
   ]
)

deathcam_mouse_deadzone = 2 #set this to a positive number (MV: 2 or 3 works well for me, but needs testing on other people's PCs)

common_rotate_deathcam = (
   0, 0, 0,
   [
      (eq, "$pop_camera_on", 1),
      (neg|is_presentation_active, "prsnt_battle"),
      (mouse_get_position, pos1),
      (set_fixed_point_multiplier, 1000),
      (position_get_x, reg1, pos1),
      (position_get_y, reg2, pos1),
      (this_or_next|neq, reg1, "$pop_camera_mouse_center_x"),
      (neq, reg2, "$pop_camera_mouse_center_y"),
   ],
   [
      # fix for windowed mode: recenter the mouse
      (assign, ":continue", 1),
      (try_begin),
        (eq, reg1, "$pop_camera_mouse_x"),
        (eq, reg2, "$pop_camera_mouse_y"),
        (val_add, "$pop_camera_mouse_counter", 1),
        (try_begin), #hackery: if the mouse hasn't moved for X cycles, recenter it
          (gt, "$pop_camera_mouse_counter", 50),
          (assign, "$pop_camera_mouse_center_x", reg1),
          (assign, "$pop_camera_mouse_center_y", reg2),
          (assign, "$pop_camera_mouse_counter", 0),
        (try_end),
        (assign, ":continue", 0),
      (try_end),
      (eq, ":continue", 1), #continue only if mouse has moved
      (assign, "$pop_camera_mouse_counter", 0), # reset recentering hackery
      
      # update recorded mouse position
      (assign, "$pop_camera_mouse_x", reg1),
      (assign, "$pop_camera_mouse_y", reg2),
      
      (mission_cam_get_position, pos47),
      (store_sub, ":shift", "$pop_camera_mouse_center_x", reg1), #horizontal shift for pass 0
      (store_sub, ":shift_vertical", reg2, "$pop_camera_mouse_center_y"), #for pass 1
      
      (try_for_range, ":pass", 0, 2), #pass 0: check mouse x movement (left/right), pass 1: check mouse y movement (up/down)
        (try_begin),
          (eq, ":pass", 1),
          (assign, ":shift", ":shift_vertical"), #get ready for the second pass
        (try_end),
        (this_or_next|lt, ":shift", -deathcam_mouse_deadzone), #skip pass if not needed (mouse deadzone)
        (gt, ":shift", deathcam_mouse_deadzone),
        
        (assign, ":sign", 1),
        (try_begin),
          (lt, ":shift", 0),
          (assign, ":sign", -1),
        (try_end),
        # square root calc
        (val_abs, ":shift"),
        (val_sub, ":shift", deathcam_mouse_deadzone), # ":shift" is now 1 or greater
        (convert_to_fixed_point, ":shift"),
        (store_sqrt, ":shift", ":shift"),
        (convert_from_fixed_point, ":shift"),
        (val_clamp, ":shift", 1, 6), #limit rotation speed
        (val_mul, ":shift", ":sign"),
        (try_begin),
          (eq, ":pass", 0), # rotate around z (left/right)
          (store_mul, ":minusrotx", "$pop_camera_rotx", -1),
          (position_rotate_x, pos47, ":minusrotx"), #needed so camera yaw won't change
          (position_rotate_z, pos47, ":shift"),
          (position_rotate_x, pos47, "$pop_camera_rotx"), #needed so camera yaw won't change
        (try_end),
        (try_begin),
          (eq, ":pass", 1), # rotate around x (up/down)
          (position_rotate_x, pos47, ":shift"),
          (val_add, "$pop_camera_rotx", ":shift"),
        (try_end),
      (try_end), #try_for_range ":pass"
      (mission_cam_set_position, pos47),
   ]
)
## MadVader deathcam end
In each mission you want to have the camera, add the triggers:
Code:
## MadVader deathcam begin
      common_init_deathcam,
      common_start_deathcam,
      common_move_deathcam,
      common_rotate_deathcam,
## MadVader deathcam end

You also need to disable Warband ending the battle after death, but you can do this yourself (or read kt0's post).

If you use the code, some credit would be nice.

EDIT: added "(neg|is_presentation_active, "prsnt_battle")," in the rotate triggers conditions, so the camera would not rotate wildly when you press Backspace.

EDIT2: lowered the number of triggers (from 8 to 4) and increased mouse sensitivity

FINAL EDIT: fixed spinning in windowed mode
 
Awesome, thanks for this.  One question: does it free-roam in all 3 dimensions or is it bound to the ground?  I'll be using it either way, just curious  :smile:
 
Nice!  That's definitely an improvement over what I've got in Blood and Steel.  I'll use that for sure.  Suggestion: use E and Q for (absolute) up/down.

Oh, and:
Code:
common_vader_deathcam = [common_init_deathcam,common_start_deathcam,common_move_forward_deathcam,common_move_backward_deathcam,common_move_left_deathcam,common_move_right_deathcam,common_rotate_leftright_deathcam,common_rotate_updown_deathcam,]
 
xenoargh said:
Oh, and:
Code:
common_vader_deathcam = [common_init_deathcam,common_start_deathcam,common_move_forward_deathcam,common_move_backward_deathcam,common_move_left_deathcam,common_move_right_deathcam,common_rotate_leftright_deathcam,common_rotate_updown_deathcam,]
My thoughts precisely.... :grin:
 
pampl said:
Awesome, thanks for this.  One question: does it free-roam in all 3 dimensions or is it bound to the ground?  I'll be using it either way, just curious  :smile:

Yes, it goes everywhere (ergo, free-roaming).

@xenoargh: thanks for the tip!
 
I'll work on an auto-end script to plug into this, to end the missions if either side is out of troops, and something to keep the deathcam from going below the ground, as I get it integrated.  Looks good thus far :smile:
 
OK, tried it out.

Bad news:  upon death, the camera spun upwards constantly.  It was clear that everything else is working.

Looking at the script, it's got to be the sign.

<tests stuff>

After some testing, I've determined what's wrong.

Mouse position is constantly being reported as 50,40.

More testing.  Added fixed_point_multiplier to see finer detail.  Mouse position is constantly being reset to 497/402 over a short number of frames.  I think this is related to the mission_cam mode being set to 1.

My guess?  Mouse position is dependent on screen resolution.  Mouse position is constantly being reset.  Perhaps there's a way to allow the mouse free again.

AHA!!!

The reason why mouse position isn't being read correctly... is because the only time it registers a mouse position correctly is when a Presentation is on.  MadVader must have always had the cheater-radar on :wink:

That means this can be fixed, yay :smile:
 
In my tests, the mouse position is always reported as 500,375 (center of the screen) if you don't move the mouse. If you move it, it will change for a moment, then return to the center.

I didn't have any active presentations while testing - I don't think it will work with the battle presentation on, you may need to switch the camera on/off (e.g. put an extra condition in the rotate triggers like "(neg|is_presentation_active, "prsnt_battle"),").

The center coordinates above are for (set_fixed_point_multiplier, 1000). AFAIK, the coordinates are independent of resolution, but screen aspect ratio may change them (probably 500,400 in your case for the center) - I don't know if this is true, so any tests are appreciated.

You can change the code to capture the correct center coordinates in the start trigger or calculate them somehow, if they are the cause (and not the presentation).

EDIT: heavily edited
 
OK... here is a more-or-less complete rewrite, that fixes a lot of little issues:

1.  Triggers reduced to a minimal number.
2.  Dummy presentation included, so that cues from the mouse work properly, for those of us who don't trigger a Presentation during normal operations.
3.  End-sequence that counts the living Agents and automatically ends the Mission when one side or the other is all dead.
4.  Prevents the code from allowing underground movement.

The only fix I didn't include, because I'm lazy, is doing some matrix math to determine whether the camera's vector has resulted in the camera flipping over or has twisted sideways.  It's probably possible to do that, but it's very difficult without being able to get the matrix values.
module_mission_templates:
Code:
common_init_deathcam = (
   0, 0, ti_once,
   [],
   [
      (assign, "$pop_camera_on", 0),
   ]
)

common_start_deathcam = (
   0, 4, ti_once, # 4 seconds delay before the camera activates
   [
     (main_hero_fallen),
     (eq, "$pop_camera_on", 0),
   ],
   [
		(team_give_order, 0, grc_everyone, mordr_charge),
		(team_give_order, 1, grc_everyone, mordr_charge),
		(team_give_order, 2, grc_everyone, mordr_charge),
		(team_give_order, 3, grc_everyone, mordr_charge),
		(assign, "$g_force_finish",0),#Make sure that force_finish won't trip.		
		(get_player_agent_no, ":player_agent"),
		(agent_get_position, pos1, ":player_agent"),
		(position_get_x, ":pos_x", pos1),
		(position_get_y, ":pos_y", pos1),
		(init_position, pos47),
		(position_set_x, pos47, ":pos_x"),
		(position_set_y, pos47, ":pos_y"),
		(position_set_z_to_ground_level, pos47),
		(position_move_z, pos47, 250),
		(mission_cam_set_mode, 1, 0, 0),
		(mission_cam_set_position, pos47),
		(assign, "$pop_camera_on", 1),    
		(assign, "$pop_camera_rotx", 0),		
		(start_presentation, "prsnt_fake_presentation"),
   ]
)

# Every four seconds, operate.
common_end_deathcam = (
   0, 4, 0, 
   [
     (main_hero_fallen),	 
     (eq, "$pop_camera_on", 1),
   ],
   [
		(try_begin),
			(neg|is_presentation_active, "prsnt_fake_presentation"),   
			(start_presentation, "prsnt_fake_presentation"),	
		(try_end),	
		(call_script, "script_count_living_agents"),
		(try_begin),
			(eq, "$g_force_finish",1),
			(finish_mission,-1),
		(else_try),
			(eq, "$g_force_finish",2),
			(finish_mission,0),
		(try_end),
   ]
)

common_move_deathcam = (
   0, 0, 0,
   [
		(eq, "$pop_camera_on", 1),

 		(mission_cam_get_position, pos47),  
   
		(try_begin),
			(key_is_down, key_w),		
			(position_move_y, pos47, 10),
		(try_end),
		
		(try_begin),
			(key_is_down, key_s),		
			(position_move_y, pos47, -10),
		(try_end),

		(try_begin),
			(key_is_down, key_d),		
			(position_move_x, pos47, 10), 
		(try_end),

		(try_begin),
			(key_is_down, key_a),		
			(position_move_x, pos47, -10),
		(try_end),

		(try_begin),
			(key_is_down, key_e),
			(position_move_z, pos47, 10),
		(try_end),			

		(try_begin),
			(key_is_down, key_q),
			(position_move_z, pos47, -10),
		(try_end),	
		
		(copy_position, pos45, pos47),
		(position_set_z_to_ground_level, 45),
		(position_get_z, ":cur_height", 47),
		(position_get_z, ":ground_height", 45),
		(val_add, ":ground_height", 200),
		(try_begin),#Keep height above the ground at all times.
			(lt, ":cur_height", ":ground_height"),
			(position_set_z, 47, ":ground_height"),
		(try_end),
		
		(mission_cam_set_position, pos47),
   ],
   [  
	
   ]
)

common_rotate_deathcam = (
   0, 0, 0,
   [
		(eq, "$pop_camera_on", 1),
   ],
   [
		(mouse_get_position, pos46),
		(set_fixed_point_multiplier,1000),
		(position_get_x, reg1, pos46),
		(position_get_y, reg2, pos46),		
		#(display_message, "@X,Y = {reg1},{reg2}"),
		(mission_cam_get_position, pos47),		
	#Rotate X... uses scale of 0-750, with 75 padding in the center, due to screen compression
		(try_begin),
			(is_between, reg2, 400, 550),
			(position_rotate_x, pos47, 1),
			(val_add, "$pop_camera_rotx", 1),			
			(mission_cam_set_position, pos47),
		(else_try),
			(gt, reg2, 550),
			(position_rotate_x, pos47, 2),	
			(val_add, "$pop_camera_rotx", 2),		
			(mission_cam_set_position, pos47),		
		(else_try),
			(is_between, reg2, 150, 300),
			(position_rotate_x, pos47, -1),	
			(val_add, "$pop_camera_rotx", -1),				
			(mission_cam_set_position, pos47),			
		(else_try),
			(lt, reg2, 150),
			(position_rotate_x, pos47, -2),	
			(val_add, "$pop_camera_rotx", -2),	
			(mission_cam_set_position, pos47),			
		(try_end),		
		
	#Rotate Z... uses scale of 0-1000, with 50 padding in the center
		(try_begin),
			(is_between, reg1, 550, 700),#150
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),			
			(position_rotate_z, pos47, -1),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),			
			(mission_cam_set_position, pos47),	
		(else_try),	
			(is_between, reg1, 701, 850),#150	
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, -2),
			(position_rotate_x, pos47, "$pop_camera_rotx"),				
			(mission_cam_set_position, pos47),	
		(else_try),
			(gt, reg1, 850),	
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, -3),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),			
			(mission_cam_set_position, pos47),
		(else_try),
			(is_between, reg1, 300, 450),#150
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, 1),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),			
			(mission_cam_set_position, pos47),			
		(else_try),	
			(is_between, reg1, 150, 299),#150	
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, 2),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),				
			(mission_cam_set_position, pos47),	
		(else_try),
			(lt, reg1, 149),		
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, 3),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),				
			(mission_cam_set_position, pos47),
		(try_end),
   ]
)

module_scripts:
Code:
  # script_count_living_agents
  # Used to end operation of deathcam if one side or another is out of troops
  ("count_living_agents",[
			(assign, ":my_team", 0),
			(assign, ":their_team", 0),
			(get_player_agent_no, ":player_agent"),
			(agent_get_team, ":player_team", ":player_agent"),      
               
            (try_for_agents, ":agent_no"),
                (agent_is_human, ":agent_no"),
                (agent_is_alive, ":agent_no"),
				(agent_get_team, ":cur_team", ":agent_no"),
				(try_begin),
					(eq, ":cur_team", ":player_team"),
					(val_add, ":my_team", 1),
				(else_try),
					(val_add, ":their_team", 1),
				(try_end),
            (try_end),

            (try_begin),
				(eq, ":my_team", 0),
				(assign, "$g_force_finish",1),
            (else_try),
                (eq, ":their_team", 0),
				(assign, "$g_force_finish",2),
            (try_end),
   ]),

And yes, I am absolutely sure that if you don't have a Presentation running and you're dead, it doesn't work- the mouse position gets reset to the center very, very fast (maybe 5-10 frames, for a big movement).  If you do run a Presentation, however, it returns useful numbers.
 
I don't think an active presentation is needed, that may need a rethink. I would just prevent the rotate (mouse) trigger(s) from operating when prsnt_battle is active.
I'll have to run this by few testers, though, to see if they have a similar problem with mouse position resetting too fast for the triggers to catch.

The code: you'll need extra pairs of position_rotate_x around your position_rotate_z, if you don't want the camera to change its yaw (see original code). Nice work otherwise.





 
IDK about the presentation thing, except that it absolutely didn't run as written, and that was what I eventually tracked down.  Could be driver-specific engine stuff going on, etc.

OK, here's a yaw-fixed version of the module_mission_templates script:

Code:
common_init_deathcam = (
   0, 0, ti_once,
   [],
   [
      (assign, "$pop_camera_on", 0),
   ]
)

common_start_deathcam = (
   0, 4, ti_once, # 4 seconds delay before the camera activates
   [
     (main_hero_fallen),
     (eq, "$pop_camera_on", 0),
   ],
   [
		(team_give_order, 0, grc_everyone, mordr_charge),
		(team_give_order, 1, grc_everyone, mordr_charge),
		(team_give_order, 2, grc_everyone, mordr_charge),
		(team_give_order, 3, grc_everyone, mordr_charge),
		(assign, "$g_force_finish",0),#Make sure that force_finish won't trip.		
		(get_player_agent_no, ":player_agent"),
		(agent_get_position, pos1, ":player_agent"),
		(position_get_x, ":pos_x", pos1),
		(position_get_y, ":pos_y", pos1),
		(init_position, pos47),
		(position_set_x, pos47, ":pos_x"),
		(position_set_y, pos47, ":pos_y"),
		(position_set_z_to_ground_level, pos47),
		(position_move_z, pos47, 250),
		(mission_cam_set_mode, 1, 0, 0),
		(mission_cam_set_position, pos47),
		(assign, "$pop_camera_on", 1),    
		(assign, "$pop_camera_rotx", 0),		
		(start_presentation, "prsnt_fake_presentation"),
   ]
)

# Every four seconds, operate.
common_end_deathcam = (
   0, 4, 0, 
   [
     (main_hero_fallen),	 
     (eq, "$pop_camera_on", 1),
   ],
   [
		(try_begin),
			(neg|is_presentation_active, "prsnt_fake_presentation"),   
			(start_presentation, "prsnt_fake_presentation"),	
		(try_end),	
		(call_script, "script_count_living_agents"),
		(try_begin),
			(eq, "$g_force_finish",1),
			(finish_mission,-1),
		(else_try),
			(eq, "$g_force_finish",2),
			(finish_mission,0),
		(try_end),
   ]
)

common_move_deathcam = (
   0, 0, 0,
   [
		(eq, "$pop_camera_on", 1),

 		(mission_cam_get_position, pos47),  
   
		(try_begin),
			(key_is_down, key_w),		
			(position_move_y, pos47, 10),
		(try_end),
		
		(try_begin),
			(key_is_down, key_s),		
			(position_move_y, pos47, -10),
		(try_end),

		(try_begin),
			(key_is_down, key_d),		
			(position_move_x, pos47, 10), 
		(try_end),

		(try_begin),
			(key_is_down, key_a),		
			(position_move_x, pos47, -10),
		(try_end),

		(try_begin),
			(key_is_down, key_e),
			(position_move_z, pos47, 10),
		(try_end),			

		(try_begin),
			(key_is_down, key_q),
			(position_move_z, pos47, -10),
		(try_end),	
		
		(copy_position, pos45, pos47),
		(position_set_z_to_ground_level, 45),
		(position_get_z, ":cur_height", 47),
		(position_get_z, ":ground_height", 45),
		(val_add, ":ground_height", 200),
		(try_begin),#Keep height above the ground at all times.
			(lt, ":cur_height", ":ground_height"),
			(position_set_z, 47, ":ground_height"),
		(try_end),
		
		(mission_cam_set_position, pos47),
   ],
   [  
	
   ]
)

common_rotate_deathcam = (
   0, 0, 0,
   [
		(eq, "$pop_camera_on", 1),
   ],
   [
		(mouse_get_position, pos46),
		(set_fixed_point_multiplier,1000),
		(position_get_x, reg1, pos46),
		(position_get_y, reg2, pos46),		
		#(display_message, "@X,Y = {reg1},{reg2}"),
		(mission_cam_get_position, pos47),		
	#Rotate X... uses scale of 0-750, with 75 padding in the center, due to screen compression
		(try_begin),
			(is_between, reg2, 400, 550),
			(position_rotate_x, pos47, 1),
			(val_add, "$pop_camera_rotx", 1),			
			(mission_cam_set_position, pos47),
		(else_try),
			(gt, reg2, 550),
			(position_rotate_x, pos47, 2),	
			(val_add, "$pop_camera_rotx", 2),		
			(mission_cam_set_position, pos47),		
		(else_try),
			(is_between, reg2, 150, 300),
			(position_rotate_x, pos47, -1),	
			(val_add, "$pop_camera_rotx", -1),				
			(mission_cam_set_position, pos47),			
		(else_try),
			(lt, reg2, 150),
			(position_rotate_x, pos47, -2),	
			(val_add, "$pop_camera_rotx", -2),	
			(mission_cam_set_position, pos47),			
		(try_end),		
		
	#Rotate Z... uses scale of 0-1000, with 50 padding in the center
		(try_begin),
			(is_between, reg1, 550, 700),#150
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),			
			(position_rotate_z, pos47, -1),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),			
			(mission_cam_set_position, pos47),	
		(else_try),	
			(is_between, reg1, 701, 850),#150	
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, -2),
			(position_rotate_x, pos47, "$pop_camera_rotx"),				
			(mission_cam_set_position, pos47),	
		(else_try),
			(gt, reg1, 850),	
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, -3),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),			
			(mission_cam_set_position, pos47),
		(else_try),
			(is_between, reg1, 300, 450),#150
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, 1),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),			
			(mission_cam_set_position, pos47),			
		(else_try),	
			(is_between, reg1, 150, 299),#150	
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, 2),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),				
			(mission_cam_set_position, pos47),	
		(else_try),
			(lt, reg1, 149),		
			(store_mul, ":minusrotx","$pop_camera_rotx", -1),
			(position_rotate_x, pos47, ":minusrotx"),				
			(position_rotate_z, pos47, 3),	
			(position_rotate_x, pos47, "$pop_camera_rotx"),				
			(mission_cam_set_position, pos47),
		(try_end),
   ]
)
...and I'll fix the one above.  Thanks for the assist, storing the original value as zero is very slick  :mrgreen:
 
Updated the original code.
I really want to avoid running fake presentations, if the problem with different mouse settings/drivers can be solved by increasing mouse sensitivity in the code (and that's still iffy until more testing is done).
 
Updated the code in the first post, the spinning problem for some players is now fixed.

Thanks to LittleMikey who found out the spinning problem (also xenoargh's complaint) occured only in windowed mode. The mouse idle position changes in windowed mode, so the mouse needs to be recentered, which is now handled in the code.
 
This is really useful to make screens :wink:
I everytime wanted to make the normal player-camera more away from the player. It seems like you know about such things. Maybe you could help me with these thing?
 
MadVader said:
I couldn't find any camera code I liked, so I wrote one for POP3 for Warband.

This presumably isn't the death-cam code used in PoP 3.01 for the original M&B though, is it? As the death-cam in PoP 3.01 (for M&B) works perfectly but the mouse part of this code doesn't work properly in WB, I can barely rotate the cam with mouse, it's very slow and choppy. For some reason, as also mentioned in above posts, the game keeps re-centering the mouse in every frame. Obviously if you have a powerful machine the number of frames you see increases and you get a smoother rotation but still nowhere near as smooth as the one in PoP 3. Also tried xenoargh's version and many other variations, none worked properly. Any idea on how this was implemented in PoP 3.01 for M&B?
 
Lord Kinlar said:
MadVader said:
I couldn't find any camera code I liked, so I wrote one for POP3 for Warband.

This presumably isn't the death-cam code used in PoP 3.01 for the original M&B though, is it? As the death-cam in PoP 3.01 (for M&B) works perfectly but the mouse part of this code doesn't work properly in WB, I can barely rotate the cam with mouse, it's very slow and choppy. For some reason, as also mentioned in above posts, the game keeps re-centering the mouse in every frame. Obviously if you have a powerful machine the number of frames you see increases and you get a smoother rotation but still nowhere near as smooth as the one in PoP 3. Also tried xenoargh's version and many other variations, none worked properly. Any idea on how this was implemented in PoP 3.01 for M&B?

This was developed for Warband only. The POP MB version uses entirely different code (see first post and follow kt0's link) - that code can't be used in WB, as WB doesn't allow moving the dead player.

The mouse part works ok for most people (note that this camera is used in POP 3+, Blood and Steel, Brytenwalda etc.), so it might be your mouse driver. Try changing your mouse settings, especially if it's something advanced or exotic.
 
Back
Top Bottom