Welcome to Open Carnage

A resource for Halo Custom Edition and MCC modding, with unique means of rewarding content creation and support. Have a wander to see why we're worth the time!

EST. 14th of February, 2012

Enclusion

Disable fall damage (cheat_jetpack 1) only under certain situations

Script that does what the title says. The situations would be either when speed command is enabled (/s in SAPP) or when getting out of a banshee. Would like option to disable and enable these individually. Thanks if you do this, no worries if you don't.

Share this post


Link to post
Share on other sites

Tiddy-bits:

Could be another useful script! Moving really fast makes it really easy to die from fall damage, so something like this could be useful to server hosts.

 

Therefore, I'm offering another three (3) raffle tickets to the first person who successfully fulfills this request. For more information on our monthly raffle, check out the FAQ.

 

If nobody takes it within one week of my post being made, I will fulfill the request, myself.

Share this post


Link to post
Share on other sites
On 7/11/2019 at 5:38 PM, Kavawuvi said:

Could be another useful script! Moving really fast makes it really easy to die from fall damage, so something like this could be useful to server hosts.

 

Therefore, I'm offering another three (3) raffle tickets to the first person who successfully fulfills this request. For more information on our monthly raffle, check out the FAQ.

 

If nobody takes it within one week of my post being made, I will fulfill the request, myself.

Great. My second request and its another one with a reward lol.

Share this post


Link to post
Share on other sites

Posted (edited)

I am unsure of the progress on this script but I'll share some short research into it in case someone with the time and familiarity with lua can make use of it.

 

cheat_jetpack cannot be used as it applies globally to all player-controlled units. Furthermore, marking a player as invulnerable would have undesired effects.

A hack to Halo's code must be used, so that players can be selectively marked as invulnerably to falling damage.

 

The relevant section when Halo's loads the global cheat_jetpack can be found below:

CPU Disasm
Address   Hex dump         Command                                      Comments
0057332F  |> \A0 ????????  MOV AL,BYTE PTR DS:[globals::cheat_jetpack]
00573334  |.  83CB FF      OR EBX,FFFFFFFF
00573337  |.  84C0         TEST AL,AL
00573339  |.  74 0C        JZ SHORT 00573347
0057333B  |.  399E 1802000 CMP DWORD PTR DS:[ESI+218],EBX               ; cmp unit->controlling_player, -1
00573341  |.  0F85 2D01000 JNE 00573474                                 ; take jump to skip falling damage check

The reason the controlling player is tested against is that cheat_jetpack applies only to player-controlled units. EAX is clobbered without being read from regardless of the path through this snippet, which gives us a bit of freedom. I opt to repurpose the object flags (a DWORD) at offset 0x10 from the player's object address (specifically the most-significant bit, but I believe the 4 most significant bits go unused).

CPU Disasm
Address   Hex dump              Command                                  Comments
0057332F     \83CB FF           OR EBX,FFFFFFFF
00573332      F746 10 00000080  TEST DWORD PTR DS:[ESI+10],80000000      ; unit->object_flags & 0x80000000 (most-significant bit)
00573339  |.  74 0C             JZ SHORT 00573347
0057333B  |.  399E 18020000     CMP DWORD PTR DS:[ESI+218],EBX           ; cmp unit->controlling_player, -1
00573341  |.  0F85 2D010000     JNE 00573474                             ; take jump to skip falling damage check

This effectively disables cheat_jetpack, but replaces it with the ability to re-enable it on specific units by setting the most-significant bit in the object flags.

The signature A0????????83CBFF84C0740C399E18020000 is sufficient to search for this snippet.

 

This script should be a start if someone with the time wants to complete this request. I have not done ANY testing for it outside of manually writing the patch and setting the repurposed flag through OllyDBG, and I am not familiar with lua nor its integration into SAPP, so quite a bit of additional work and verification may be needed. Also note that if the player dies, they will no longer be marked as invulnerable to fall damage. This might be a blessing for this request but it is inconsistent with the original behavior of cheat_jetpack. If someone wishes to complete the script to the satisfaction of the requestor, I do not mind if they wish to take full credit for it.

 

My apologies if my naming convention clashes with the standard convention for lua/SAPP scripting.

 

Edit: Addresses above are from the 1.10 haloded.exe included with SAPP, but the signature works on the Custom Edition server (in addition to the 1.10 PC/CE clients).

Edit2: Script linked isnt functional, will try to fix now that I have time to and SAPP set up

Edit3: Script loads and unloads, properly patches, and the set_player_jetpack function works as expected now

 

The script link above has been changed to a functional version (loads, unloads, properly patches). That being said, everything from this post still applies; the script does not complete the request, but if someone has the time and ability, they can use the set_player_jetpack function within to finish the request. The set_player_jetpack function was tested via the lua_call command.

 

Link to the update script in this post for good measure: pastebin.

Edited by PiRate
updated script link to working script
Tucker933 likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.