Starbound

Starbound

Drop Further Before Damage
bk3000 5 Dec, 2016 @ 10:53am
Accomplishing this without replacing player_primary.lua
1. Patch a script into /statusControllerSettings/primaryScriptSources/
Something like this

[
{
"op" : "add",
"path" : "/statusControllerSettings/primaryScriptSources/-",
"value" : "/scripts/soopytwist/soopytwist_dropFurther.lua"
}
]

(edited)

2. The script looks something like this

soopytwist_dropFurther = {} soopytwist_dropFurther.applyDamageRequest = applyDamageRequest applyDamageRequest = function(damageRequest) if damageRequest.damageSourceKind == "falling" then local minimumFallDistance = 24 --default was 14 local fallDistanceDamageFactor = 3 local minimumFallVel = 40 local baseGravity = 80 local gravityDiffFactor = 1 / 30.0 local curYPosition = mcontroller.yPosition() local yPosChange = curYPosition - (self.lastYPosition or curYPosition) if self.fallDistance > minimumFallDistance and -self.lastYVelocity > minimumFallVel and mcontroller.onGround() then local damage = (self.fallDistance - minimumFallDistance) * fallDistanceDamageFactor damage = damage * (1.0 + (world.gravity(mcontroller.position()) - baseGravity) * gravityDiffFactor) damage = damage * status.stat("fallDamageMultiplier") damageRequest.damage = damage end end return soopytwist_dropFurther.applyDamageRequest(damageRequest) end

Thus you are compatible with other mods that hook into the player environment. Most likely you would be compatible with future SB updates, otherwise needing only minor changes.
Last edited by bk3000; 24 Feb, 2017 @ 11:57am
< >
Showing 1-14 of 14 comments
bk3000 5 Dec, 2016 @ 11:08am 
If by chance you have questions about how that works, let me know.
soopytwist  [developer] 24 Feb, 2017 @ 8:31am 
@bk3000 Woops! I had no idea this was here. When you said you posted in the discusions I thought you were talking about the forum or something. The mod worked, I moved onto other things and figured I'd come back to it when it broke. Well it's broke. Don't understand your instructions though.

You say Patch a script into /statusControllerSettings/primaryScriptSources/ - what directory is this?

I've never used script hooking before, no idea what to do.
Last edited by soopytwist; 24 Feb, 2017 @ 8:43am
🐱 24 Feb, 2017 @ 8:42am 
The mentionned patch is supposed to be for the
/player.config
file, the path
/statusControllerSettings/primaryScriptSources/-
is an array of scripts that'll be loaded with the character
soopytwist  [developer] 24 Feb, 2017 @ 9:03am 
Originally posted by 😺:
The mentionned patch is supposed to be for the
/player.config
file, the path
/statusControllerSettings/primaryScriptSources/-
is an array of scripts that'll be loaded with the character
Oh, I see. I must be doing something wrong though. The game crashes before the main menu appears.

EDIT

To clarify. I've got player.config.patch in the mod folder. In that is:

{
"op" : "add",
"path" : "/statusControllerSettings/primaryScriptSources/",
"value" : "/scripts/soopytwist/soopytwist_dropFurther.lua"
}

Also in the mod folder is scripts\soopytwist\soopytwist_dropFurther.lua.

In that I have the bk3000's script above.

The game just updated twice, not sure if it's one of my other mods that's broke or what.

Last edited by soopytwist; 24 Feb, 2017 @ 9:19am
Xaliber 24 Feb, 2017 @ 9:54am 
I think you forgot the square brackets in player.config.patch. It should be:

[ { "op" : "add", "path" : "/statusControllerSettings/primaryScriptSources/-", "value" : "/scripts/soopytwist/soopytwist_dropFurther.lua" } ]

Should work by then.
bk3000 24 Feb, 2017 @ 11:33am 
True I didn't add the brackets. I was incorrectly thinking they already has a player.config.patch to add this too but probably was thinking of another mod. oops.

I don't remember if I tested that code or not, but let me know if it has any issues(probably a misCapitalization) then I'll fix them.
Last edited by bk3000; 24 Feb, 2017 @ 11:41am
soopytwist  [developer] 24 Feb, 2017 @ 11:47am 
Originally posted by bk3000:
True I didn't add the brackets. I was incorrectly thinking they already has a player.config.patch to add this too but probably was thinking of another mod. oops.

I don't remember if I tested that code or not, but let me know if it has any issues(probably a misCapitalization) then I'll fix them.
Ah, yes of course. Okay the game isn't crashing now so it's running the fall damage script but I'm still losing health when dropping from the E.A.S.E.L platform. The game got patched twice earlier - not sure if this has broken something.
Last edited by soopytwist; 24 Feb, 2017 @ 11:48am
bk3000 24 Feb, 2017 @ 11:50am 
Oh I noticed something "wonderful". If you copy/paste from this page, it all gets messed up!
I'll pastebin it.
bk3000 24 Feb, 2017 @ 11:54am 
I also need to do the latest update, and unpack to make sure.
bk3000 24 Feb, 2017 @ 12:01pm 
After actually trying out my code on the (almost latest) nightly, it is close. I take 7 damage(very little) jumping from the easle area. So maybe just some minor math adjustment.
bk3000 24 Feb, 2017 @ 12:12pm 
Wait there really is something wrong with that. I wasn't thinking clearly LOL.

This only gets called on damage. So it won't be able to compare from previous positions!
My bad. Have to think up something better.

Probably something involving mcontroller.velocity

Probably you'll need to do it the old way for now.
Last edited by bk3000; 24 Feb, 2017 @ 12:13pm
soopytwist  [developer] 24 Feb, 2017 @ 12:17pm 
Okay, I can't be doing with this jumping back and fourth from the comments to the discussion. Lets just stick to the discussion. See my comments for an update - think I made it worse.
soopytwist  [developer] 24 Feb, 2017 @ 12:19pm 
The game got two updates today (for me anyway) yet the packed.pak is still dated 18th Jan which I already have unpacked.
bk3000 24 Feb, 2017 @ 12:26pm 
I think I figured out a clean way. I'll hook the tail end of update.
Store those values under the storage table
Then I can access them in applyDamageRequest

Then it should work.

I'll let you know when I have TESTED that it does, and pastebin the script.
Last edited by bk3000; 24 Feb, 2017 @ 12:27pm
< >
Showing 1-14 of 14 comments
Per page: 1530 50