OSP Code QoL [WB] Ironsight mode

Users who are viewing this thread

DJK83 said:
Okay, I just tested it with one, but there were a few problems. First, I'm confused when it comes to the part about adding "whatever you use to zoom". How exactly do you do that? Without doing anything in that regard, it stayed zoomed in permanently. So how do I get that to work properly? Second, the model is gonna need to be moved over and re-arranged a bit so that it's lined up properly. Can that be done with the X Y and Z coordinates that are in the code?
That is the key you want to use, EG - Key_x instead of key_whatever_you_use_to_zoom
It does? That's odd
That bit of code is only the viewpoint placement. You can change it to move where the model is on the screen
 
I've got the script to work for NWs how ever when you crouch the view point is still in the same position and the gun is way below? How would i allow it to drop as you crouch?
 
I geuss by checking if the player is in the crouched animation and then adjusting the coordinates of the mission cam accordingly.
 
I am planning to put it on my personal mod for NW. But I just can't understand the second part. In front of which mission do I need to put it for multiplayer?
 
Dasvi2018 said:
I am planning to put it on my personal mod for NW. But I just can't understand the second part. In front of which mission do I need to put it for multiplayer?

What are you finding difficult?

Its very simple, you'd just search for the gamemode you want (eg. multiplayer_dm) and find something along the lines of (Can't remember off the top of my head)
Code:
multiplayer_server_spawn_common,
  and then add below it
Code:
 multiplayer_ironsight_mode,

If you're struggling after that then..

Wolf.
 
Wolfstar said:
Dasvi2018 said:
I am planning to put it on my personal mod for NW. But I just can't understand the second part. In front of which mission do I need to put it for multiplayer?

What are you finding difficult?

Its very simple, you'd just search for the gamemode you want (eg. multiplayer_dm) and find something along the lines of (Can't remember off the top of my head)
Code:
multiplayer_server_spawn_common,
  and then add below it
Code:
 multiplayer_ironsight_mode,

If you're struggling after that then..

Wolf.

Yea but in which file is this line?
 
Nord Champion said:
This is wonderful!!!

