[Mod] Sprint [sprint]

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Sprint [sprint]

by texmex » Post

I'm gonna try animated particles…
Image

User avatar
LMD
Member
Posts: 1397
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Sprint [sprint]

by LMD » Post

Very basic requirement. However, not compatible with other speed potions etc, insert this code to change :

Code: Select all

local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
	local player = minetest.get_player_by_name(playerName)
	if players[playerName] then
		local physics=player:get_physics_override()
		local was_sprinting=players[playerName]["sprinting"]
		players[playerName]["sprinting"] = sprinting
		if sprinting == true then
			if not was_sprinting then
			    player:set_physics_override({speed=physics["speed"]*SPRINT_SPEED,jump=physics["jump"]*SPRINT_JUMP})
			end
		elseif sprinting == false then
			if was_sprinting then
				player:set_physics_override({speed=physics.speed/SPRINT_SPEED,jump=physics.jump/SPRINT_JUMP})
			end
		end
		return true
	end
	return false
end
Replace the original sprint function. Note : This interprets sprint as AMPLIFICATION, not as ADDITION! Thats a huge difference.
My stuff: Projects - Mods - Website

hexYeah
New member
Posts: 8
Joined: Wed Dec 12, 2018 02:09
In-game: hexYeah

Re: [Mod] Sprint [sprint]

by hexYeah » Post

awesome thank you !

User avatar
LMD
Member
Posts: 1397
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Sprint [sprint]

by LMD » Post

You're welcome !
My stuff: Projects - Mods - Website

Sunge
Member
Posts: 11
Joined: Tue Jan 14, 2020 20:33
GitHub: vraisunge
In-game: Sunge

Re: [Mod] Sprint [sprint]

by Sunge » Post

Is this outdated? I get an error:
[EDIT] It's working as standalone, but not with HudBars 2.3.2 (as you can see in the log)[END]

AsyncErr: ServerThread::run Lua: Runtime error from mod 'sprint' in callback on_joinplayer(): ...\Desktop\Minetest\bin\..\builtin\common\misc_helpers.lua:631: Too many arguments provided to core.translate
stack traceback:
[C]: in function 'error'
...\Desktop\Minetest\bin\..\builtin\common\misc_helpers.lua:631: in function 'S'
...test\bin\..\mods\minetest_hudbars-2.3.2-a7fcac4\init.lua:78: in function 'make_label'
...test\bin\..\mods\minetest_hudbars-2.3.2-a7fcac4\init.lua:193: in function 'add_all'
...test\bin\..\mods\minetest_hudbars-2.3.2-a7fcac4\init.lua:303: in function 'init_hudbar'
...ers\Sten\Desktop\Minetest\bin\..\mods\sprint/esprint.lua:37: in function <...ers\Sten\Desktop\Minetest\bin\..\mods\sprint/esprint.lua:27>
...s\Sten\Desktop\Minetest\bin\..\builtin\game\register.lua:429: in function <...s\Sten\Desktop\Minetest\bin\..\builtin\game\register.lua:413>

Hoffscore
New member
Posts: 7
Joined: Fri Sep 02, 2016 04:41
IRC: Hoffscore or csisdustin
In-game: Hoff
Location: University Heights, Calgary, AB, Canada

Re: [Mod] Sprint [sprint]

by Hoffscore » Post

OOps! Not your Mod, but I can't delete this posting???

HBSprint says no dependancies, but requires hunger value? runs in Jaunchi game which has no hunger value...

AsyncErr: Lua: Runtime error from mod '' in callback environment_Step(): ...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:232: attempt to index global 'hbhunger' (a nil value)
stack traceback:
...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:232: in function 'sprint_step'
...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:257: in function <...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:253>
...st\minetest-5.5.0-win64\bin\..\builtin\game\register.lua:425: in function <...st\minetest-5.5.0-win64\bin\..\builtin\game\register.lua:409>

sorry, I'll cut this when my brain works..
Last edited by Hoffscore on Mon Feb 14, 2022 18:59, edited 1 time in total.

User avatar
LMD
Member
Posts: 1397
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Sprint [sprint]

by LMD » Post

Hoffscore wrote:
Sun Feb 13, 2022 00:38
Sprint says no dependancies, but requires hunger value? Jaunchi game has no hunger value...

AsyncErr: Lua: Runtime error from mod '' in callback environment_Step(): ...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:232: attempt to index global 'hbhunger' (a nil value)
stack traceback:
...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:232: in function 'sprint_step'
...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:257: in function <...-5.5.0-win64\bin\..\games\juanchi\mods\hbsprint\init.lua:253>
...st\minetest-5.5.0-win64\bin\..\builtin\game\register.lua:425: in function <...st\minetest-5.5.0-win64\bin\..\builtin\game\register.lua:409>
Wrong topic. The mod you're having issues with clearly is hbsprint.
My stuff: Projects - Mods - Website

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests