OSP Code Combat Perfectly Smooth, Mouse-Enabled Deathcam V1.4

Users who are viewing this thread

I downloaded the source code for Diplomacy 4.3 and replaced the module_mission_templates.py with this: https://github.com/Zephilinox/Bean/blob/master/Bean%200.1/module_mission_templates.py

then used "build module.bat". Unfortunately, when I run the compiled Diplomacy, it still has the old deathcam. What did I do wrong?
 
aleeque said:
I downloaded the source code for Diplomacy 4.3 and replaced the module_mission_templates.py with this: https://github.com/Zephilinox/Bean/blob/master/Bean%200.1/module_mission_templates.py

then used "build module.bat". Unfortunately, when I run the compiled Diplomacy, it still has the old deathcam. What did I do wrong?

Sorry, I used Diplomacy 4.2 so maybe there was a compatibility problem? Take a look at the file again (I updated the link in my post on this page, it's been moved) and ctrl+f for "diplomacy" as I think I marked my changes with comments.

I'm surprised and happy that this little piece of code is being used in so many mods, especially popular ones. I've updated the OP with links to them.
 
I've updated the Deathcam to 1.4

Changelog:
Version 1.4
  • Added: Press 'End' to flip Y rotation
  • Added: Use numpad to rotate the camera in addition to the mouse (useful when having the battle presentation open, or if you can't rotate with the mouse for some reason)
  • Fixed: Now detects what team the player is on and only causes that team to charge

Thanks for the idea of flipping the Y rotation Lav, I never thought about it. Wish there was an operation to get the players Y-rotation setting from the game.

I added numpad rotation because I received a report that someone couldn't use their mouse to rotate. You can use either numpad 2 or numpad 5 to rotate down (I prefer using numpad 5 as it is closer and more like using WASD)

The old version made all 4 teams charge which might not be desirable for formations, etc. So now only the player team will charge, and this is detected regardless of what team the player is on.
 
Trying to learn python (my forte has been php upto now) so I understand coding but for the life of me I can't not find the problem in the code I'm experiencing.

Using 1.4 (and I've tried the 1.3 section) I can not seem to get camera movement to work, and I incur a error trying to retreat due to enemy troops.  Since the deathcam itself, as well as the rotation functions, work I have no idea.  At first I thought it was a placement issue, then tried the 1.3 section on movement, even tried creating a normal character instead of the quick character wondering if there was some initialization error caused by that.  No avail so far.

Any hints where to even look?
 
TarnishedArmour said:
Trying to learn python (my forte has been php upto now) so I understand coding but for the life of me I can't not find the problem in the code I'm experiencing.
Mount&Blade modding uses a custom scripting language, which then gets processed through Python. You've got no use for Python in about 99.5% of everything you may or may not create. Are you certain you want to be talking about Python?

As for your actual question, the most likely cause is that you somehow messed up implementing the proper bits in the respective mission templates. Check the bit that reads input and moves the camera around; make sure you've got it referenced everywhere where it needs to be. Mission template modifications can quite often become a pain, especially if you're just starting out.
 
Double checked the placement of the four lines initializing the various deathcam scripts and in every place one is present, all four are.  So unless there's some sort of "bleed over' effect from one mission template to another and it's translating only partially I can't believe it would be that.  I think that's the every where it needs to be you mentioned.  As for the first part, it was a direct copy and paste of the 1.4 move section, the 1.3 move section, and then back again when I was first trouble shooting, but that doesn't mean I didn't mess anything up there.

That's where I guess I'll focus my attention before I try different battle scenes to see if it's just the open field battle that's not working.  I'll double check the code itself to make sure it matches what Zephilinox has.  Maybe it's as simple as some tab placements...? I don't know, running Lav's compiler hasn't shown me any formatting errors though, though that might just mean my formatting errors match on both sides of the code.

Regardless, thank you for the pointing in a direction, I'll dig and figure a bit before I complain again.
 
Has anyone ever tried to untie the smoothness of the cam & framerate? I've got like 45 fps, and it's still laggy as ****.

Moving the cam with numpad keys works like a charm, but the mouse doesn't work well. It moves with stutter and doesn't take the input of moving the mouse correctly.
 
snouz said:
Has anyone ever tried to untie the smoothness of the cam & framerate? I've got like 45 fps, and it's still laggy as ****.

Moving the cam with numpad keys works like a charm, but the mouse doesn't work well. It moves with stutter and doesn't take the input of moving the mouse correctly.

I'm having the same issues. Looking into it now.

EDIT: I have no clue why its doing this. Shame, I need a good camera for my mod, and I'm not an expert in this sort of thing :/
 
Slavos said:
LootingScumbag said:
so uh how do install this deathcam if i dont have the osp??

the codes are in the first page of this topic, you just need to follow the instructions

yeah but dont you need all the precompiled files to edit? how do i do this for brytenwalda if it is compiled? im new so if you can explain
 
LootingScumbag said:
yeah but dont you need all the precompiled files to edit? how do i do this for brytenwalda if it is compiled? im new so if you can explain

Engine is the same. Native, Brytenwalda, VC, ... they all use the game engine, which right now is version 1.168.

Engine has a API that you can access using operations (header_operations.py).

So you can get a OSP code (like this camera feature) and include it on Native, Brytenwalda (code for 1.41 is open source), VC (you can download the code too), etc, as long you have the source for the mod you are messing with.

You will need to update old OSP if they are using outdated code (as the game changed over 10 years). But that is your job as the modder. Code, test, code, test, ...

Read the instructions. And the tutorials. They explain all this.
 
TarnishedArmour said:
Double checked the placement of the four lines initializing the various deathcam scripts and in every place one is present, all four are.  So unless there's some sort of "bleed over' effect from one mission template to another and it's translating only partially I can't believe it would be that.  I think that's the every where it needs to be you mentioned.  As for the first part, it was a direct copy and paste of the 1.4 move section, the 1.3 move section, and then back again when I was first trouble shooting, but that doesn't mean I didn't mess anything up there.

That's where I guess I'll focus my attention before I try different battle scenes to see if it's just the open field battle that's not working.  I'll double check the code itself to make sure it matches what Zephilinox has.  Maybe it's as simple as some tab placements...? I don't know, running Lav's compiler hasn't shown me any formatting errors though, though that might just mean my formatting errors match on both sides of the code.

Regardless, thank you for the pointing in a direction, I'll dig and figure a bit before I complain again.

Sorry I don't know why it wouldn't be working for you, make sure you double check everything, perhaps I missed a trigger? I remember there was some kind of bug I found in 1.3 to do with not being able to retreat, there may be others, though the deathcam is working just fine in big mods like Perisno.

snouz said:
Has anyone ever tried to untie the smoothness of the cam & framerate? I've got like 45 fps, and it's still laggy as ****.

Moving the cam with numpad keys works like a charm, but the mouse doesn't work well. It moves with stutter and doesn't take the input of moving the mouse correctly.

It's not possible. Mouse position is directly tied to framerate, while keyboard input is not. The only exception to this is when there is a presentation open, and the original version of this deathcam did use a presentation in order to get the movement to be smooth, however the controls were very finicky and not user friendly. It was based on the deathcam that was in a mod called Blood & Steel I believe, which used a presentation-based deathcam. Perhaps look at that mod and see if it is OSP.

That was why I added the numpad controls, for when framerate becomes an issue. The mouse rotation is improved compared to other deathcams due to the fact that when I made my deathcam there was no command for smoothly rotating on an axis (I believe Y?), however one of the more recent updates implemented that command so my little workaround isn't really necessary anymore, though it makes no difference now back then it was a big factor in to why mouse-rotation deathcams were so bad to use.

You can see that relevant code here:

Code:
            (position_rotate_x_floating, pos47, ":neg_rotx"), #Reset x axis to initial state

            (position_rotate_y, pos47, 90), #Barrel roll by 90 degrees to inverse x/z axis
            (position_rotate_x_floating, pos47, ":delta_x"), #Rotate simulated z axis, Horizontal
            (position_rotate_y, pos47, -90), #Reverse

            (position_rotate_x_floating, pos47, "$deathcam_total_rotx"), #Reverse

which was necessary because position_rotate_y_floating did not exist, causing rotation to truncate to whole numbers.

LootingScumbag said:
i was disgusted with how bad the native one is... how can they release a feature that doesnt even work lol

There is no native deathcam whatsoever though, unless they added in to a newer version?

LootingScumbag said:
Slavos said:
LootingScumbag said:
so uh how do install this deathcam if i dont have the osp??

the codes are in the first page of this topic, you just need to follow the instructions

yeah but dont you need all the precompiled files to edit? how do i do this for brytenwalda if it is compiled? im new so if you can explain

This deathcam is only usable if you have the source code. Ask your mod dev team to implement the deathcam if the source is not available.

kalarhan said:
LootingScumbag said:
yeah but dont you need all the precompiled files to edit? how do i do this for brytenwalda if it is compiled? im new so if you can explain

Engine is the same. Native, Brytenwalda, VC, ... they all use the game engine, which right now is version 1.168.

Engine has a API that you can access using operations (header_operations.py).

So you can get a OSP code (like this camera feature) and include it on Native, Brytenwalda (code for 1.41 is open source), VC (you can download the code too), etc, as long you have the source for the mod you are messing with.

You will need to update old OSP if they are using outdated code (as the game changed over 10 years). But that is your job as the modder. Code, test, code, test, ...

Read the instructions. And the tutorials. They explain all this.

The deathcam should work as it is without any updates to it unless something changed with the various battle triggers. For instance if you use the diplomacy mod there is extra work you need to do to get the deathcam working, which I believe I explained on page 2 of this thread.
 
I stuck the code into a file for using with Modmerger, if y'all want.

link

check the readme for isntallation instructions, but if you've used modmerger before its the same as everything else.
 
mercury19 said:
I stuck the code into a file for using with Modmerger, if y'all want.

link

check the readme for isntallation instructions, but if you've used modmerger before its the same as everything else.

Wow that's cool dude, thanks.

I'm amazed this OSP is still seeing use after so many years, you guys are awesome.
 
I have found a bug and fixed it. The bug occurs when camera is leaning to the ground and you press [Home] button. The camera starts to leaning to left or right when you trying to rotate horizontally. I recovered angle when you press [Home] and rotation around Z. That caused a bug.

1) Optional. Remove ":rot_z" with a "$deathcam_death_rot_z". When you press [Home] it will remember rotation around Z-axis.
(position_get_rotation_around_z, "$deathcam_death_rot_z", pos1),

(init_position, pos47),
(position_copy_origin, pos47, pos1), #Copy X,Y,Z pos
(position_rotate_z, pos47, "$deathcam_death_rot_z"), #Copying X-Rotation is likely possible, but I haven't figured it out yet
2) Optional [Home] button. (orange is optionall)
(key_clicked, key_home),
(init_position, pos47),
(position_set_x, pos47, "$deathcam_death_pos_x"),
(position_set_y, pos47, "$deathcam_death_pos_y"),
(position_set_z, pos47, "$deathcam_death_pos_z"),
(position_rotate_z, pos47, "$deathcam_death_rot_z"),
(assign, "$deathcam_total_rotx", 0),
(try_end),
3) Optional. Prevent camera to go underground by xenoargh. Add before (mission_cam_set_position, pos47),
# xenoargh
# Prevent to go underground
(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", 20000),
(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),
 
Last edited:
Back
Top Bottom