Starbound

Starbound

Drop Further Before Damage
bk3000 5. dec. 2016 kl. 10:53
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.
Sidst redigeret af bk3000; 24. feb. 2017 kl. 11:57
< >
Viser 1-14 af 14 kommentarer
bk3000 5. dec. 2016 kl. 11:08 
If by chance you have questions about how that works, let me know.
soopytwist  [udvikler] 24. feb. 2017 kl. 8:31 
@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.
Sidst redigeret af soopytwist; 24. feb. 2017 kl. 8:43
🐱 24. feb. 2017 kl. 8:42 
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  [udvikler] 24. feb. 2017 kl. 9:03 
Oprindeligt skrevet af 😺:
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.

Sidst redigeret af soopytwist; 24. feb. 2017 kl. 9:19
Xaliber 24. feb. 2017 kl. 9:54 
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 kl. 11:33 
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.
Sidst redigeret af bk3000; 24. feb. 2017 kl. 11:41
soopytwist  [udvikler] 24. feb. 2017 kl. 11:47 
Oprindeligt skrevet af 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.
Sidst redigeret af soopytwist; 24. feb. 2017 kl. 11:48
bk3000 24. feb. 2017 kl. 11:50 
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 kl. 11:54 
I also need to do the latest update, and unpack to make sure.
bk3000 24. feb. 2017 kl. 12:01 
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 kl. 12:12 
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.
Sidst redigeret af bk3000; 24. feb. 2017 kl. 12:13
soopytwist  [udvikler] 24. feb. 2017 kl. 12:17 
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  [udvikler] 24. feb. 2017 kl. 12:19 
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 kl. 12:26 
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.
Sidst redigeret af bk3000; 24. feb. 2017 kl. 12:27
< >
Viser 1-14 af 14 kommentarer
Per side: 1530 50