Thanks for this, I really appreciate the work you put into this. Also, I figured out a fix for the 3rd person head glitch thing (it may require WSE but I'm not sure)


          (game_key_is_down, gk_zoom),
 
          (set_camera_in_first_person, 1),

          (agent_get_look_position, pos1, ":player_agent"),

That doesnt seem to work for me, error "set_camera_in_first_person is not defined". Anyone can help me with this? Everything works perfectly but 3rd person is bugged because of that camera angle. I need to make it work only for 1st person mode.
 
Aruda said:
error "set_camera_in_first_person is not defined"

what game and which version are using for the engine (.exe) and the modsys ?

Example: Warband 1.172 with modsys 1.153 (don't confuse Native the module with Warband the game engine. If you play Floris mod, that is still using Warband engine)

check your header_operations.py and why the operation is not listed there
 
latest version of Warband with 1.158 modsys.


set_camera_in_first_person  is not in header operations for some reason, tried adding it manually to header ops. didnt work. What should i do?
 
Aruda said:
latest version of Warband with 1.158 modsys.

set_camera_in_first_person  is not in header operations for some reason, tried adding it manually to header ops. didnt work. What should i do?

if you are using Warband 1.170+ (latest), then all you need to do is add it to your header_operations.py. The operation was included for a VC update, that is why it is more recent (newer than version 1.158 you have). It works on any Warband module (if you use the latest .exe).

Code:
is_camera_in_first_person                    = 61    # (is_camera_in_first_person),
set_camera_in_first_person                   = 62    # (set_camera_in_first_person, <value>), 
                                                     # 1 = first, 0 = third person
 
kalarhan said:
Aruda said:
latest version of Warband with 1.158 modsys.

set_camera_in_first_person  is not in header operations for some reason, tried adding it manually to header ops. didnt work. What should i do?

if you are using Warband 1.170+ (latest), then all you need to do is add it to your header_operations.py. The operation was included for a VC update, that is why it is more recent (newer than version 1.158 you have). It works on any Warband module (if you use the latest .exe).

Code:
is_camera_in_first_person                    = 61    # (is_camera_in_first_person),
set_camera_in_first_person                   = 62    # (set_camera_in_first_person, <value>), 
                                                     # 1 = first, 0 = third person

Oh thank you very much!
 
Oh thank you very much!
Soooooo, all I need to do is to:


1. Open header_operations.py

2.Add:

"
is_camera_in_first_person = 61 # (is_camera_in_first_person),
set_camera_in_first_person = 62 # (set_camera_in_first_person, <value>),
# 1 = first, 0 = third person
"
3.Save

4.Obtain the corresponding TXT file

... and that's all ? Just play ?
 
Soooooo, all I need to do is to:


1. Open header_operations.py

2.Add:

"
is_camera_in_first_person = 61 # (is_camera_in_first_person),
set_camera_in_first_person = 62 # (set_camera_in_first_person, <value>),
# 1 = first, 0 = third person
"
3.Save

4.Obtain the corresponding TXT file

... and that's all ? Just play ?
That is wrong. You better learn the basics of scripting and then do what Earendil said.
 
Hello everyone! I tried to use this tutorial for my mod, but found it to be a bit incomplete. Thanks to dstn and Seek & Destroy, we have found out how to fix the issue with the camera being inside of the player's head when trying to use this script from the third person perspective, by simply disabling the script when the player is in the third person perspective.

singleplayer_ironsight_mode = (

0, 0, 0, [],
[
(get_player_agent_no, ":player_agent"),
# (ge, ":player_agent", 0),
(try_begin),
(game_key_is_down, gk_view_char),
(mission_cam_set_mode, 0),
(else_try),
(agent_get_wielded_item, ":player_item", ":player_agent", 0),
(this_or_next|eq, ":player_item", "itm_springfield_1861_m"),
(this_or_next|eq, ":player_item", "itm_springfield_1861"),
(this_or_next|eq, ":player_item", "itm_enfield_rifle_musket_bayonet"),
(this_or_next|eq, ":player_item", "itm_enfield_rifle_musket"),
(this_or_next|eq, ":player_item", "itm_springfield_1855"),
(this_or_next|eq, ":player_item", "itm_springfield1855_m"),
(eq, ":player_item", "itm_kentucky_rifle"),
(game_key_is_down, gk_zoom),
(agent_get_horse, ":horse", ":player_agent"),
(eq, ":horse", -1),
(is_camera_in_first_person),
(set_camera_in_first_person, 1),
(agent_get_look_position, pos1, ":player_agent"),
(position_move_x, pos1, 7),
(position_move_z, pos1, 40),
(init_position, pos2),
(init_position, pos3),
(position_copy_rotation, pos3, pos1),
(position_copy_rotation, pos1, pos2),
(position_move_z, pos1, 127),
(position_copy_rotation, pos1, pos3),
(mission_cam_set_mode, 1),
# whatever you do to zoom...
(mission_cam_set_position, pos1),
(mission_cam_set_aperture, 45),
(else_try),
(agent_get_wielded_item, ":player_item", ":player_agent", 0),
(this_or_next|eq, ":player_item", "itm_springfield_1861_m"),
(this_or_next|eq, ":player_item", "itm_springfield_1861"),
(this_or_next|eq, ":player_item", "itm_enfield_rifle_musket_bayonet"),
(this_or_next|eq, ":player_item", "itm_enfield_rifle_musket"),
(this_or_next|eq, ":player_item", "itm_springfield_1855"),
(this_or_next|eq, ":player_item", "itm_springfield1855_m"),
(eq, ":player_item", "itm_kentucky_rifle"),
(game_key_is_down, gk_attack),
(agent_get_horse, ":horse", ":player_agent"),
(eq, ":horse", -1),
(is_camera_in_first_person),
(agent_get_look_position, pos1, ":player_agent"),
(position_move_x, pos1, 7),
(position_move_z, pos1, 40),
(init_position, pos2),
(init_position, pos3),
(position_copy_rotation, pos3, pos1),
(position_copy_rotation, pos1, pos2),
(position_move_z, pos1, 127),
(position_copy_rotation, pos1, pos3),
(mission_cam_set_mode, 1),
(mission_cam_set_position, pos1),
(else_try),
(mission_cam_set_mode, 0),
(try_end),
])

Notice the addition of "(is_camera_in_first_person),". This is a can fail operation that passes when the camera is in first person. If in third person, it will block the script from proceeding.

If you wanted the script to do the opposite, and only pass when in third person, you would instead add "(neg|is_camera_in_first_person),"

However for our purpose here of making sure that the iron sights script will only function when the player is in first person, "(is_camera_in_first_person)," must be added to both code blocks, below "(game_key_is_down, gk_zoom)," and "(game_key_is_down, gk_attack),"

The other important thing to notice is the addition of:
"(agent_get_horse, ":horse", ":player_agent"),
(eq, ":horse", -1),
"

This will make sure that the script is disabled when the player is mounted, and therefore only being activated when the player is on foot and in the first person perspective. Without this, the script will cause the camera to end up inside of the player's horse while they are mounted.
 
Last edited:
Back
Top Bottom